[Bio] / Babel / bin / source2ach.py Repository:
ViewVC logotype

Diff of /Babel/bin/source2ach.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10, Tue Mar 1 15:21:48 2011 UTC revision 1.11, Mon May 2 21:40:07 2011 UTC
# Line 108  Line 108 
108          if (not rec.name) or (not rec.description): continue          if (not rec.name) or (not rec.description): continue
109          names = rec.name.split(', ')          names = rec.name.split(', ')
110          if len(names) > 1:          if len(names) > 1:
111              kmap[ names[1] ] = rec.description              kmap[ names[1] ] = [ rec.description, names[0] ]
112      if params.verbose: sys.stdout.write("Done\n")      if params.verbose: sys.stdout.write("Done\n")
113      return kmap      return kmap
114    
# Line 298  Line 298 
298              seq  = str(rec.seq).upper()              seq  = str(rec.seq).upper()
299              md5  = hashlib.md5(seq).hexdigest()              md5  = hashlib.md5(seq).hexdigest()
300              org  = rec.annotations['organism']              org  = rec.annotations['organism']
301                code = ""
302              orth = []              orth = []
303              if org in amap:              if org in amap:
304                  org = amap[org]                  (org, code) = amap[org]
305                    code += ":"
306              # output KO ontology              # output KO ontology
307              if get_ont and ('orthology' in rec.annotations):              if get_ont and ('orthology' in rec.annotations):
308                  orth = rec.annotations['orthology']                  orth = rec.annotations['orthology']
309                  for oid, odesc in orth.iteritems():                  for oid, odesc in orth.iteritems():
310                      ont_f.write("\t".join([md5, oid, odesc, 'KO']) + "\n")                      ont_f.write("\t".join([md5, oid, odesc, 'KO']) + "\n")
311              seq_f.write("%s\t%s\n" %(md5, seq))              seq_f.write("%s\t%s\n" %(md5, seq))
312              prot_f.write("\t".join([md5, rec.id, rec.description, org, source]) + "\n")              prot_f.write("\t".join([md5, code + rec.id, rec.description, org, source]) + "\n")
313              if len(rec.dbxrefs) > 0:              if len(rec.dbxrefs) > 0:
314                  ref_f.write(rec.id + "\t" + "\t".join(rec.dbxrefs) + "\n")                  ref_f.write(rec.id + "\t" + "\t".join(rec.dbxrefs) + "\n")
315          return parse_kegg          return parse_kegg

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3