Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
edna
custom_reference_database
Commits
fb63871e
Commit
fb63871e
authored
Mar 09, 2021
by
peguerin
Browse files
get ncbi closest name from fishbase name
parent
452cbee1
Changes
1
Hide whitespace changes
Inline
Side-by-side
cure_speciesname.py
View file @
fb63871e
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]:
print("------------")
for k,v in t.items():
print(k,v)
"""
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
])
try
:
taxid
=
rankNCBI
[
rankName
][
0
]
except
:
taxid
=
False
if
taxid
is
not
False
:
break
print
(
rank
,
rankName
,
taxid
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment