Mercurial > repos > earlhaminst > ete
diff ete_lineage_generator.py @ 11:2db72467da51 draft
"planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/ete commit 67e136d433c0d925db362342919305b46fdffecd"
author | earlhaminst |
---|---|
date | Thu, 10 Mar 2022 14:01:44 +0000 |
parents | b29ee6a16524 |
children |
line wrap: on
line diff
--- a/ete_lineage_generator.py Fri Nov 20 16:56:22 2020 +0000 +++ b/ete_lineage_generator.py Thu Mar 10 14:01:44 2022 +0000 @@ -41,7 +41,14 @@ RANK_IDX: mapping from rank names to indices (distance to root/leaf?) lower: use lower taxa for filling "NA"s """ - lineage_taxids = ncbi.get_lineage(taxid) + try: + lineage_taxids = ncbi.get_lineage(taxid) + except ValueError: + sys.stderr.write("[%s] could not determine lineage!\n" % taxid) + return + if lineage_taxids is None: + sys.stderr.write("[%s] could not determine lineage!\n" % taxid) + return lineage_ranks = ncbi.get_rank(lineage_taxids) lineage_names = ncbi.get_taxid_translator(lineage_taxids, try_synonyms=True) if lower: @@ -121,6 +128,8 @@ with open(options.input_species_filename) as f: for line in f.readlines(): line = line.strip().replace('_', ' ') + if line == "": + continue try: taxid = int(line) except ValueError: