Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 3 additions & 3 deletions funannotate2/downloads.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"uniprot": "https://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_sprot.fasta.gz",
"uniprot-release": "https://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/reldate.txt",
"merops": "https://ftp.ebi.ac.uk/pub/databases/merops/current_release/meropsscan.lib",
"dbCAN": "https://pro.unl.edu/dbCAN2/download/Databases/V14/dbCAN-HMMdb-V14.txt",
"dbCAN-tsv": "https://pro.unl.edu/dbCAN2/download/Databases/V12/CAZyDB.08062022.fam-activities.txt",
"dbCAN-log": "https://pro.unl.edu/dbCAN2/download/Databases/V11/readme.txt",
"dbCAN": "https://dbcan.s3.us-west-2.amazonaws.com/db_v5-2-9_5-5-2026/dbCAN.hmm",
"dbCAN-tsv": "https://raw.githubusercontent.com/nextgenusfs/funannotate2/main/funannotate2/resources/dbCAN-fam-HMMs.txt",
"dbCAN-log": "https://raw.githubusercontent.com/nextgenusfs/funannotate2/main/funannotate2/resources/dbCAN.changelog.txt",
"pfam": "https://ftp.ebi.ac.uk/pub/databases/Pfam/current_release/Pfam-A.hmm.gz",
"pfam-tsv": "https://ftp.ebi.ac.uk/pub/databases/Pfam/current_release/Pfam-A.clans.tsv.gz",
"pfam-log": "https://ftp.ebi.ac.uk/pub/databases/Pfam/current_release/Pfam.version.gz",
Expand Down
6 changes: 3 additions & 3 deletions funannotate2/downloads_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"uniprot": "https://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/uniprot_sprot.fasta.gz",
"uniprot-release": "https://ftp.ebi.ac.uk/pub/databases/uniprot/current_release/knowledgebase/complete/reldate.txt",
"merops": "https://ftp.ebi.ac.uk/pub/databases/merops/current_release/meropsscan.lib",
"dbCAN": "https://pro.unl.edu/dbCAN2/download/Databases/V14/dbCAN-HMMdb-V14.txt",
"dbCAN-tsv": "https://pro.unl.edu/dbCAN2/download/Databases/V12/CAZyDB.08062022.fam-activities.txt",
"dbCAN-log": "https://pro.unl.edu/dbCAN2/download/Databases/V11/readme.txt",
"dbCAN": "https://dbcan.s3.us-west-2.amazonaws.com/db_v5-2-9_5-5-2026/dbCAN.hmm",
"dbCAN-tsv": "https://raw.githubusercontent.com/nextgenusfs/funannotate2/main/funannotate2/resources/dbCAN-fam-HMMs.txt",
"dbCAN-log": "https://raw.githubusercontent.com/nextgenusfs/funannotate2/main/funannotate2/resources/dbCAN.changelog.txt",
"pfam": "https://ftp.ebi.ac.uk/pub/databases/Pfam/current_release/Pfam-A.hmm.gz",
"pfam-tsv": "https://ftp.ebi.ac.uk/pub/databases/Pfam/current_release/Pfam-A.clans.tsv.gz",
"pfam-log": "https://ftp.ebi.ac.uk/pub/databases/Pfam/current_release/Pfam.version.gz",
Expand Down
23 changes: 20 additions & 3 deletions funannotate2/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def install(args):
logger.info("Retrieving download links from GitHub Repo")
DBURL = json.loads(
requests.get(
"https://raw.githubusercontent.com/nextgenusfs/funannotate2/master/funannotate2/downloads_v2.json"
"https://raw.githubusercontent.com/nextgenusfs/funannotate2/main/funannotate2/downloads_v2.json"
).text
)["downloads"]
except: # noqa: E722
Expand Down Expand Up @@ -537,8 +537,25 @@ def dbCANDB(wget=False):
md5 = calcmd5remote(DBURL.get("dbCAN"))
# download data
download(DBURL.get("dbCAN"), hmm, wget=wget)
download(DBURL.get("dbCAN-tsv"), familyinfo, wget=wget)
download(DBURL.get("dbCAN-log"), versionfile, wget=wget)

# Try to copy familyinfo and versionfile from local package resources, fallback to download
local_resources_dir = os.path.join(os.path.dirname(__file__), "resources")
local_fam = os.path.join(local_resources_dir, "dbCAN-fam-HMMs.txt")
local_changelog = os.path.join(local_resources_dir, "dbCAN.changelog.txt")

if os.path.exists(local_fam) and os.path.exists(local_changelog):
import shutil
try:
shutil.copy(local_fam, familyinfo)
shutil.copy(local_changelog, versionfile)
logger.info("Copied dbCAN metadata files from package resources")
except Exception as e:
logger.warning(f"Could not copy local metadata resources ({e}), falling back to download")
download(DBURL.get("dbCAN-tsv"), familyinfo, wget=wget)
download(DBURL.get("dbCAN-log"), versionfile, wget=wget)
else:
download(DBURL.get("dbCAN-tsv"), familyinfo, wget=wget)
download(DBURL.get("dbCAN-log"), versionfile, wget=wget)
dbdate = ""
dbvers = ""
with io.open(versionfile, encoding="utf8", errors="ignore") as infile:
Expand Down
Loading
Loading