Commit fb63871e authored by peguerin's avatar peguerin
Browse files

get ncbi closest name from fishbase name

parent 452cbee1
from ete3 import Tree, TreeStyle, NodeStyle, TextFace, NCBITaxa
import pytaxize
tt =gn.resolve('Rhinobatos sainsburyi', data_source_id=177)
ncbi = NCBITaxa()
#ncbi = NCBITaxa(taxdump_file=path.abspath(localTaxdumpArchive))
globalnamesQuery =gn.resolve('Rhinobatos sainsburyi')
for t in tt[0]:
for k,v in t.items():
for gnQuery in globalnamesQuery[0]:
if 'FishBase Cache' == str(gnQuery['data_source_title']):
classificationPath = gnQuery['classification_path'].split('|')
classificationPathRanks = gnQuery['classification_path_ranks'].split('|')
zip_iterator = zip(classificationPathRanks, classificationPath)
classificationDict = dict(zip_iterator)
for rank in ['genus', 'family']:
if rank in list(classificationDict.keys()):
rankName = classificationDict[rank]
rankNCBI = ncbi.get_name_translator([rankName])
taxid = rankNCBI[rankName][0]
taxid = False
if taxid is not False:
print(rank, rankName, taxid)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment