annotate data_manager/kraken2_build_database.py @ 5:2f27f3b86827 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
author iuc
date Mon, 08 Nov 2021 15:40:34 +0000
parents 0eebe086fd58
children 9002633b4737
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
1 #!/usr/bin/env python
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
2
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
3 from __future__ import print_function
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
4
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
5 import argparse
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
6 import datetime
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
7 import errno
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
8 import json
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
9 import os
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
10 import shutil
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
11 import subprocess
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
12 import sys
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
13 import tarfile
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
14 from enum import Enum
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
15
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
16 try:
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
17 # Python3
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
18 from urllib.request import urlopen
5
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
19 from urllib.error import URLError
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
20 except ImportError:
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
21 from urllib2 import urlopen
5
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
22 from urllib2 import URLError
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
23
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
24
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
25 DATA_TABLE_NAME = "kraken2_databases"
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
26
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
27
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
28 class KrakenDatabaseTypes(Enum):
5
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
29 standard_local_build = 'standard_local_build'
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
30 standard_prebuilt = 'standard_prebuilt'
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
31 minikraken = 'minikraken'
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
32 special = 'special'
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
33 custom = 'custom'
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
34
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
35 def __str__(self):
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
36 return self.value
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
37
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
38
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
39 class SpecialDatabaseTypes(Enum):
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
40 rdp = 'rdp'
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
41 greengenes = 'greengenes'
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
42 silva = 'silva'
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
43
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
44 def __str__(self):
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
45 return self.value
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
46
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
47
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
48 class Minikraken2Versions(Enum):
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
49 v1 = 'v1'
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
50 v2 = 'v2'
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
51
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
52 def __str__(self):
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
53 return self.value
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
54
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
55
5
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
56 class StandardPrebuiltSizes(Enum):
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
57 full = 'full'
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
58 gb_16 = '16'
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
59 gb_8 = '8'
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
60
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
61 def __str__(self):
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
62 return self.value
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
63
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
64
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
65 def kraken2_build_standard(kraken2_args, target_directory, data_table_name=DATA_TABLE_NAME):
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
66 now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H%M%SZ")
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
67
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
68 database_value = "_".join([
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
69 now,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
70 "standard",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
71 "kmer-len", str(kraken2_args["kmer_len"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
72 "minimizer-len", str(kraken2_args["minimizer_len"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
73 "minimizer-spaces", str(kraken2_args["minimizer_spaces"]),
4
0eebe086fd58 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit fed92935f1f0b52173d2fddbdd2bbf44e802b51e"
iuc
parents: 3
diff changeset
74 "load-factor", str(kraken2_args["load_factor"]),
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
75 ])
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
76
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
77 database_name = " ".join([
5
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
78 "Standard (Local Build)",
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
79 "(Created:",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
80 now + ",",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
81 "kmer-len=" + str(kraken2_args["kmer_len"]) + ",",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
82 "minimizer-len=" + str(kraken2_args["minimizer_len"]) + ",",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
83 "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]) + ")",
4
0eebe086fd58 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit fed92935f1f0b52173d2fddbdd2bbf44e802b51e"
iuc
parents: 3
diff changeset
84 "load-factor", str(kraken2_args["load_factor"]),
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
85 ])
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
86
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
87 database_path = database_value
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
88
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
89 args = [
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
90 '--threads', str(kraken2_args["threads"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
91 '--standard',
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
92 '--kmer-len', str(kraken2_args["kmer_len"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
93 '--minimizer-len', str(kraken2_args["minimizer_len"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
94 '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]),
4
0eebe086fd58 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit fed92935f1f0b52173d2fddbdd2bbf44e802b51e"
iuc
parents: 3
diff changeset
95 '--load-factor', str(kraken2_args["load_factor"]),
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
96 '--db', database_path
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
97 ]
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
98
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
99 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
100
1
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
101 if kraken2_args["clean"]:
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
102 args = [
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
103 '--threads', str(kraken2_args["threads"]),
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
104 '--clean',
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
105 '--db', database_path
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
106 ]
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
107
1
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
108 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
109
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
110 data_table_entry = {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
111 'data_tables': {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
112 data_table_name: [
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
113 {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
114 "value": database_value,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
115 "name": database_name,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
116 "path": database_path,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
117 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
118 ]
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
119 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
120 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
121
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
122 return data_table_entry
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
123
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
124
5
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
125 def kraken2_build_standard_prebuilt(standard_prebuilt_size, prebuilt_date, target_directory, data_table_name=DATA_TABLE_NAME):
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
126
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
127 now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H%M%SZ")
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
128
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
129 database_value = "_".join([
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
130 now,
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
131 "standard_prebuilt",
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
132 standard_prebuilt_size
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
133 ])
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
134
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
135 database_name = " ".join([
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
136 "Standard (Prebuilt)",
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
137 standard_prebuilt_size,
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
138 "(Downloaded:",
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
139 now + ")"
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
140 ])
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
141
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
142 database_path = database_value
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
143
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
144 size_to_url_str = {
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
145 'full': '',
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
146 '16': '_16gb',
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
147 '8': '_8gb',
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
148 }
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
149 # we may need to let the user choose the date when new DBs are posted.
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
150 date_url_str = prebuilt_date.replace('-', '')
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
151 standard_prebuilt_size_url = size_to_url_str[standard_prebuilt_size]
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
152 # download the pre-built database
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
153 try:
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
154 download_url = 'https://genome-idx.s3.amazonaws.com/kraken/k2_standard%s_%s.tar.gz' % (standard_prebuilt_size_url, date_url_str)
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
155 src = urlopen(download_url)
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
156 except URLError as e:
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
157 print('url: ' + download_url, file=sys.stderr)
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
158 print(e, file=sys.stderr)
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
159 exit(1)
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
160
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
161 with open('tmp_data.tar.gz', 'wb') as dst:
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
162 shutil.copyfileobj(src, dst)
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
163 # unpack the downloaded archive to the target directory
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
164 with tarfile.open('tmp_data.tar.gz', 'r:gz') as fh:
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
165 for member in fh.getmembers():
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
166 if member.isreg():
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
167 member.name = os.path.basename(member.name)
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
168 fh.extract(member, os.path.join(target_directory, database_path))
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
169
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
170 data_table_entry = {
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
171 'data_tables': {
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
172 data_table_name: [
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
173 {
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
174 "value": database_value,
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
175 "name": database_name,
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
176 "path": database_path,
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
177 }
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
178 ]
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
179 }
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
180 }
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
181
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
182 return data_table_entry
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
183
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
184
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
185 def kraken2_build_minikraken(minikraken2_version, target_directory, data_table_name=DATA_TABLE_NAME):
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
186
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
187 now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H%M%SZ")
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
188
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
189 database_value = "_".join([
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
190 now,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
191 "minikraken2",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
192 minikraken2_version,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
193 "8GB",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
194 ])
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
195
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
196 database_name = " ".join([
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
197 "Minikraken2",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
198 minikraken2_version,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
199 "(Created:",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
200 now + ")"
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
201 ])
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
202
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
203 database_path = database_value
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
204
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
205 # download the minikraken2 data
5
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
206 try:
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
207 download_url = 'https://genome-idx.s3.amazonaws.com/kraken/minikraken2_%s_8GB_201904.tgz' % minikraken2_version
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
208 src = urlopen(download_url)
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
209 except URLError as e:
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
210 print('url: ' + download_url, file=sys.stderr)
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
211 print(e, file=sys.stderr)
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
212 exit(1)
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
213
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
214 with open('tmp_data.tar.gz', 'wb') as dst:
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
215 shutil.copyfileobj(src, dst)
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
216 # unpack the downloaded archive to the target directory
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
217 with tarfile.open('tmp_data.tar.gz', 'r:gz') as fh:
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
218 for member in fh.getmembers():
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
219 if member.isreg():
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
220 member.name = os.path.basename(member.name)
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
221 fh.extract(member, os.path.join(target_directory, database_path))
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
222
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
223 data_table_entry = {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
224 'data_tables': {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
225 data_table_name: [
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
226 {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
227 "value": database_value,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
228 "name": database_name,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
229 "path": database_path,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
230 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
231 ]
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
232 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
233 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
234
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
235 return data_table_entry
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
236
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
237
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
238 def kraken2_build_special(kraken2_args, target_directory, data_table_name=DATA_TABLE_NAME):
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
239
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
240 now = datetime.datetime.utcnow().strftime("%Y-%m-%dT%H%M%SZ")
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
241
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
242 special_database_names = {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
243 "rdp": "RDP",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
244 "greengenes": "Greengenes",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
245 "silva": "Silva",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
246 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
247
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
248 database_value = "_".join([
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
249 now,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
250 kraken2_args["special_database_type"],
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
251 "kmer-len", str(kraken2_args["kmer_len"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
252 "minimizer-len", str(kraken2_args["minimizer_len"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
253 "minimizer-spaces", str(kraken2_args["minimizer_spaces"]),
4
0eebe086fd58 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit fed92935f1f0b52173d2fddbdd2bbf44e802b51e"
iuc
parents: 3
diff changeset
254 "load-factor", str(kraken2_args["load_factor"]),
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
255 ])
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
256
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
257 database_name = " ".join([
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
258 special_database_names[kraken2_args["special_database_type"]],
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
259 "(Created:",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
260 now + ",",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
261 "kmer-len=" + str(kraken2_args["kmer_len"]) + ",",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
262 "minimizer-len=" + str(kraken2_args["minimizer_len"]) + ",",
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
263 "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]) + ")",
4
0eebe086fd58 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit fed92935f1f0b52173d2fddbdd2bbf44e802b51e"
iuc
parents: 3
diff changeset
264 "load-factor=" + str(kraken2_args["load_factor"]) + ")",
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
265 ])
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
266
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
267 database_path = database_value
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
268
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
269 args = [
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
270 '--threads', str(kraken2_args["threads"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
271 '--special', kraken2_args["special_database_type"],
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
272 '--kmer-len', str(kraken2_args["kmer_len"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
273 '--minimizer-len', str(kraken2_args["minimizer_len"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
274 '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]),
4
0eebe086fd58 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit fed92935f1f0b52173d2fddbdd2bbf44e802b51e"
iuc
parents: 3
diff changeset
275 '--load-factor', str(kraken2_args["load_factor"]),
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
276 '--db', database_path
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
277 ]
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
278
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
279 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
280
1
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
281 if kraken2_args["clean"]:
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
282 args = [
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
283 '--threads', str(kraken2_args["threads"]),
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
284 '--clean',
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
285 '--db', database_path
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
286 ]
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
287
1
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
288 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
289
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
290 data_table_entry = {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
291 'data_tables': {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
292 data_table_name: [
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
293 {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
294 "value": database_value,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
295 "name": database_name,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
296 "path": database_path,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
297 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
298 ]
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
299 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
300 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
301
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
302 return data_table_entry
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
303
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
304
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
305 def kraken2_build_custom(kraken2_args, custom_database_name, target_directory, data_table_name=DATA_TABLE_NAME):
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
306
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
307 args = [
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
308 '--threads', str(kraken2_args["threads"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
309 '--download-taxonomy',
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
310 '--db', custom_database_name,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
311 ]
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
312
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
313 if kraken2_args['skip_maps']:
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
314 args.append('--skip-maps')
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
315
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
316 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
317
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
318 args = [
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
319 '--threads', str(kraken2_args["threads"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
320 '--add-to-library', kraken2_args["custom_fasta"],
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
321 '--db', custom_database_name
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
322 ]
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
323
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
324 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
325
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
326 args = [
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
327 '--threads', str(kraken2_args["threads"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
328 '--build',
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
329 '--kmer-len', str(kraken2_args["kmer_len"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
330 '--minimizer-len', str(kraken2_args["minimizer_len"]),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
331 '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]),
4
0eebe086fd58 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit fed92935f1f0b52173d2fddbdd2bbf44e802b51e"
iuc
parents: 3
diff changeset
332 '--load-factor', str(kraken2_args["load_factor"]),
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
333 '--db', custom_database_name
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
334 ]
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
335
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
336 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
337
1
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
338 if kraken2_args["clean"]:
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
339 args = [
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
340 '--threads', str(kraken2_args["threads"]),
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
341 '--clean',
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
342 '--db', custom_database_name
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
343 ]
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
344
1
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
345 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
346
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
347 data_table_entry = {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
348 'data_tables': {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
349 data_table_name: [
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
350 {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
351 "value": custom_database_name,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
352 "name": custom_database_name,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
353 "path": custom_database_name
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
354 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
355 ]
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
356 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
357 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
358
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
359 return data_table_entry
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
360
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
361
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
362 def main():
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
363 parser = argparse.ArgumentParser()
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
364 parser.add_argument('data_manager_json')
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
365 parser.add_argument('--kmer-len', dest='kmer_len', type=int, default=35, help='kmer length')
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
366 parser.add_argument('--minimizer-len', dest='minimizer_len', type=int, default=31, help='minimizer length')
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
367 parser.add_argument('--minimizer-spaces', dest='minimizer_spaces', default=6, help='minimizer spaces')
4
0eebe086fd58 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit fed92935f1f0b52173d2fddbdd2bbf44e802b51e"
iuc
parents: 3
diff changeset
368 parser.add_argument('--load-factor', dest='load_factor', type=float, default=0.7, help='load factor')
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
369 parser.add_argument('--threads', dest='threads', default=1, help='threads')
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
370 parser.add_argument('--database-type', dest='database_type', type=KrakenDatabaseTypes, choices=list(KrakenDatabaseTypes), required=True, help='type of kraken database to build')
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
371 parser.add_argument('--minikraken2-version', dest='minikraken2_version', type=Minikraken2Versions, choices=list(Minikraken2Versions), help='MiniKraken2 version (only applies to --database-type minikraken)')
5
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
372 parser.add_argument('--standard-prebuilt-size', dest='standard_prebuilt_size', type=StandardPrebuiltSizes, choices=list(StandardPrebuiltSizes), help='Size of standard prebuilt database to download (only applies to --database-type standard_prebuilt. Options are: "8", "16", "full".)')
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
373 parser.add_argument('--prebuilt-date', dest='prebuilt_date', help='Database build date (YYYY-MM-DD). Only applies to --database-type standard_prebuilt.')
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
374 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)')
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
375 parser.add_argument('--custom-fasta', dest='custom_fasta', help='fasta file for custom database (only applies to --database-type custom)')
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
376 parser.add_argument('--custom-database-name', dest='custom_database_name', help='Name for custom database (only applies to --database-type custom)')
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
377 parser.add_argument('--skip-maps', dest='skip_maps', action='store_true', help='')
1
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
378 parser.add_argument('--clean', dest='clean', action='store_true', help='Clean up extra files')
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
379 args = parser.parse_args()
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
380
3
19b6a2f0dbe2 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 2
diff changeset
381 with open(args.data_manager_json) as fh:
19b6a2f0dbe2 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 2
diff changeset
382 data_manager_input = json.load(fh)
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
383
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
384 target_directory = data_manager_input['output_data'][0]['extra_files_path']
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
385
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
386 try:
3
19b6a2f0dbe2 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 2
diff changeset
387 os.mkdir(target_directory)
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
388 except OSError as exc:
3
19b6a2f0dbe2 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 2
diff changeset
389 if exc.errno == errno.EEXIST and os.path.isdir(target_directory):
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
390 pass
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
391 else:
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
392 raise
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
393
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
394 data_manager_output = {}
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
395
5
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
396 if str(args.database_type) == 'standard_local_build':
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
397 kraken2_args = {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
398 "kmer_len": args.kmer_len,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
399 "minimizer_len": args.minimizer_len,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
400 "minimizer_spaces": args.minimizer_spaces,
4
0eebe086fd58 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit fed92935f1f0b52173d2fddbdd2bbf44e802b51e"
iuc
parents: 3
diff changeset
401 "load_factor": args.load_factor,
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
402 "threads": args.threads,
1
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
403 "clean": args.clean,
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
404 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
405 data_manager_output = kraken2_build_standard(
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
406 kraken2_args,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
407 target_directory,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
408 )
5
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
409 elif str(args.database_type) == 'standard_prebuilt':
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
410 data_manager_output = kraken2_build_standard_prebuilt(
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
411 str(args.standard_prebuilt_size),
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
412 str(args.prebuilt_date),
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
413 target_directory
2f27f3b86827 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 648fe4911ce49173697f314d70e63e0de95b7e66"
iuc
parents: 4
diff changeset
414 )
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
415 elif str(args.database_type) == 'minikraken':
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
416 data_manager_output = kraken2_build_minikraken(
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
417 str(args.minikraken2_version),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
418 target_directory
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
419 )
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
420 elif str(args.database_type) == 'special':
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
421 kraken2_args = {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
422 "special_database_type": str(args.special_database_type),
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
423 "kmer_len": args.kmer_len,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
424 "minimizer_len": args.minimizer_len,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
425 "minimizer_spaces": args.minimizer_spaces,
4
0eebe086fd58 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit fed92935f1f0b52173d2fddbdd2bbf44e802b51e"
iuc
parents: 3
diff changeset
426 "load_factor": args.load_factor,
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
427 "threads": args.threads,
1
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
428 "clean": args.clean,
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
429 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
430 data_manager_output = kraken2_build_special(
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
431 kraken2_args,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
432 target_directory,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
433 )
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
434 elif str(args.database_type) == 'custom':
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
435 kraken2_args = {
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
436 "custom_fasta": args.custom_fasta,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
437 "skip_maps": args.skip_maps,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
438 "kmer_len": args.kmer_len,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
439 "minimizer_len": args.minimizer_len,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
440 "minimizer_spaces": args.minimizer_spaces,
4
0eebe086fd58 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit fed92935f1f0b52173d2fddbdd2bbf44e802b51e"
iuc
parents: 3
diff changeset
441 "load_factor": args.load_factor,
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
442 "threads": args.threads,
1
6ba1ec5f86fc planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
iuc
parents: 0
diff changeset
443 "clean": args.clean,
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
444 }
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
445 data_manager_output = kraken2_build_custom(
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
446 kraken2_args,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
447 args.custom_database_name,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
448 target_directory,
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
449 )
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
450 else:
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
451 sys.exit("Invalid database type")
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
452
3
19b6a2f0dbe2 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 2
diff changeset
453 with open(args.data_manager_json, 'w') as fh:
19b6a2f0dbe2 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 2
diff changeset
454 json.dump(data_manager_output, fh, sort_keys=True)
0
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
455
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
456
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
457 if __name__ == "__main__":
e4cdf82de430 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff changeset
458 main()