Repository navigation
Stabilize GTDB-Tk, HUMAnN, Kaiju, and MAPseq Data Manager identities #8361
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
Open
mvdbeek
wants to merge
1
commit into
galaxyproject:main
Choose a base branch
from
mvdbeek:stable-dm-ids-gtdb-humann
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...managers/data_manager_humann_database_downloader/test-data/humann_nucleotide_database.loc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #This is a sample file distributed with Galaxy that enables tools | ||
| #to use a directory of metagenomics files. | ||
| #file has this format (white space characters are TAB characters) | ||
| #db-build-version-date db-name build /path/to/data | ||
| #db-build-source db-name build /path/to/data |
2 changes: 1 addition & 1 deletion
2
data_managers/data_manager_humann_database_downloader/test-data/humann_protein_database.loc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #This is a sample file distributed with Galaxy that enables tools | ||
| #to use a directory of metagenomics files. | ||
| #file has this format (white space characters are TAB characters) | ||
| #db-build-version-date db-name build /path/to/data | ||
| #db-build-source db-name build /path/to/data |
2 changes: 1 addition & 1 deletion
2
data_managers/data_manager_humann_database_downloader/test-data/humann_utility_mapping.loc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #This is a sample file distributed with Galaxy that enables tools | ||
| #to use a directory of metagenomics files. | ||
| #file has this format (white space characters are TAB characters) | ||
| #db-build-version-date db-name build /path/to/data | ||
| #db-build-source db-name build /path/to/data |
2 changes: 1 addition & 1 deletion
2
...s/data_manager_humann_database_downloader/tool-data/humann_nucleotide_database.loc.sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #This is a sample file distributed with Galaxy that enables tools | ||
| #to use a directory of metagenomics files. | ||
| #file has this format (white space characters are TAB characters) | ||
| #db-build-version-date db-name build /path/to/data | ||
| #db-build-source db-name build /path/to/data |
2 changes: 1 addition & 1 deletion
2
...gers/data_manager_humann_database_downloader/tool-data/humann_protein_database.loc.sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #This is a sample file distributed with Galaxy that enables tools | ||
| #to use a directory of metagenomics files. | ||
| #file has this format (white space characters are TAB characters) | ||
| #db-build-version-date db-name build /path/to/data | ||
| #db-build-source db-name build /path/to/data |
2 changes: 1 addition & 1 deletion
2
...agers/data_manager_humann_database_downloader/tool-data/humann_utility_mapping.loc.sample
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| #This is a sample file distributed with Galaxy that enables tools | ||
| #to use a directory of metagenomics files. | ||
| #file has this format (white space characters are TAB characters) | ||
| #db-build-version-date db-name build /path/to/data | ||
| #db-build-source db-name build /path/to/data |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
| <description>builder</description> | ||
| <macros> | ||
| <token name="@TOOL_VERSION@">1.10.1</token> | ||
| <token name="@VERSION_SUFFIX@">0</token> | ||
| <token name="@VERSION_SUFFIX@">1</token> | ||
| </macros> | ||
| <requirements> | ||
| <requirement type="package" version="@TOOL_VERSION@">kaiju</requirement> | ||
|
|
@@ -20,49 +20,38 @@ | |
| mv \$(find . -name "*nodes.dmp") '${out_file.extra_files_path}'/nodes.dmp && | ||
| mv \$(find . -name "*names.dmp") '${out_file.extra_files_path}'/names.dmp && | ||
| mv \$(find . -name "*.fmi") '${out_file.extra_files_path}'/database.fmi && | ||
| cp '$dmjson' '$out_file' | ||
| #if str($type.date) == "today" | ||
| database_digest=\$( | ||
| for database_file in database.fmi names.dmp nodes.dmp; do | ||
| printf '%s\0' "\$database_file"; | ||
| cat '${out_file.extra_files_path}'/"\$database_file"; | ||
| printf '\0'; | ||
| done | sha256sum | cut -d ' ' -f 1 | ||
| ) && | ||
| download_date=\$(date -u +%F) && | ||
| sed | ||
| -e "s/__DATABASE_DIGEST__/\$database_digest/g" | ||
| -e "s/__DOWNLOAD_DATE__/\$download_date/g" | ||
| '$dmjson' > '$out_file' | ||
| #else | ||
| cp '$dmjson' '$out_file' | ||
| #end if | ||
| ]]></command> | ||
| <configfiles> | ||
| <configfile name="dmjson"><![CDATA[#slurp | ||
| #import datetime | ||
| #if $type.date == "today" | ||
| #set date = datetime.datetime.utcnow().strftime("%Y-%m-%d") | ||
| #import json | ||
| #set $database_names = {"refseq": "(refseq) bacterial, archaeal and viral genomes in the NCBI RefSeq database with assembly status Complete", "refseq_nr": "(refseq_nr) proteins from bacteria, Archaea, viruses, fungi and microbial eukaryotes from the NCBI RefSeq non-redundant proteins collection", "refseq_ref": "(refseq_ref) proteins from bacteria, Archaea from the NCBI RefSeq representative assemblies + viral proteins from NCBI RefSeq", "progenomes": "(progenomes) proteins in the set of representative genomes from the proGenomes v3 database and viral proteins from NCBI RefSeq", "nr": "(nr) NCBI BLAST non-redundant protein database 'nr', only Archaea, bacteria, and viruses", "nr_euk": "(nr_euk) nr and additionally including fungi and microbial eukaryotes", "fungi": "(fungi) all fungi genomes from NCBI RefSeq (any assembly status)", "viruses": "(viruses) viral genomes from NCBI RefSeq", "plasmids": "(plasmids) plasmid genomes from NCBI RefSeq", "rvdb": "(rvdb) viral proteins from RVDB-prot"} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could you format this more human readable? |
||
| #set $database = str($type.select) | ||
| #set $source_date = str($type.date) | ||
| #if $source_date == "today" | ||
| #set $display_date = "__DOWNLOAD_DATE__" | ||
| #set $value = $database + "_sha256___DATABASE_DIGEST__" | ||
| #else | ||
| #set date = $type.date | ||
| #end if | ||
| #if $type.select == "refseq" | ||
| #set name = "(refseq) bacterial, archaeal and viral genomes in the NCBI RefSeq database with assembly status Complete" | ||
| #elif $type.select == "refseq_nr" | ||
| #set name = "(refseq_nr) proteins from bacteria, Archaea, viruses, fungi and microbial eukaryotes from the NCBI RefSeq non-redundant proteins collection" | ||
| #elif $type.select == "refseq_ref" | ||
| #set name = "(refseq_ref) proteins from bacteria, Archaea from the NCBI RefSeq representative assemblies + viral proteins from NCBI RefSeq" | ||
| #elif $type.select == "progenomes" | ||
| #set name = "(progenomes) proteins in the set of representative genomes from the proGenomes v3 database and viral proteins from NCBI RefSeq" | ||
| #elif $type.select == "nr" | ||
| #set name = "(nr) NCBI BLAST non-redundant protein database 'nr', only Archaea, bacteria, and viruses" | ||
| #elif $type.select == "nr_euk" | ||
| #set name = "(nr_euk) nr and additionally including fungi and microbial eukaryotes" | ||
| #elif $type.select == "fungi" | ||
| #set name = "(fungi) all fungi genomes from NCBI RefSeq (any assembly status)" | ||
| #elif $type.select == "viruses" | ||
| #set name = "(viruses) viral genomes from NCBI RefSeq" | ||
| #elif $type.select == "plasmids" | ||
| #set name = "(plasmids) plasmid genomes from NCBI RefSeq" | ||
| #elif $type.select == "rvdb" | ||
| #set name = "(tvdb) viral proteins from RVDB-prot" | ||
| #set $display_date = $source_date | ||
| #set $value = $source_date + "_" + $database | ||
| #end if | ||
| { | ||
| "data_tables":{ | ||
| "kaiju":[ | ||
| { | ||
| "value": "${date}_${$type.select}", | ||
| "name": "${date} $name", | ||
| "path": "output/", | ||
| "version": "@TOOL_VERSION@" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| #set $entry = {"value": $value, "name": $display_date + " " + $database_names[$database], "path": "output/", "version": "@TOOL_VERSION@"} | ||
| ${json.dumps({"data_tables": {"kaiju": [$entry]}}, sort_keys=True)} | ||
| ]]></configfile> | ||
| </configfiles> | ||
| <inputs> | ||
|
|
@@ -150,14 +139,7 @@ | |
| <param name="select" value="viruses"/> | ||
| <param name="date" value="2024-08-15"/> | ||
| </conditional> | ||
| <output name="out_file"> | ||
| <assert_contents> | ||
| <has_text text="kaiju"/> | ||
| <has_text text="(viruses)"/> | ||
| <has_text text="2024-08-15"/> | ||
| <has_text text="@TOOL_VERSION@"/> | ||
| </assert_contents> | ||
| </output> | ||
| <output name="out_file" file="kaiju-viruses-2024-08-15.json"/> | ||
| </test> | ||
| <test> | ||
| <conditional name="type"> | ||
|
|
@@ -168,6 +150,9 @@ | |
| <assert_contents> | ||
| <has_text text="kaiju"/> | ||
| <has_text text="(viruses)"/> | ||
| <has_text text="viruses_sha256_"/> | ||
| <has_text negate="true" text="__DATABASE_DIGEST__"/> | ||
| <has_text negate="true" text="__DOWNLOAD_DATE__"/> | ||
| <has_text negate="true" text="2024-05-10"/> | ||
| <has_text text="@TOOL_VERSION@"/> | ||
| </assert_contents> | ||
|
|
||
1 change: 1 addition & 0 deletions
1
data_managers/data_manager_kaiju/test-data/kaiju-viruses-2024-08-15.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| {"data_tables": {"kaiju": [{"name": "2024-08-15 (viruses) viral genomes from NCBI RefSeq", "path": "output/", "value": "2024-08-15_viruses", "version": "1.10.1"}]}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| # id: db name + date | ||
| # id: source snapshot + db name, or db name + content digest for current builds | ||
| # name: what is shown to the user in the select | ||
| # path: of the reference data must contain database.fmi, names.dmp and nodes.dmp | ||
| # version: version used for constructing the DB (or just the current version at the time when pre-computed indices were downloaded) | ||
| #id name path version | ||
| #id name path version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,8 @@ | |
| import os | ||
| import shutil | ||
| import tarfile | ||
| from datetime import datetime | ||
| from datetime import date | ||
| from pathlib import Path | ||
|
|
||
| import wget | ||
|
|
||
|
|
@@ -36,6 +37,14 @@ | |
| } | ||
|
|
||
|
|
||
| def source_id(url): | ||
| filename = Path(url).name | ||
| for suffix in (".tar.gz", ".tar.bz2", ".tgz", ".zip"): | ||
| if filename.endswith(suffix): | ||
| return filename.removesuffix(suffix) | ||
| return filename | ||
|
|
||
|
|
||
| def download_untar_store(url, tmp_path, dest_path): | ||
| """ | ||
| Download a tar.gz file containing one folder, | ||
|
|
@@ -104,8 +113,8 @@ def main(): | |
| workdir = params["output_data"][0]["extra_files_path"] | ||
| os.mkdir(workdir) | ||
|
|
||
| time = datetime.utcnow().strftime("%Y-%m-%d") | ||
| db_value = f"{args.db_type}_from_{time}" | ||
| download_date = date.today().isoformat() | ||
| db_value = f"{args.db_type}_{source_id(DB_paths[args.db_type])}" | ||
|
|
||
| # output paths | ||
| db_path = os.path.join(workdir, db_value) | ||
|
|
@@ -126,7 +135,7 @@ def main(): | |
| "data_tables": { | ||
| "mapseq_db": { | ||
| "value": db_value, | ||
| "name": f"{db_name} downloaded at {time}", | ||
| "name": f"{db_name} downloaded at {download_date}", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can drop the |
||
| "version": args.version, | ||
| "path": db_path, | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you mind to add the new reference data from 2026 listed here: https://bioinformatics-centre.github.io/kaiju/downloads.html? But we can also do this separately.