changeset 17:4c9f9d6098eb draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit db9eb9472b9f6caea6a0755697ee8d3a93e85b5b-dirty
author dfornika
date Mon, 06 May 2019 19:42:14 -0400
parents d9f190088154
children f005b6efd096
files data_manager/kraken2_build_custom.py data_manager/kraken2_build_custom.xml data_manager/kraken2_build_database.py data_manager/kraken2_build_database.xml data_manager/kraken2_build_minikraken.py data_manager/kraken2_build_minikraken.xml data_manager/kraken2_build_special.py data_manager/kraken2_build_special.xml data_manager/kraken2_build_standard.py data_manager/kraken2_build_standard.xml data_manager_conf.xml
diffstat 11 files changed, 417 insertions(+), 673 deletions(-) [+]
line wrap: on
line diff
--- a/data_manager/kraken2_build_custom.py	Tue Mar 05 16:45:43 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-#!/usr/bin/env python
-
-from __future__ import print_function
-
-import argparse
-import datetime
-import errno
-import json
-import os
-import string
-import subprocess
-import sys
-
-from pprint import pprint
-
-DATA_TABLE_NAME = "kraken2_databases"
-
-def run(args, cwd):
-    proc = subprocess.Popen(args=args, shell=False, cwd=cwd)
-    return_code = proc.wait()
-    if return_code:
-        print("Error building database.", file=sys.stderr)
-        sys.exit( return_code )
-
-
-def kraken2_build(data_manager_dict, kraken2_args, database_name, params, target_directory, data_table_name=DATA_TABLE_NAME):
-    today = datetime.date.today().isoformat()
-    
-    args = [
-        '--threads', str(kraken2_args["threads"]),
-        '--download-taxonomy',
-        '--db', database_name
-    ]
-    
-    run(['kraken2-build'] + args, target_directory)
-    
-    args = [
-        '--threads', str(kraken2_args["threads"]),
-        '--add-to-library', kraken2_args["fasta"],
-        '--db', database_name
-    ]
-    
-    run(['kraken2-build'] + args, target_directory)
-
-    args = [
-        '--threads', str(kraken2_args["threads"]),
-        '--build',
-        '--kmer-len', str(kraken2_args["kmer_len"]),
-        '--minimizer-len', str(kraken2_args["minimizer_len"]),
-        '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]),
-        '--db', database_name
-    ]
-    
-    run(['kraken2-build'] + args, target_directory)
-    
-    args = [
-        '--threads', str(kraken2_args["threads"]),
-        '--clean',
-        '--db', database_name
-    ]
-
-    run(['kraken2-build'] + args, target_directory)
-    
-    data_table_entry = {
-        "value": database_name,
-        "name": database_name,
-        "path": database_name
-    }
-    
-    _add_data_table_entry(data_manager_dict, data_table_name, data_table_entry)
-
-
-def _add_data_table_entry(data_manager_dict, data_table_name, data_table_entry):
-    data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} )
-    data_manager_dict['data_tables'][ data_table_name ] = data_manager_dict['data_tables'].get( data_table_name, [] )
-    data_manager_dict['data_tables'][ data_table_name ].append( data_table_entry )
-    return data_manager_dict
-
-
-def main():
-    parser = argparse.ArgumentParser()
-    parser.add_argument('params')
-    parser.add_argument( '-d', '--db', dest='database_name', help='database name' )
-    parser.add_argument( '-k', '--kmer-len', dest='kmer_len', type=int, default=35, help='kmer length' )
-    parser.add_argument( '-m', '--minimizer-len', dest='minimizer_len', type=int, default=31, help='minimizer length' )
-    parser.add_argument( '-s', '--minimizer-spaces', dest='minimizer_spaces', default=6, help='minimizer spaces' )
-    parser.add_argument( '-f', '--fasta', dest='fasta', help='fasta' )
-    parser.add_argument( '-t', '--threads', dest='threads', default=1, help='threads' )
-    args = parser.parse_args()
-
-    kraken2_args = {
-        "kmer_len": args.kmer_len,
-        "minimizer_len": args.minimizer_len,
-        "minimizer_spaces": args.minimizer_spaces,
-        "fasta": args.fasta,
-        "threads": args.threads,
-    }
-    
-    params = json.loads(open(args.params).read())
-    pprint(params)
-    target_directory = params['output_data'][0]['extra_files_path']
-
-    try:
-        os.mkdir( target_directory )
-    except OSError as exc:
-        if exc.errno == errno.EEXIST and os.path.isdir( target_directory ):
-            pass
-        else:
-            raise
-
-    data_manager_dict = {}
-
-    # build the index
-    kraken2_build(
-        data_manager_dict,
-        kraken2_args,
-        params,
-        target_directory
-    )
-
-    # save info to json file
-    open(args.params, 'wb').write(json.dumps(data_manager_dict))
-
-
-if __name__ == "__main__":
-    main()
--- a/data_manager/kraken2_build_custom.xml	Tue Mar 05 16:45:43 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-<?xml version="1.0"?>
-<tool id="kraken2_build_custom" name="Kraken2 Custom Database Builder" tool_type="manage_data" version="2.0.7_beta">
-    <description>database builder</description>
-    <requirements>
-        <requirement type="package" version="2.0.7_beta">kraken2</requirement>
-    </requirements>
-    <version_command>kraken2 -version | head -n 1 | awk '{print $NF}'</version_command>
-    <command detect_errors="exit_code">
-    <![CDATA[
-        python '$__tool_directory__/kraken2_build_custom.py'
-          '${out_file}'
-          --threads \${GALAXY_SLOTS:-1}
-          --db ${database_name}
-          --kmer-len ${kmer_len}
-          --minimizer-len ${minimizer_len}
-          --minimizer-spaces ${minimizer_spaces}
-          --fasta ${input_fasta}
-    ]]>
-    </command>
-    <inputs>
-        <param name="input_fasta" type="data" format="fasta" multiple="False" optional="true" label="Select history item" />
-	<param name="database_name" type="text" label="Name for this database" />
-        <param name="kmer_len" type="integer" value="35" label="K-mer length in BP" />
-        <param name="minimizer_len" type="integer" value="31" label="Minimizer length" />
-	<param name="minimizer_spaces" type="integer" value="6" label="Minimizer spaces" />
-    </inputs>
-    <outputs>
-        <data name="out_file" format="data_manager_json" />
-    </outputs>
-    <help>
-    </help>
-    <citations>
-        <citation type="doi">10.1186/gb-2014-15-3-r46</citation>
-    </citations>
-</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager/kraken2_build_database.py	Mon May 06 19:42:14 2019 -0400
@@ -0,0 +1,332 @@
+#!/usr/bin/env python
+
+from __future__ import print_function
+
+import argparse
+import datetime
+import errno
+import json
+import os
+import shutil
+import subprocess
+import sys
+import tarfile
+from enum import Enum
+
+try:
+    # Python3
+    from urllib.request import urlopen
+except ImportError:
+    from urllib2 import urlopen
+
+
+DATA_TABLE_NAME = "kraken2_databases"
+
+
+class KrakenDatabaseTypes(Enum):
+    standard = 'standard'
+    minikraken = 'minikraken'
+    special = 'special'
+    custom = 'custom'
+
+    def __str__(self):
+        return self.value
+
+
+class SpecialDatabaseTypes(Enum):
+    rdp = 'rdp'
+    greengenes = 'greengenes'
+    silva = 'silva'
+
+    def __str__(self):
+        return self.value
+
+
+class Minikraken2Versions(Enum):
+    v1 = 'v1'
+    v2 = 'v2'
+
+    def __str__(self):
+        return self.value
+
+
+def kraken2_build_standard(data_manager_dict, kraken2_args, target_directory, data_table_name=DATA_TABLE_NAME):
+    now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H%M%SZ")
+
+    database_value = "_".join([
+        now,
+        "standard",
+        "kmer-len", str(kraken2_args["kmer_len"]),
+        "minimizer-len", str(kraken2_args["minimizer_len"]),
+        "minimizer-spaces", str(kraken2_args["minimizer_spaces"]),
+    ])
+
+    database_name = " ".join([
+        "Standard",
+        "(Created:",
+        now + ",",
+        "kmer-len=" + str(kraken2_args["kmer_len"]) + ",",
+        "minimizer-len=" + str(kraken2_args["minimizer_len"]) + ",",
+        "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]) + ")",
+    ])
+
+    database_path = database_value
+
+    args = [
+        '--threads', str(kraken2_args["threads"]),
+        '--standard',
+        '--kmer-len', str(kraken2_args["kmer_len"]),
+        '--minimizer-len', str(kraken2_args["minimizer_len"]),
+        '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]),
+        '--db', database_path
+    ]
+
+    subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
+
+    args = [
+        '--threads', str(kraken2_args["threads"]),
+        '--clean',
+        '--db', database_path
+    ]
+
+    subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
+
+    data_table_entry = {
+        "value": database_value,
+        "name": database_name,
+        "path": database_path,
+    }
+
+    _add_data_table_entry(data_manager_dict, data_table_entry)
+
+
+def kraken2_build_minikraken(data_manager_dict, minikraken2_version, target_directory, data_table_name=DATA_TABLE_NAME):
+
+    now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H%M%SZ")
+
+    database_value = "_".join([
+        now,
+        "minikraken2",
+        minikraken2_version,
+        "8GB",
+    ])
+
+    database_name = " ".join([
+        "Minikraken2",
+        minikraken2_version,
+        "(Created:",
+        now + ")"
+    ])
+
+    # download the minikraken2 data
+    src = urlopen(
+        'ftp://ftp.ccb.jhu.edu/pub/data/kraken2_dbs/minikraken2_%s_8GB_201904_UPDATE.tgz'
+        % minikraken2_version
+    )
+    with open('tmp_data.tar.gz', 'wb') as dst:
+        shutil.copyfileobj(src, dst)
+    # unpack the downloaded archive to the target directory
+    with tarfile.open('tmp_data.tar.gz', 'r:gz') as fh:
+        fh.extractall(target_directory)
+
+    data_table_entry = {
+        "value": database_value,
+        "name": database_name,
+        "path": database_value,
+    }
+
+    _add_data_table_entry(data_manager_dict, data_table_entry)
+
+
+def kraken2_build_special(data_manager_dict, kraken2_args, target_directory, data_table_name=DATA_TABLE_NAME):
+
+    now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H%M%SZ")
+
+    special_database_names = {
+        "rdp": "RDP",
+        "greengenes": "Greengenes",
+        "silva": "Silva",
+    }
+
+    database_value = "_".join([
+        now,
+        kraken2_args["special_database_type"],
+        "kmer-len", str(kraken2_args["kmer_len"]),
+        "minimizer-len", str(kraken2_args["minimizer_len"]),
+        "minimizer-spaces", str(kraken2_args["minimizer_spaces"]),
+    ])
+
+    database_name = " ".join([
+        special_database_names[kraken2_args["special_database_type"]],
+        "(Created:",
+        now + ",",
+        "kmer-len=" + str(kraken2_args["kmer_len"]) + ",",
+        "minimizer-len=" + str(kraken2_args["minimizer_len"]) + ",",
+        "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]) + ")",
+    ])
+
+    database_path = database_value
+
+    args = [
+        '--threads', str(kraken2_args["threads"]),
+        '--special', kraken2_args["special_database_type"],
+        '--kmer-len', str(kraken2_args["kmer_len"]),
+        '--minimizer-len', str(kraken2_args["minimizer_len"]),
+        '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]),
+        '--db', database_path
+    ]
+
+    subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
+
+    args = [
+        '--threads', str(kraken2_args["threads"]),
+        '--clean',
+        '--db', database_path
+    ]
+
+    subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
+
+    data_table_entry = {
+        "value": database_value,
+        "name": database_name,
+        "path": database_path,
+    }
+
+    _add_data_table_entry(data_manager_dict, data_table_entry)
+
+
+def kraken2_build_custom(data_manager_dict, kraken2_args, custom_database_name, target_directory, data_table_name=DATA_TABLE_NAME):
+
+    args = [
+        '--threads', str(kraken2_args["threads"]),
+        '--download-taxonomy',
+        '--db', custom_database_name
+    ]
+
+    subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
+
+    args = [
+        '--threads', str(kraken2_args["threads"]),
+        '--add-to-library', kraken2_args["custom_fasta"],
+        '--db', custom_database_name
+    ]
+
+    subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
+
+    args = [
+        '--threads', str(kraken2_args["threads"]),
+        '--build',
+        '--kmer-len', str(kraken2_args["kmer_len"]),
+        '--minimizer-len', str(kraken2_args["minimizer_len"]),
+        '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]),
+        '--db', custom_database_name
+    ]
+
+    subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
+
+    args = [
+        '--threads', str(kraken2_args["threads"]),
+        '--clean',
+        '--db', custom_database_name
+    ]
+
+    subprocess.check_call(['kraken2-build'] + args, target_directory)
+
+    data_table_entry = {
+        "value": custom_database_name,
+        "name": custom_database_name,
+        "path": custom_database_name
+    }
+
+    _add_data_table_entry(data_manager_dict, data_table_name, data_table_entry)
+
+
+def _add_data_table_entry(data_manager_dict, data_table_entry, data_table_name=DATA_TABLE_NAME):
+    data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} )
+    data_manager_dict['data_tables'][data_table_name] = data_manager_dict['data_tables'].get( data_table_name, [] )
+    data_manager_dict['data_tables'][data_table_name].append( data_table_entry )
+    return data_manager_dict
+
+
+def main():
+    parser = argparse.ArgumentParser()
+    parser.add_argument('data_manager_json')
+    parser.add_argument('--kmer-len', dest='kmer_len', type=int, default=35, help='kmer length')
+    parser.add_argument('--minimizer-len', dest='minimizer_len', type=int, default=31, help='minimizer length')
+    parser.add_argument('--minimizer-spaces', dest='minimizer_spaces', default=6, help='minimizer spaces')
+    parser.add_argument('--threads', dest='threads', default=1, help='threads')
+    parser.add_argument('--database-type', dest='database_type', type=KrakenDatabaseTypes, choices=list(KrakenDatabaseTypes), required=True, help='type of kraken database to build')
+    parser.add_argument('--minikraken2-version', dest='minikraken2_version', type=Minikraken2Versions, choices=list(Minikraken2Versions), help='MiniKraken2 version (only applies to --database-type minikraken)')
+    parser.add_argument('--special-database-type', dest='special_database_type', type=SpecialDatabaseTypes, choices=list(SpecialDatabaseTypes), help='type of special database to build (only applies to --database-type special)')
+    parser.add_argument('--custom-fasta', dest='custom_fasta', help='fasta file for custom database (only applies to --database-type custom)')
+    parser.add_argument( '--custom-database-name', dest='custom_database_name', help='Name for custom database (only applies to --database-type custom)' )
+    args = parser.parse_args()
+
+    data_manager_input = json.loads(open(args.data_manager_json).read())
+
+    target_directory = data_manager_input['output_data'][0]['extra_files_path']
+
+    try:
+        os.mkdir( target_directory )
+    except OSError as exc:
+        if exc.errno == errno.EEXIST and os.path.isdir( target_directory ):
+            pass
+        else:
+            raise
+
+    data_manager_output = {}
+
+    print(args.database_type)
+    if str(args.database_type) == 'standard':
+        kraken2_args = {
+            "kmer_len": args.kmer_len,
+            "minimizer_len": args.minimizer_len,
+            "minimizer_spaces": args.minimizer_spaces,
+            "threads": args.threads,
+        }
+        kraken2_build_standard(
+            data_manager_output,
+            kraken2_args,
+            target_directory,
+        )
+    elif str(args.database_type) == 'minikraken':
+        kraken2_build_minikraken(
+            data_manager_output,
+            str(args.minikraken2_version),
+            target_directory
+        )
+    elif str(args.database_type) == 'special':
+        kraken2_args = {
+            "special_database_type": str(args.special_database_type),
+            "kmer_len": args.kmer_len,
+            "minimizer_len": args.minimizer_len,
+            "minimizer_spaces": args.minimizer_spaces,
+            "threads": args.threads,
+        }
+        kraken2_build_special(
+            data_manager_output,
+            kraken2_args,
+            target_directory,
+        )
+    elif str(args.database_type) == 'custom':
+        kraken2_args = {
+            "custom_fasta": args.custom_fasta,
+            "kmer_len": args.kmer_len,
+            "minimizer_len": args.minimizer_len,
+            "minimizer_spaces": args.minimizer_spaces,
+            "threads": args.threads,
+        }
+        kraken2_build_custom(
+            data_manager_output,
+            kraken2_args,
+            args.custom_database_name,
+            target_directory,
+        )
+    else:
+        sys.exit("Invalid database type")
+
+    open(args.data_manager_json, 'w').write(json.dumps(data_manager_output))
+
+
+if __name__ == "__main__":
+    main()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data_manager/kraken2_build_database.xml	Mon May 06 19:42:14 2019 -0400
@@ -0,0 +1,84 @@
+<?xml version="1.0"?>
+<tool id="kraken2_build_database" name="Kraken2 Database Builder" tool_type="manage_data" version="2.0.8_beta">
+    <macros>
+        <xml name="common_params">
+            <param name="kmer_len" type="integer" value="35" label="K-mer length in BP" />
+            <param name="minimizer_len" type="integer" value="31" label="Minimizer length" />
+            <param name="minimizer_spaces" type="integer" value="6" label="Minimizer spaces" />
+        </xml>
+    </macros>
+    <description>database builder</description>
+    <requirements>
+        <requirement type="package" version="2.0.8_beta">kraken2</requirement>
+    </requirements>
+    <version_command>kraken2 -version | head -n 1 | awk '{print $NF}'</version_command>
+    <command detect_errors="exit_code">
+    <![CDATA[
+        python '$__tool_directory__/kraken2_build_database.py'
+          '${out_file}'
+          --database-type ${database_type.database_type}
+          #if $database_type.database_type == "minikraken"
+            --minikraken2-version ${database_type.minikraken2_version}
+          #else if $database_type.database_type == "standard"
+            --threads \${GALAXY_SLOTS:-1}
+            --kmer-len ${database_type.kmer_len}
+            --minimizer-len ${database_type.minimizer_len}
+            --minimizer-spaces ${database_type.minimizer_spaces}
+          #else if $database_type.database_type == "special"
+            --threads \${GALAXY_SLOTS:-1}
+            --special-database-type ${database_type.special_database_type}
+            --kmer-len ${database_type.kmer_len}
+            --minimizer-len ${database_type.minimizer_len}
+            --minimizer-spaces ${database_type.minimizer_spaces}
+          #else if $database_type.database_type == "custom"
+            --threads \${GALAXY_SLOTS:-1}
+            --custom-fasta ${database_type.custom_fasta}
+            --custom-database-name ${database_type.custom_database_name}
+            --kmer-len ${database_type.kmer_len}
+            --minimizer-len ${database_type.minimizer_len}
+            --minimizer-spaces ${database_type.minimizer_spaces}
+          #end if
+    ]]>
+    </command>
+    <inputs>
+        <conditional name="database_type">
+            <param name="database_type" type="select" multiple="false" label="Database Type">
+                <option value="standard">Standard</option>
+                <option value="minikraken">MiniKraken</option>
+                <option value="special">Special</option>
+                <option value="custom">Custom</option>
+            </param>
+            <when value="standard">
+                <expand macro="common_params" />
+            </when>
+            <when value="minikraken">
+                <param name="minikraken2_version" type="select" multiple="false" label="Select MiniKraken2 database version to download">
+	                <option value="v2">Version 2</option>
+                    <option value="v1">Version 1</option>
+                </param>
+            </when>
+            <when value="special">
+                <param name="special_database_type" type="select" multiple="false" label="Select database to build">
+                    <option value="greengenes">Greengenes</option>
+                    <option value="silva">Silva</option>
+                    <option value="rdp">RDP</option>
+                </param>
+                <expand macro="common_params" />
+            </when>
+            <when value="custom">
+                <param name="custom_fasta" type="data" format="fasta" multiple="False" optional="true" label="Select history item" />
+                <param name="custom_database_name" type="text" label="Name for this database" />
+                <expand macro="common_params" />
+            </when>
+            
+        </conditional>
+    </inputs>
+    <outputs>
+        <data name="out_file" format="data_manager_json" />
+    </outputs>
+    <help>
+    </help>
+    <citations>
+        <citation type="doi">10.1186/gb-2014-15-3-r46</citation>
+    </citations>
+</tool>
--- a/data_manager/kraken2_build_minikraken.py	Tue Mar 05 16:45:43 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,114 +0,0 @@
-#!/usr/bin/env python
-
-from __future__ import print_function
-
-import argparse
-import datetime
-import errno
-import json
-import os
-import string
-import subprocess
-import sys
-
-
-DATA_TABLE_NAME = "kraken2_databases"
-
-def run(args, cwd):
-    proc = subprocess.Popen(args=args, shell=False, cwd=cwd)
-    return_code = proc.wait()
-    if return_code:
-        print("Error building database.", file=sys.stderr)
-        sys.exit( return_code )
-
-def kraken2_build_minikraken(data_manager_dict, minikraken2_version, target_directory, data_table_name=DATA_TABLE_NAME):
-    
-    now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H%M%SZ")
-    
-    database_value = "_".join([
-        now,
-        "minikraken2",
-        minikraken2_version,
-        "8GB",
-    ])
-
-    database_name = " ".join([
-        "Minikraken2",
-        minikraken2_version,
-        "(Created:",
-        now + ")"
-    ])
-
-    database_path = database_value
-    
-    args = [
-        'https://ccb.jhu.edu/software/kraken2/dl/minikraken2_' + minikraken2_version + '_8GB.tgz'
-    ]
-
-    run(['wget'] + args, target_directory)
-
-    args = [
-        '-p',
-        database_path,
-    ]
-
-    run(['mkdir'] + args, target_directory)
-    
-    args = [
-        '-xvzf',
-        'minikraken2_' + minikraken2_version + '_8GB.tgz',
-        '-C',
-        database_path,
-    ]
-
-    run(['tar'] + args, target_directory)
-
-    data_table_entry = {
-        "value": database_value,
-        "name": database_name,
-        "path": database_path,
-    }
-    
-    _add_data_table_entry(data_manager_dict, data_table_entry)
-
-
-def _add_data_table_entry(data_manager_dict, data_table_entry, data_table_name=DATA_TABLE_NAME):
-    data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} )
-    data_manager_dict['data_tables'][data_table_name] = data_manager_dict['data_tables'].get( data_table_name, [] )
-    data_manager_dict['data_tables'][data_table_name].append( data_table_entry )
-    return data_manager_dict
-
-
-def main():
-    parser = argparse.ArgumentParser()
-    parser.add_argument('data_manager_json')
-    parser.add_argument( '-v', '--minikraken2-version', dest='minikraken2_version', default="v2", help='MiniKraken2 version (v1 or v2)' )
-    parser.add_argument( '-t', '--threads', dest='threads', default=1, help='threads' )
-
-    args = parser.parse_args()
-    
-    data_manager_input = json.loads(open(args.data_manager_json).read())
-
-    target_directory = data_manager_input['output_data'][0]['extra_files_path']
-
-    try:
-        os.mkdir( target_directory )
-    except OSError as exc:
-        if exc.errno == errno.EEXIST and os.path.isdir( target_directory ):
-            pass
-        else:
-            raise
-
-    data_manager_output = {}
-    
-    kraken2_build_minikraken(
-        data_manager_output,
-        args.minikraken2_version,
-        target_directory,
-    )
-
-    open(args.data_manager_json, 'wb').write(json.dumps(data_manager_output))
-
-
-if __name__ == "__main__":
-    main()
--- a/data_manager/kraken2_build_minikraken.xml	Tue Mar 05 16:45:43 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<tool id="kraken2_build_minikraken" name="Kraken2 MiniKraken2 Database Builder" tool_type="manage_data" version="2.0.7_beta">
-    <description>database builder</description>
-    <requirements>
-        <requirement type="package" version="2.0.7_beta">kraken2</requirement>
-    </requirements>
-    <version_command>kraken2 -version | head -n 1 | awk '{print $NF}'</version_command>
-    <command detect_errors="exit_code">
-    <![CDATA[
-        python '$__tool_directory__/kraken2_build_minikraken.py'
-          '${out_file}'
-          --threads \${GALAXY_SLOTS:-1}
-	  --minikraken2-version ${minikraken2_version}
-    ]]>
-    </command>
-    <inputs>
-      <param name="minikraken2_version" type="select" multiple="false" label="Select MiniKraken2 database version to download">
-	    <option value="v2">Version 2</option>
-            <option value="v1">Version 1</option>
-        </param>
-    </inputs>
-    <outputs>
-        <data name="out_file" format="data_manager_json" />
-    </outputs>
-    <help>
-    </help>
-    <citations>
-        <citation type="doi">10.1186/gb-2014-15-3-r46</citation>
-    </citations>
-</tool>
--- a/data_manager/kraken2_build_special.py	Tue Mar 05 16:45:43 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-#!/usr/bin/env python
-
-from __future__ import print_function
-
-import argparse
-import datetime
-import errno
-import json
-import os
-import string
-import subprocess
-import sys
-
-
-DATA_TABLE_NAME = "kraken2_databases"
-
-def run(args, cwd):
-    proc = subprocess.Popen(args=args, shell=False, cwd=cwd)
-    return_code = proc.wait()
-    if return_code:
-        print("Error building database.", file=sys.stderr)
-        sys.exit( return_code )
-
-def kraken2_build_standard(data_manager_dict, kraken2_args, target_directory, data_table_name=DATA_TABLE_NAME):
-    
-    now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H%M%SZ")
-
-    special_database_names = {
-        "rdp": "RDP",
-        "greengenes": "Greengenes",
-        "silva": "Silva",
-    }
-    
-    database_value = "_".join([
-        now,
-        kraken2_args["special"],
-        "kmer-len", str(kraken2_args["kmer_len"]),
-        "minimizer-len", str(kraken2_args["minimizer_len"]),
-        "minimizer-spaces", str(kraken2_args["minimizer_spaces"]),
-    ])
-
-    database_name = " ".join([
-        special_database_names[kraken2_args["special"]],
-        "(Created:",
-        now + ",",
-        "kmer-len=" + str(kraken2_args["kmer_len"]) + ",",
-        "minimizer-len=" + str(kraken2_args["minimizer_len"]) + ",",
-        "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]) + ")",
-    ])
-
-    database_path = database_value
-    
-    args = [
-        '--threads', str(kraken2_args["threads"]),
-        '--special', kraken2_args["special"],
-        '--kmer-len', str(kraken2_args["kmer_len"]),
-        '--minimizer-len', str(kraken2_args["minimizer_len"]),
-        '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]),
-        '--db', database_path
-    ]
-
-    run(['kraken2-build'] + args, target_directory)
-
-    args = [
-        '--threads', str(kraken2_args["threads"]),
-        '--clean',
-        '--db', database_path
-    ]
-
-    run(['kraken2-build'] + args, target_directory)
-
-    data_table_entry = {
-        "value": database_value,
-        "name": database_name,
-        "path": database_path,
-    }
-    
-    _add_data_table_entry(data_manager_dict, data_table_entry)
-
-
-def _add_data_table_entry(data_manager_dict, data_table_entry, data_table_name=DATA_TABLE_NAME):
-    data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} )
-    data_manager_dict['data_tables'][data_table_name] = data_manager_dict['data_tables'].get( data_table_name, [] )
-    data_manager_dict['data_tables'][data_table_name].append( data_table_entry )
-    return data_manager_dict
-
-
-def main():
-    parser = argparse.ArgumentParser()
-    parser.add_argument('data_manager_json')
-    parser.add_argument( '-b', '--db-type', dest='db_type', help='database type (one of: silva, rdp, greengenes)' )
-    parser.add_argument( '-k', '--kmer-len', dest='kmer_len', type=int, default=35, help='kmer length' )
-    parser.add_argument( '-m', '--minimizer-len', dest='minimizer_len', type=int, default=31, help='minimizer length' )
-    parser.add_argument( '-s', '--minimizer-spaces', dest='minimizer_spaces', default=6, help='minimizer spaces' )
-    parser.add_argument( '-t', '--threads', dest='threads', default=1, help='threads' )
-    args = parser.parse_args()
-
-    kraken2_args = {
-        "special": args.db_type,
-        "kmer_len": args.kmer_len,
-        "minimizer_len": args.minimizer_len,
-        "minimizer_spaces": args.minimizer_spaces,
-        "threads": args.threads,
-    }
-    
-    data_manager_input = json.loads(open(args.data_manager_json).read())
-
-    target_directory = data_manager_input['output_data'][0]['extra_files_path']
-
-    try:
-        os.mkdir( target_directory )
-    except OSError as exc:
-        if exc.errno == errno.EEXIST and os.path.isdir( target_directory ):
-            pass
-        else:
-            raise
-
-    data_manager_output = {}
-    
-    kraken2_build_standard(
-        data_manager_output,
-        kraken2_args,
-        target_directory,
-    )
-
-    open(args.data_manager_json, 'wb').write(json.dumps(data_manager_output))
-
-
-if __name__ == "__main__":
-    main()
--- a/data_manager/kraken2_build_special.xml	Tue Mar 05 16:45:43 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-<?xml version="1.0"?>
-<tool id="kraken2_build_special" name="Kraken2 Special Database Builder" tool_type="manage_data" version="2.0.7_beta">
-    <description>database builder</description>
-    <requirements>
-        <requirement type="package" version="2.0.7_beta">kraken2</requirement>
-    </requirements>
-    <version_command>kraken2 -version | head -n 1 | awk '{print $NF}'</version_command>
-    <command detect_errors="exit_code">
-    <![CDATA[
-        python '$__tool_directory__/kraken2_build_special.py'
-          '${out_file}'
-	  --db-type ${db_type}
-          --threads \${GALAXY_SLOTS:-1}
-          --kmer-len ${kmer_len}
-          --minimizer-len ${minimizer_len}
-          --minimizer-spaces ${minimizer_spaces}
-    ]]>
-    </command>
-    <inputs>
-        <param name="db_type" type="select" multiple="false" label="Select database to build">
-            <option value="greengenes">Greengenes</option>
-	    <option value="silva">Silva</option>
-	    <option value="rdp">RDP</option>
-        </param>
-        <param name="kmer_len" type="integer" value="35" label="K-mer length in BP" />
-        <param name="minimizer_len" type="integer" value="31" label="Minimizer length" />
-	<param name="minimizer_spaces" type="integer" value="6" label="Minimizer spaces" />
-    </inputs>
-    <outputs>
-        <data name="out_file" format="data_manager_json" />
-    </outputs>
-    <help>
-    </help>
-    <citations>
-        <citation type="doi">10.1186/gb-2014-15-3-r46</citation>
-    </citations>
-</tool>
--- a/data_manager/kraken2_build_standard.py	Tue Mar 05 16:45:43 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-#!/usr/bin/env python
-
-from __future__ import print_function
-
-import argparse
-import datetime
-import errno
-import json
-import os
-import string
-import subprocess
-import sys
-
-
-DATA_TABLE_NAME = "kraken2_databases"
-
-def run(args, cwd):
-    proc = subprocess.Popen(args=args, shell=False, cwd=cwd)
-    return_code = proc.wait()
-    if return_code:
-        print("Error building database.", file=sys.stderr)
-        sys.exit( return_code )
-
-def kraken2_build_standard(data_manager_dict, kraken2_args, target_directory, data_table_name=DATA_TABLE_NAME):
-    now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H%M%SZ")
-    
-    database_value = "_".join([
-        now,
-        "standard",
-        "kmer-len" + str(kraken2_args["kmer_len"]),
-        "minimizer-len" + str(kraken2_args["minimizer_len"]),
-        "minimizer-spaces" + str(kraken2_args["minimizer_spaces"]),
-    ])
-
-    database_name = " ".join([
-        "Standard",
-        "(Created:",
-        now + ",",
-        "kmer-len=" + str(kraken2_args["kmer_len"]) + ",",
-        "minimizer-len=" + str(kraken2_args["minimizer_len"]) + ",",
-        "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]) + ")",
-    ])
-
-    database_path = database_value
-    
-    args = [
-        '--threads', str(kraken2_args["threads"]),
-        '--standard',
-        '--kmer-len', str(kraken2_args["kmer_len"]),
-        '--minimizer-len', str(kraken2_args["minimizer_len"]),
-        '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]),
-        '--db', database_path
-    ]
-
-    run(['kraken2-build'] + args, target_directory)
-
-    args = [
-        '--threads', str(kraken2_args["threads"]),
-        '--clean',
-        '--db', database_path
-    ]
-
-    run(['kraken2-build'] + args, target_directory)
-
-    data_table_entry = {
-        "value": database_value,
-        "name": database_name,
-        "path": database_path,
-    }
-    
-    _add_data_table_entry(data_manager_dict, data_table_entry)
-
-
-def _add_data_table_entry(data_manager_dict, data_table_entry, data_table_name=DATA_TABLE_NAME):
-    data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} )
-    data_manager_dict['data_tables'][data_table_name] = data_manager_dict['data_tables'].get( data_table_name, [] )
-    data_manager_dict['data_tables'][data_table_name].append( data_table_entry )
-    return data_manager_dict
-
-
-def main():
-    parser = argparse.ArgumentParser()
-    parser.add_argument('data_manager_json')
-    parser.add_argument( '-k', '--kmer-len', dest='kmer_len', type=int, default=35, help='kmer length' )
-    parser.add_argument( '-m', '--minimizer-len', dest='minimizer_len', type=int, default=31, help='minimizer length' )
-    parser.add_argument( '-s', '--minimizer-spaces', dest='minimizer_spaces', default=6, help='minimizer spaces' )
-    parser.add_argument( '-t', '--threads', dest='threads', default=1, help='threads' )
-    args = parser.parse_args()
-
-    kraken2_args = {
-        "kmer_len": args.kmer_len,
-        "minimizer_len": args.minimizer_len,
-        "minimizer_spaces": args.minimizer_spaces,
-        "threads": args.threads,
-    }
-    
-    data_manager_input = json.loads(open(args.data_manager_json).read())
-
-    target_directory = data_manager_input['output_data'][0]['extra_files_path']
-
-    try:
-        os.mkdir( target_directory )
-    except OSError as exc:
-        if exc.errno == errno.EEXIST and os.path.isdir( target_directory ):
-            pass
-        else:
-            raise
-
-    data_manager_output = {}
-    
-    kraken2_build_standard(
-        data_manager_output,
-        kraken2_args,
-        target_directory,
-    )
-
-    open(args.data_manager_json, 'wb').write(json.dumps(data_manager_output))
-
-
-if __name__ == "__main__":
-    main()
--- a/data_manager/kraken2_build_standard.xml	Tue Mar 05 16:45:43 2019 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<tool id="kraken2_build_standard" name="Kraken2 Standard Database Builder" tool_type="manage_data" version="2.0.7_beta">
-    <description>database builder</description>
-    <requirements>
-        <requirement type="package" version="2.0.7_beta">kraken2</requirement>
-    </requirements>
-    <version_command>kraken2 -version | head -n 1 | awk '{print $NF}'</version_command>
-    <command detect_errors="exit_code">
-    <![CDATA[
-        python '$__tool_directory__/kraken2_build_standard.py'
-          '${out_file}'
-          --threads \${GALAXY_SLOTS:-1}
-          --kmer-len ${kmer_len}
-          --minimizer-len ${minimizer_len}
-          --minimizer-spaces ${minimizer_spaces}
-    ]]>
-    </command>
-    <inputs>
-        <param name="kmer_len" type="integer" value="35" label="K-mer length in BP" />
-        <param name="minimizer_len" type="integer" value="31" label="Minimizer length" />
-	<param name="minimizer_spaces" type="integer" value="6" label="Minimizer spaces" />
-    </inputs>
-    <outputs>
-        <data name="out_file" format="data_manager_json" />
-    </outputs>
-    <help>
-    </help>
-    <citations>
-        <citation type="doi">10.1186/gb-2014-15-3-r46</citation>
-    </citations>
-</tool>
--- a/data_manager_conf.xml	Tue Mar 05 16:45:43 2019 -0500
+++ b/data_manager_conf.xml	Mon May 06 19:42:14 2019 -0400
@@ -1,5 +1,5 @@
 <data_managers>
