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

View of /FigTutorial/gf2maps_and_subs.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Thu Jun 10 20:53:40 2004 UTC (15 years, 5 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
New tutorial code in python

from FigKernelPackages import FIG2
import sys

fig = FIG2.FIG()

def die(msg):
	print msg
	sys.exit(0)

if len(sys.argv) != 2:
	die("usage: gf2maps_and_subs PEG")

# The single input argument must be a FIG id, which is used to get the assigned function.
# The program then prints a list of maps to which the gene can be connected,
# followed by a list of subsystems that contain the gene.

peg = sys.argv[1]

func = fig.function_of(peg)
func = func[0][1]
hypo = fig.hypo(func)
in_map = {}

if func and hypo[0] == 0: 
    roles = fig.roles_of_function(func)
    for role in roles:
	maps = fig.role_to_maps(role)
	for map in maps:
	    in_map[map] = 1

    maps_it_connects_to = in_map.keys()
    maps_it_connects_to.sort()

    if len(maps_it_connects_to) > 0:
	print "Maps that connect to %s\n" % func
	for map in maps_it_connects_to:
	    map_name = fig.map_name(map)
	    print "%s\t%s" % (map, map_name[0])
	print " ";
else:
    sys.stderr.write("you need to give a valid PEG with a non-hypothetical function to connect to maps\n")

subsystems_it_is_in = fig.peg_to_subsystems(peg)

if len(subsystems_it_is_in) > 0:
    print "Subsystems that contain %s\n" % peg
    for subsystem in subsystems_it_is_in:
	print subsystem

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3