# HG changeset patch
# User iuc
# Date 1729271295 0
# Node ID 90b4d4f0a3a4637c4b6da4f2eb7a8e7ae696689e
# Parent 1e34d2e3d285815408eafcf73ba542d8c0501633
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 9835da32741d05d129a1a44835f66e32713770ad
diff -r 1e34d2e3d285 -r 90b4d4f0a3a4 data_manager/kraken2_build_database.py
--- a/data_manager/kraken2_build_database.py Mon Jul 15 09:21:32 2024 +0000
+++ b/data_manager/kraken2_build_database.py Fri Oct 18 17:08:15 2024 +0000
@@ -1,12 +1,11 @@
#!/usr/bin/env python
-from __future__ import print_function
-
import argparse
import datetime
import errno
import json
import os
+import re
import shutil
import subprocess
import sys
@@ -321,12 +320,33 @@
return data_table_entry
-def kraken2_build_custom(kraken2_args, custom_database_name, target_directory, data_table_name=DATA_TABLE_NAME):
+def kraken2_build_custom(kraken2_args, custom_database_name, custom_source_info, target_directory, data_table_name=DATA_TABLE_NAME):
+ now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H%M%SZ")
+
+ database_value = "_".join([
+ now,
+ re.sub(r'[^\w_.-]+', '_', custom_database_name).strip('_'),
+ "kmer-len", str(kraken2_args["kmer_len"]),
+ "minimizer-len", str(kraken2_args["minimizer_len"]),
+ "minimizer-spaces", str(kraken2_args["minimizer_spaces"]),
+ "load-factor", str(kraken2_args["load_factor"]),
+ ])
+
+ database_name = " ".join([
+ custom_database_name,
+ "(" + custom_source_info + ",",
+ "kmer-len=" + str(kraken2_args["kmer_len"]) + ",",
+ "minimizer-len=" + str(kraken2_args["minimizer_len"]) + ",",
+ "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]) + ",",
+ "load-factor=" + str(kraken2_args["load_factor"]) + ")",
+ ])
+
+ database_path = database_value
args = [
'--threads', str(kraken2_args["threads"]),
'--download-taxonomy',
- '--db', custom_database_name,
+ '--db', database_path,
]
if kraken2_args['skip_maps']:
@@ -337,7 +357,7 @@
args = [
'--threads', str(kraken2_args["threads"]),
'--add-to-library', kraken2_args["custom_fasta"],
- '--db', custom_database_name
+ '--db', database_path,
]
subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
@@ -349,7 +369,7 @@
'--minimizer-len', str(kraken2_args["minimizer_len"]),
'--minimizer-spaces', str(kraken2_args["minimizer_spaces"]),
'--load-factor', str(kraken2_args["load_factor"]),
- '--db', custom_database_name
+ '--db', database_path,
]
subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
@@ -358,7 +378,7 @@
args = [
'--threads', str(kraken2_args["threads"]),
'--clean',
- '--db', custom_database_name
+ '--db', database_path,
]
subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
@@ -367,9 +387,9 @@
'data_tables': {
data_table_name: [
{
- "value": custom_database_name,
- "name": custom_database_name,
- "path": custom_database_name
+ "value": database_value,
+ "name": database_name,
+ "path": database_path,
}
]
}
@@ -393,6 +413,7 @@
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)')
+ parser.add_argument('--custom-source-info', dest='custom_source_info', help='Description of how this build has been sourced (only applies to --database-type custom)')
parser.add_argument('--skip-maps', dest='skip_maps', action='store_true', help='')
parser.add_argument('--clean', dest='clean', action='store_true', help='Clean up extra files')
args = parser.parse_args()
@@ -464,6 +485,7 @@
data_manager_output = kraken2_build_custom(
kraken2_args,
args.custom_database_name,
+ args.custom_source_info,
target_directory,
)
else:
diff -r 1e34d2e3d285 -r 90b4d4f0a3a4 data_manager/kraken2_build_database.xml
--- a/data_manager/kraken2_build_database.xml Mon Jul 15 09:21:32 2024 +0000
+++ b/data_manager/kraken2_build_database.xml Fri Oct 18 17:08:15 2024 +0000
@@ -3,12 +3,12 @@
database builder
2.1.3
- 2
+ 3
22.01
-
+
@@ -46,9 +46,12 @@
+
+ kraken2
+
kraken2
- python
+ python
kraken2 -version | head -n 1 | awk '{print $NF}'
+
@@ -250,6 +255,7 @@
+
@@ -260,7 +266,7 @@
-
+
@@ -328,6 +334,6 @@
Build Kraken2 databases or download `prebuilt Kraken2 RefSeq indexes `__
]]>
- 10.1186/gb-2014-15-3-r46
+ 10.1186/s13059-019-1891-0