Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rely on reference prefix for NCBI protein database selection #22

Merged
merged 2 commits into from
May 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion mutalyzer_retriever/sources/ncbi.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,21 @@ def fetch(reference_id, reference_type, size_on=True, timeout=1):

:returns tuple: raw annotations, type ("gff3" or "genbank")
"""
db = _get_database(reference_id)
db = "nuccore"
# https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4702849/
# https://support.nlm.nih.gov/knowledgebase/article/KA-03437/
# https://support.nlm.nih.gov/knowledgebase/article/KA-03434/
# https://support.nlm.nih.gov/knowledgebase/article/KA-03389/
# https://www.ncbi.nlm.nih.gov/books/NBK21091/table/ch18.T.refseq_accession_numbers_and_mole/
if (
reference_id.startswith("AP_")
or reference_id.startswith("NP_")
or reference_id.startswith("WP_")
or reference_id.startswith("XP_")
or reference_id.startswith("YP_")
or reference_id.startswith("ZP_")
):
db = "protein"
if reference_type in [None, "gff3"]:
return fetch_gff3(reference_id, db, timeout), "gff3"
elif reference_type == "fasta":
Expand Down
Loading