Mercurial > repos > iuc > data_manager_build_bracken_database
comparison data_manager/bracken_build_database.xml @ 7:174a754bd3b6 draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/main/data_managers/data_manager_build_bracken_database commit a108f20aebc04574a8bd0a90b955064439a50852
| author | iuc |
|---|---|
| date | Wed, 05 Nov 2025 13:32:09 +0000 |
| parents | 84cc0dc92b0c |
| children |
comparison
equal
deleted
inserted
replaced
| 6:84cc0dc92b0c | 7:174a754bd3b6 |
|---|---|
| 1 <?xml version="1.0"?> | |
| 2 <tool id="bracken_build_database" name="Bracken Database Builder" tool_type="manage_data" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> | 1 <tool id="bracken_build_database" name="Bracken Database Builder" tool_type="manage_data" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="@PROFILE@"> |
| 3 <description>bracken database builder</description> | 2 <description>bracken database builder</description> |
| 4 <macros> | 3 <macros> |
| 5 <token name="@TOOL_VERSION@">2.8</token> | 4 <token name="@TOOL_VERSION@">3.1</token> |
| 6 <token name="@VERSION_SUFFIX@">0</token> | 5 <token name="@VERSION_SUFFIX@">0</token> |
| 7 <token name="@PROFILE@">22.01</token> | 6 <token name="@PROFILE@">24.0</token> |
| 8 </macros> | 7 </macros> |
| 9 <requirements> | 8 <requirements> |
| 10 <requirement type="package" version="@TOOL_VERSION@">bracken</requirement> | 9 <requirement type="package" version="@TOOL_VERSION@">bracken</requirement> |
| 11 </requirements> | 10 </requirements> |
| 12 <command> | 11 <command> |
| 13 <![CDATA[ | 12 <![CDATA[ |
| 14 #import os | 13 #set $db_dir = $out_file.extra_files_path |
| 15 #set db_dir = os.path.basename($kraken_db.fields.path) | 14 mkdir '$db_dir' && |
| 16 | 15 |
| 17 mkdir '$db_dir' && | 16 ## Create symlinks to the contents of the kraken database, since otherwise |
| 18 ln -s '${kraken_db.fields.path}/*' '$db_dir/' && | 17 ## the DM tool (ie bracken-build) would write to the kraken DB folder. |
| 19 python '$__tool_directory__/bracken_build_database.py' | 18 ## |
| 20 '${out_file}' | 19 ## These symlinks will be part of the final db_dir which will be moved |
| 21 | 20 ## to the tool-data (except for some of the pre-exsting *mers.kraken |
| 22 --threads \${GALAXY_SLOTS:-1} | 21 ## and *mers.kmer_distrib which may be deleted -- depending on the |
| 23 #if $check_prebuilt.prebuilt == "no" | 22 ## choice of prebuilt). |
| 24 --kraken-db '$db_dir' | 23 ## Hence the final db_dir will have |
| 25 --kmer-len ${check_prebuilt.kmer_len} | 24 ## - either a created mers.kmer_distrib file or a symlink pointing to the kraken2 db source |
| 26 #end if | 25 ## - either a created mers.kraken file or a symlink pointing to the kraken2 db source |
| 27 #if $check_prebuilt.prebuilt == "yes" | 26 ## - and symlinks to the krakenDB |
| 28 --kraken-db '${kraken_db.fields.path}' | 27 ## Note that in the data table entry only the path to mers.kmer_distrib file is used |
| 29 --prebuilt | 28 ln -s '${kraken_db.fields.path}'/* '$db_dir/' && |
| 30 #end if | 29 |
| 31 --read-len ${check_prebuilt.read_len} | 30 #if $check_prebuilt.prebuilt == "no" |
| 32 --database-name '${database_name}' | 31 ## remove any other pre-existing bracken-build results |
| 32 find '$db_dir' -maxdepth 1 -name "*mers*" -delete && | |
| 33 bracken-build | |
| 34 -t "\${GALAXY_SLOTS:-1}" | |
| 35 -k $check_prebuilt.kmer_len | |
| 36 -l $check_prebuilt.read_len | |
| 37 -d '$db_dir/' | |
| 38 #else | |
| 39 if [ ! -e '$db_dir/database${check_prebuilt.read_len}mers.kmer_distrib' ]; then | |
| 40 >&2 echo "Have you chosen the correct k-mer length? file $db_dir/database${check_prebuilt.read_len}mers.kmer_distrib does not exist."; | |
| 41 exit 1; | |
| 42 fi | |
| 43 ## delete any other (links to) prebuilt bracken databases (except the one of the chosen read_len) | |
| 44 && find '$db_dir' -maxdepth 1 -name "*mers.kraken" -a \! -name "*${check_prebuilt.read_len}mers.kraken" -delete | |
| 45 && find '$db_dir' -maxdepth 1 -name "*mers.kmer_distrib" -a \! -name "*${check_prebuilt.read_len}mers.kmer_distrib" -delete | |
| 46 #end if | |
| 47 && cp '$dmjson' '$out_file' | |
| 33 ]]> | 48 ]]> |
| 34 </command> | 49 </command> |
| 50 <configfiles> | |
| 51 <configfile name="dmjson"><![CDATA[#slurp | |
| 52 #import uuid | |
| 53 #set $database_value = str(uuid.uuid4()) | |
| 54 #set $db_dir = $out_file.extra_files_path | |
| 55 | |
| 56 #if $database_name == "" | |
| 57 #if $check_prebuilt.prebuilt == "no" | |
| 58 #set $database_name = $kraken_db.fields.name + " (k-mer length = " + str($check_prebuilt.kmer_len) +", read length = " + str($check_prebuilt.read_len) + ")" | |
| 59 #else | |
| 60 #set $database_name = $kraken_db.fields.name + " (Prebuilt bracken DB with read length = " + str($check_prebuilt.read_len) + ")" | |
| 61 #end if | |
| 62 #end if | |
| 63 { | |
| 64 "data_tables":{ | |
| 65 "bracken_databases":[ | |
| 66 { | |
| 67 "value": "$database_value", | |
| 68 "name": "$database_name", | |
| 69 "path": "$db_dir/database${check_prebuilt.read_len}mers.kmer_distrib" | |
| 70 } | |
| 71 ] | |
| 72 } | |
| 73 }]]></configfile> | |
| 74 </configfiles> | |
| 35 <inputs> | 75 <inputs> |
| 36 <param name="kraken_db" type="select"> | 76 <param name="kraken_db" type="select"> |
| 37 <options from_data_table="kraken2_databases"> | 77 <options from_data_table="kraken2_databases"> |
| 38 <validator type="no_options" message="No Kraken2 databases are available" /> | 78 <validator type="no_options" message="No Kraken2 databases are available" /> |
| 39 </options> | 79 </options> |
| 56 <option value="200">200</option> | 96 <option value="200">200</option> |
| 57 <option value="250">250</option> | 97 <option value="250">250</option> |
| 58 <option value="300">300</option> | 98 <option value="300">300</option> |
| 59 </param> | 99 </param> |
| 60 </when> | 100 </when> |
| 61 </conditional> | 101 </conditional> |
| 62 <param name="database_name" type="text" label="Database Name" help="Please add a clear reference to the corresponding kraken2 DB the read length to the name." /> | 102 <param name="database_name" type="text" label="Database Name" help="If left empty a name will be constructed from the name of the Kraken2 database suffixed by info on read and k-mer length. Otherwise please add a clear reference to the corresponding kraken2 DB the read length and kmer length to the name." /> |
| 63 </inputs> | 103 </inputs> |
| 64 <outputs> | 104 <outputs> |
| 65 <data name="out_file" format="data_manager_json" /> | 105 <data name="out_file" format="data_manager_json" /> |
| 66 </outputs> | 106 </outputs> |
| 67 <tests> | 107 <tests> |
| 68 <test> | 108 <test> |
| 69 <param name="kraken_db" value="test_entry" /> | 109 <param name="kraken_db" value="test_entry" /> |
| 70 <param name="database_name" value="database" /> | 110 <param name="database_name" value="" /> |
| 111 <conditional name="check_prebuilt"> | |
| 112 <param name="prebuilt" value="yes" /> | |
| 113 <param name="read_len" value="100" /> | |
| 114 </conditional> | |
| 71 <output name="out_file"> | 115 <output name="out_file"> |
| 72 <assert_contents> | 116 <assert_contents> |
| 73 <has_text text="test_db/database100mers.kmer_distrib" /> | 117 <has_text text="Prebuilt bracken DB with read length = 100" /> |
| 118 <has_text text="database100mers.kmer_distrib" /> | |
| 119 </assert_contents> | |
| 120 </output> | |
| 121 </test> | |
| 122 <test> | |
| 123 <param name="kraken_db" value="test_entry" /> | |
| 124 <param name="database_name" value="custom database name" /> | |
| 125 <conditional name="check_prebuilt"> | |
| 126 <param name="prebuilt" value="no" /> | |
| 127 <param name="read_len" value="150" /> | |
| 128 </conditional> | |
| 129 <output name="out_file"> | |
| 130 <assert_contents> | |
| 131 <has_text text="custom database name" /> | |
| 132 <has_text text="database150mers.kmer_distrib" /> | |
| 74 </assert_contents> | 133 </assert_contents> |
| 75 </output> | 134 </output> |
| 76 </test> | 135 </test> |
| 77 </tests> | 136 </tests> |
| 78 <help> | 137 <help> |
| 83 ====================================== | 142 ====================================== |
| 84 Using prebuilt DBs | 143 Using prebuilt DBs |
| 85 ====================================== | 144 ====================================== |
| 86 | 145 |
| 87 The prebuilt option does use existing bracken DBs, that are shipped with kraken2 DBs. This is the case for DBs downloaded from https://benlangmead.github.io/aws-indexes/k2. | 146 The prebuilt option does use existing bracken DBs, that are shipped with kraken2 DBs. This is the case for DBs downloaded from https://benlangmead.github.io/aws-indexes/k2. |
| 88 All prebuilt databases contain a Kraken 2 database along with Bracken databases built for 50, 75, 100, 150, 200, 250 and 300 read lengths (refering to the lenght of the sequenced reads to be analysis using that database (one read in case of paired reads)). | 147 All prebuilt databases contain a Kraken 2 database along with Bracken databases built for 50, 75, 100, 150, 200, 250 and 300 read lengths (referring to the length of the sequenced reads to be analysis using that database (one read in case of paired reads)). |
| 89 In this case the data manager points to the same DB as the kracken2 DB. | 148 In this case the data manager points to the same DB as the kracken2 DB. |
| 149 Note the Kraken 2 / Bracken 16s DBs only contain the Bracken databases built for 100mers, 150mers, and 200mers. | |
| 90 **The prebuilt option must not be used for custom kraken2 DBs ! For this the bracken DB needs to be build.** | 150 **The prebuilt option must not be used for custom kraken2 DBs ! For this the bracken DB needs to be build.** |
| 91 | 151 |
| 92 ====================================== | 152 ====================================== |
| 93 Building new DBs | 153 Building new DBs |
| 94 ====================================== | 154 ====================================== |
| 95 | 155 |
| 96 Use the same K-mer length as the kraken2 DB and choose read lengths that are close to the read length of analysis you want to perform (one read in case of paired reads). | 156 Use the same K-mer length as the kraken2 DB and choose read lengths that are close to the read length of the analysis you want to perform (one read in case of paired reads). |
| 97 </help> | 157 </help> |
| 98 <citations> | 158 <citations> |
| 99 <citation type="doi">10.7717/peerj-cs.104</citation> | 159 <citation type="doi">10.7717/peerj-cs.104</citation> |
| 100 </citations> | 160 </citations> |
| 101 </tool> | 161 </tool> |