-    <data_manager tool_file="data_manager/kraken2_build_standard.xml" id="kraken2_build_standard" version="1.0">
+    <data_manager tool_file="data_manager/kraken2_build_database.xml" id="kraken2_build_database" version="1.0">
 	<data_table name="kraken2_databases">
 	    <output>
 		<column name="value"/>
@@ -15,52 +15,4 @@
 	    </output>
 	</data_table>
     </data_manager>
-    <data_manager tool_file="data_manager/kraken2_build_custom.xml" id="kraken2_build_custom" version="1.0">
-	<data_table name="kraken2_databases">
-	    <output>
-		<column name="value"/>
-		<column name="name"/>
-		<column name="path" output_ref="out_file">
-		    <move type="directory">
-		        <source>${path}</source>
-			<target base="${GALAXY_DATA_MANAGER_DATA_PATH}">kraken2_databases/${path}</target>
-		    </move>
-		    <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/kraken2_databases/${path}</value_translation>
-		    <value_translation type="function">abspath</value_translation>
-		</column>
-	    </output>
-	</data_table>
-    </data_manager>
-    <data_manager tool_file="data_manager/kraken2_build_special.xml" id="kraken2_build_special" version="1.0">
-	<data_table name="kraken2_databases">
-	    <output>
-		<column name="value"/>
-		<column name="name"/>
-		<column name="path" output_ref="out_file">
-		    <move type="directory">
-		        <source>${path}</source>
-			<target base="${GALAXY_DATA_MANAGER_DATA_PATH}">kraken2_databases/${path}</target>
-		    </move>
-		    <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/kraken2_databases/${path}</value_translation>
-		    <value_translation type="function">abspath</value_translation>
-		</column>
-	    </output>
-	</data_table>
-    </data_manager>
-    <data_manager tool_file="data_manager/kraken2_build_minikraken.xml" id="kraken2_build_minikraken" version="1.0">
-	<data_table name="kraken2_databases">
-	    <output>
-		<column name="value"/>
-		<column name="name"/>
-		<column name="path" output_ref="out_file">
-		    <move type="directory">
-		        <source>${path}</source>
-			<target base="${GALAXY_DATA_MANAGER_DATA_PATH}">kraken2_databases/${path}</target>
-		    </move>
-		    <value_translation>${GALAXY_DATA_MANAGER_DATA_PATH}/kraken2_databases/${path}</value_translation>
-		    <value_translation type="function">abspath</value_translation>
-		</column>
-	    </output>
-	</data_table>
-    </data_manager>
 </data_managers>