comparison ete_lineage_generator.py @ 4:87b6de3ef63e draft

planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/ete commit 41e40314a9b25a9f3c06a13422d367b68334f593
author earlhaminst
date Thu, 22 Mar 2018 13:25:38 -0400
parents 03c10736e497
children f1eca1158f21
comparison
equal deleted inserted replaced
3:077021c45b96 4:87b6de3ef63e
74 # check command line options 74 # check command line options
75 if options.input_species_filename is None: 75 if options.input_species_filename is None:
76 parser.error("-s option must be specified, Species list in text format one species in each line") 76 parser.error("-s option must be specified, Species list in text format one species in each line")
77 if options.full and options.ranks: 77 if options.full and options.ranks:
78 parser.error("-f and -r can not be used at the same time") 78 parser.error("-f and -r can not be used at the same time")
79
79 if options.ranks: 80 if options.ranks:
80 for r in options.ranks: 81 for r in options.ranks:
81 if r not in LONG_RANKS: 82 if r not in LONG_RANKS:
82 parser.error("unknown rank %s" % r) 83 parser.error("unknown rank %s" % r)
83 # setup output 84 # setup output
103 if options.compress: 104 if options.compress:
104 for ir in range(len(RANKS)): 105 for ir in range(len(RANKS)):
105 for ilr in range(len(LONG_RANKS)): 106 for ilr in range(len(LONG_RANKS)):
106 if RANKS[ir] in LONG_RANKS[ilr]: 107 if RANKS[ir] in LONG_RANKS[ilr]:
107 COMP_RANK_IDX[LONG_RANKS[ilr]] = ir 108 COMP_RANK_IDX[LONG_RANKS[ilr]] = ir
109 # write header
110 of.write("#species/taxid\t%s\n" % ("\t".join(RANKS)))
111 # get and write data
108 with open(options.input_species_filename) as f: 112 with open(options.input_species_filename) as f:
109 for line in f.readlines(): 113 for line in f.readlines():
110 line = line.strip().replace('_', ' ') 114 line = line.strip().replace('_', ' ')
111 try: 115 try:
112 taxid = int(line) 116 taxid = int(line)