[Bio] / FigTutorial / genomes.ex.py Repository:
ViewVC logotype

Annotation of /FigTutorial/genomes.ex.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (view) (download) (as text)

1 : disz 1.1 from FigKernelPackages import FIG
2 :     import sys
3 :     import string
4 :    
5 :    
6 :     def die(msg):
7 :     print msg
8 :     sys.exit(0)
9 :    
10 :     fig = FIG.FIG()
11 :     sofar = {}
12 :    
13 :     def get_unique_abbreviation(which, sofar):
14 :     nonunique = fig.abbrev(which);
15 :     nonunique = string.rstrip(string.replace(nonunique," ", ""), ".")
16 :     if not sofar.has_key(nonunique):
17 :     sofar[nonunique] = 1
18 :     n = sofar[nonunique]
19 :     sofar[nonunique] = sofar[nonunique] + 1
20 :     return (nonunique+"."+str(n))
21 :    
22 :     for genome in fig.genomes("complete"):
23 :     which = fig.genus_species(genome)
24 :     abbrev = get_unique_abbreviation(which,sofar);
25 :     version = fig.genome_version(genome);
26 :     print "%s\t%s\t%s\t%s" % (genome, abbrev, version, which)
27 :    

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3