[Bio] / FigTutorial / features_around.py Repository:
ViewVC logotype

View of /FigTutorial/features_around.py

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.1 - (download) (as text) (annotate)
Thu Jun 10 14:51:56 2004 UTC (15 years, 8 months ago) by disz
Branch: MAIN
CVS Tags: merge-bodev_news-3, rast_rel_2014_0912, rast_rel_2008_06_18, rast_rel_2008_06_16, rast_rel_2008_07_21, rast_rel_2010_0928, rast_2008_0924, Root-bobdev_news, rast_rel_2008_09_30, caBIG-13Feb06-00, rast_rel_2010_0526, rast_rel_2014_0729, merge-trunktag-bobdev_news-1, rast_rel_2009_05_18, caBIG-05Apr06-00, rast_rel_2009_0925, rast_rel_2010_1206, rast_rel_2010_0118, caBIG-00-00-00, rast_rel_2009_02_05, rast_rel_2011_0119, rast_rel_2008_12_18, merge-trunktag-bodev_news-3, merge-bobdev_news-2, merge-bobdev_news-1, rast_rel_2008_10_09, rast_release_2008_09_29, rast_rel_2008_04_23, rast_rel_2008_08_07, rast_rel_2009_07_09, rast_rel_2010_0827, myrast_33, rast_rel_2011_0928, rast_rel_2008_09_29, rast_rel_2008_10_29, rast_rel_2009_03_26, merge-trunktag-bobdev_news-2, rast_rel_2008_11_24, HEAD
Branch point for: Branch-bobdev_news
Python version of tutorial code

from FigKernelPackages import FIG
import sys
import string

fig = FIG.FIG()

def die(msg):
	print msg

if len(sys.argv) != 2:
	die("usage: features_around ID")

id = sys.argv[1]

peg = fig.by_alias(id)
if peg:
    loc = fig.feature_location(peg)
    if loc:
	    (contig,beg,end) = fig.boundaries_of(loc)
            start_reg = int(fig.min(beg,end)) - 5000
            end_reg   = int(fig.max(beg,end)) + 5000
            genome = fig.genome_of(peg)
            (features_in_region,start_of_leftmost_feature,end_of_rightmost_feature) = fig.genes_in_region(genome,contig,start_reg,end_reg);
            for fid in features_in_region:
                loc1     = fig.feature_location(fid)
                aliases1 = fig.feature_aliases(fid)
                trunc    = fig.possibly_truncated(fid)

                pseq = func = prot_ln = ""

                if fig.ftype(fid) == "peg":
                    prot_ln = fig.translation_length(fid)
                    if prot_ln:
                        pseq = fig.get_translation(fid)
                        func = fig.function_of(fid)
		print string.join([fid, loc1, str(aliases1), str(trunc), str(func), str(prot_ln), pseq], "\t")
                #print join("\t",($fid,$loc1,$aliases1,$trunc,$func,$prot_ln,$pseq)),"\n";
	sys.stderr.write("Sorry, could not get the location of %s\n" % fid)
        #print STDERR "Sorry, could not get the location of $fid\n";
    sys.stderr.write("Sorry, could not figure out which PEG you meant by %s\n" % id)
    #print STDERR "Sorry, could not figure out which PEG you meant by $id\n";

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3