Repository 'data_manager_build_bracken_database'
hg clone https://toolshed.g2.bx.psu.edu/repos/iuc/data_manager_build_bracken_database

Changeset 3:3c7d2c84cb09 (2021-11-08)
Previous changeset 2:fd5830f88314 (2020-11-22) Next changeset 4:c8136920948b (2023-04-16)
Commit message:
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_bracken_database/ commit 798f4c97da10258a9ab6c16903b169ce69a05523"
modified:
data_manager/bracken_build_database.py
data_manager/bracken_build_database.xml
data_manager_conf.xml
b
diff -r fd5830f88314 -r 3c7d2c84cb09 data_manager/bracken_build_database.py
--- a/data_manager/bracken_build_database.py Sun Nov 22 12:45:23 2020 +0000
+++ b/data_manager/bracken_build_database.py Mon Nov 08 15:51:51 2021 +0000
[
@@ -13,7 +13,7 @@
 DATA_TABLE_NAME = "bracken_databases"
 
 
-def bracken_build_database(target_directory, bracken_build_args, database_name, data_table_name=DATA_TABLE_NAME):
+def bracken_build_database(target_directory, bracken_build_args, database_name, prebuilt=False, data_table_name=DATA_TABLE_NAME):
 
     database_value = str(uuid.uuid4())
 
@@ -21,14 +21,15 @@
 
     database_path = os.path.join(bracken_build_args['kraken_database'], 'database' + str(bracken_build_args['read_len']) + 'mers.kmer_distrib')
 
-    bracken_build_args_list = [
-        '-t', bracken_build_args['threads'],
-        '-k', bracken_build_args['kmer_len'],
-        '-l', bracken_build_args['read_len'],
-        '-d', bracken_build_args['kraken_database'],
-    ]
+    if not prebuilt:
+        bracken_build_args_list = [
+            '-t', bracken_build_args['threads'],
+            '-k', bracken_build_args['kmer_len'],
+            '-l', bracken_build_args['read_len'],
+            '-d', bracken_build_args['kraken_database'],
+        ]
 
-    subprocess.check_call(['bracken-build'] + bracken_build_args_list)
+        subprocess.check_call(['bracken-build'] + bracken_build_args_list)
 
     data_table_entry = {
         "data_tables": {
@@ -53,6 +54,7 @@
     parser.add_argument('--read-len', dest='read_len', help='Read length')
     parser.add_argument('--kraken-db', dest='kraken_database', help='Kraken Database')
     parser.add_argument('--database-name', dest='database_name', help='Database Name')
+    parser.add_argument('--prebuilt', action='store_true', dest='prebuilt', help='Use pre-built DB')
     args = parser.parse_args()
 
     with open(args.data_manager_json) as fh:
@@ -60,12 +62,19 @@
 
     target_directory = data_manager_input['output_data'][0]['extra_files_path']
 
-    bracken_build_args = {
-        'threads': args.threads,
-        'kmer_len': args.kmer_len,
-        'read_len': args.read_len,
-        'kraken_database': args.kraken_database,
-    }
+    if args.prebuilt:
+        bracken_build_args = {
+            'threads': args.threads,
+            'read_len': args.read_len,
+            'kraken_database': args.kraken_database,
+        }
+    else:
+        bracken_build_args = {
+            'threads': args.threads,
+            'kmer_len': args.kmer_len,
+            'read_len': args.read_len,
+            'kraken_database': args.kraken_database,
+        }
 
     try:
         os.mkdir(target_directory)
@@ -81,6 +90,7 @@
         target_directory,
         bracken_build_args,
         args.database_name,
+        args.prebuilt,
     )
 
     with open(args.data_manager_json, 'w') as fh:
b
diff -r fd5830f88314 -r 3c7d2c84cb09 data_manager/bracken_build_database.xml
--- a/data_manager/bracken_build_database.xml Sun Nov 22 12:45:23 2020 +0000
+++ b/data_manager/bracken_build_database.xml Mon Nov 08 15:51:51 2021 +0000
[
@@ -1,9 +1,9 @@
 <?xml version="1.0"?>
-<tool id="bracken_build_database" name="Bracken Database Builder" tool_type="manage_data" version="2.5+galaxy0" profile="19.01">
+<tool id="bracken_build_database" name="Bracken Database Builder" tool_type="manage_data" version="2.5+galaxy1" profile="19.01">
     <description>bracken database builder</description>
     <requirements>
         <requirement type="package" version="2.5">bracken</requirement>
-        <requirement type="package" version="2.0.8_beta">kraken2</requirement>
+        <requirement type="package" version="2.1.1">kraken2</requirement>
     </requirements>
     <command>
     <![CDATA[
@@ -11,13 +11,20 @@
         #set db_dir = os.path.basename($kraken_db.fields.path)
 
         mkdir '$db_dir' &&
-        ln -s '${kraken_db.fields.path}'/* '$db_dir/' &&
+        ln -s '${kraken_db.fields.path}/*' '$db_dir/' &&
         python '$__tool_directory__/bracken_build_database.py'
           '${out_file}'
-          --kraken-db '$db_dir'
+          
           --threads \${GALAXY_SLOTS:-1}
-          --kmer-len ${kmer_len}
-          --read-len ${read_len}
+          #if $check_prebuilt.prebuilt == "no"
+              --kraken-db '$db_dir'
+              --kmer-len ${check_prebuilt.kmer_len}
+          #end if
+          #if $check_prebuilt.prebuilt == "yes"
+              --kraken-db '${kraken_db.fields.path}'
+              --prebuilt
+          #end if
+          --read-len ${check_prebuilt.read_len}
           --database-name '${database_name}'
     ]]>
     </command>
@@ -27,9 +34,28 @@
                 <validator type="no_options" message="No Kraken2 databases are available" />
             </options>
         </param>
-        <param name="kmer_len" type="integer" min="8" max="256" value="35" label="K-mer length" />
-        <param name="read_len" type="integer" min="8" max="1000" value="100" label="Read length" />
-        <param name="database_name" type="text" label="Database Name" />
+        <conditional name="check_prebuilt">
+            <param name="prebuilt" type="select" label="Use Pre-built DB">
+                <option value="no">No</option>
+                <option value="yes">Yes</option>
+            </param>
+            <when value="no">
+                <param name="kmer_len" type="integer" min="8" max="256" value="35" label="K-mer length" />
+                <param name="read_len" type="integer" min="8" max="1000" value="100" label="Read length" />
+            </when>
+            <when value="yes">
+                <param name="read_len" type="select" label="Read length" >
+                    <option value="50">50</option>
+                    <option value="75">75</option>
+                    <option value="100">100</option>
+                    <option value="150">150</option>
+                    <option value="200">200</option>
+                    <option value="250">250</option>
+                    <option value="300">300</option>
+                </param>
+            </when>
+ </conditional>
+ <param name="database_name" type="text" label="Database Name" />
     </inputs>
     <outputs>
         <data name="out_file" format="data_manager_json" />
b
diff -r fd5830f88314 -r 3c7d2c84cb09 data_manager_conf.xml
--- a/data_manager_conf.xml Sun Nov 22 12:45:23 2020 +0000
+++ b/data_manager_conf.xml Mon Nov 08 15:51:51 2021 +0000
b
@@ -1,5 +1,5 @@
 <data_managers>
-    <data_manager tool_file="data_manager/bracken_build_database.xml" id="bracken_build_database" version="2.5+galaxy0">
+    <data_manager tool_file="data_manager/bracken_build_database.xml" id="bracken_build_database" version="2.6+galaxy0">
         <data_table name="bracken_databases">
             <output>
                 <column name="value"/>