Mercurial > repos > iuc > data_manager_build_kraken2_database
annotate data_manager/kraken2_build_database.py @ 1:6ba1ec5f86fc draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 5f6f447482ad7e127af78204ffd583c51509a0be
author | iuc |
---|---|
date | Sat, 03 Aug 2019 05:31:12 -0400 |
parents | e4cdf82de430 |
children | edacc4bcd3cb |
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 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
19 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
|
20 from urllib2 import urlopen |
e4cdf82de430
planemo 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 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
22 |
e4cdf82de430
planemo 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 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
|
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 |
e4cdf82de430
planemo 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 class KrakenDatabaseTypes(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
|
27 standard = '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
|
28 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
|
29 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
|
30 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
|
31 |
e4cdf82de430
planemo 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 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
|
33 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
|
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 |
e4cdf82de430
planemo 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 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
|
37 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
|
38 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
|
39 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
|
40 |
e4cdf82de430
planemo 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 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
|
42 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
|
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 |
e4cdf82de430
planemo 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 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
|
46 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
|
47 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
|
48 |
e4cdf82de430
planemo 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 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
|
50 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
|
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 |
e4cdf82de430
planemo 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 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
|
54 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
|
55 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
56 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
|
57 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
|
58 "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
|
59 "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
|
60 "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
|
61 "minimizer-spaces", str(kraken2_args["minimizer_spaces"]), |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
62 ]) |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
63 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
64 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
|
65 "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
|
66 "(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
|
67 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
|
68 "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
|
69 "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
|
70 "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]) + ")", |
e4cdf82de430
planemo 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 ]) |
e4cdf82de430
planemo 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 |
e4cdf82de430
planemo 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 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
|
74 |
e4cdf82de430
planemo 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 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
|
76 '--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
|
77 '--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
|
78 '--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
|
79 '--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
|
80 '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]), |
e4cdf82de430
planemo 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 '--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
|
82 ] |
e4cdf82de430
planemo 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 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
84 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
|
85 |
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
|
86 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
|
87 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
|
88 '--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
|
89 '--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
|
90 '--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
|
91 ] |
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
|
92 |
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
|
93 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
|
94 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
95 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
|
96 '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
|
97 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
|
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 "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
|
100 "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
|
101 "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
|
102 } |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
103 ] |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
104 } |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
105 } |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
106 |
e4cdf82de430
planemo 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 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
|
108 |
e4cdf82de430
planemo 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 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
|
111 |
e4cdf82de430
planemo 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 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
|
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 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
|
115 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
|
116 "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
|
117 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
|
118 "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
|
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 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
|
122 "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
|
123 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
|
124 "(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
|
125 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
|
126 ]) |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
127 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
128 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
|
129 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
130 # download the minikraken2 data |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
131 src = urlopen( |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
132 'ftp://ftp.ccb.jhu.edu/pub/data/kraken2_dbs/minikraken2_%s_8GB_201904_UPDATE.tgz' |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
133 % 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
|
134 ) |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
135 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
|
136 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
|
137 # 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
|
138 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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
144 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
|
145 '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
|
146 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
|
147 { |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
148 "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
|
149 "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
|
150 "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
|
151 } |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
152 ] |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
153 } |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
154 } |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
155 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
156 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
|
157 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
158 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
159 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
|
160 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
161 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
|
162 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
163 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
|
164 "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
|
165 "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
|
166 "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
|
167 } |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
168 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
169 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
|
170 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
|
171 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
|
172 "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
|
173 "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
|
174 "minimizer-spaces", str(kraken2_args["minimizer_spaces"]), |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
175 ]) |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
176 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
177 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
|
178 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
|
179 "(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
|
180 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
|
181 "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
|
182 "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
|
183 "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]) + ")", |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
184 ]) |
e4cdf82de430
planemo 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 |
e4cdf82de430
planemo 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 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
|
187 |
e4cdf82de430
planemo 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 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
|
189 '--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
|
190 '--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
|
191 '--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
|
192 '--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
|
193 '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]), |
e4cdf82de430
planemo 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 '--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
|
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 |
e4cdf82de430
planemo 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 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
|
198 |
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
|
199 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
|
200 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
|
201 '--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
|
202 '--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
|
203 '--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
|
204 ] |
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
|
205 |
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
|
206 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
|
207 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
208 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
|
209 '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
|
210 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
|
211 { |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
212 "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
|
213 "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
|
214 "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
|
215 } |
e4cdf82de430
planemo 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 ] |
e4cdf82de430
planemo 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 } |
e4cdf82de430
planemo 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 } |
e4cdf82de430
planemo 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 |
e4cdf82de430
planemo 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 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
|
221 |
e4cdf82de430
planemo 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 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
|
224 |
e4cdf82de430
planemo 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 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
|
226 '--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
|
227 '--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
|
228 '--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
|
229 ] |
e4cdf82de430
planemo 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 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
|
232 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
|
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 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
|
235 |
e4cdf82de430
planemo 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 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
|
237 '--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
|
238 '--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
|
239 '--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
|
240 ] |
e4cdf82de430
planemo 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 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
|
243 |
e4cdf82de430
planemo 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 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
|
245 '--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
|
246 '--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
|
247 '--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
|
248 '--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
|
249 '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]), |
e4cdf82de430
planemo 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 '--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
|
251 ] |
e4cdf82de430
planemo 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 |
e4cdf82de430
planemo 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 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
|
254 |
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
|
255 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
|
256 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
|
257 '--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
|
258 '--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
|
259 '--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
|
260 ] |
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
|
261 |
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
|
262 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
|
263 |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
264 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
|
265 '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
|
266 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
|
267 { |
e4cdf82de430
planemo 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 "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
|
269 "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
|
270 "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
|
271 } |
e4cdf82de430
planemo 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 ] |
e4cdf82de430
planemo 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 } |
e4cdf82de430
planemo 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 } |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
275 |
e4cdf82de430
planemo 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 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
|
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 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
|
280 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
|
281 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
|
282 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
|
283 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
|
284 parser.add_argument('--minimizer-spaces', dest='minimizer_spaces', default=6, help='minimizer spaces') |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
285 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
|
286 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
|
287 parser.add_argument('--minikraken2-version', dest='minikraken2_version', type=Minikraken2Versions, choices=list(Minikraken2Versions), help='MiniKraken2 version (only applies to --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
|
288 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
|
289 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
|
290 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
|
291 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
|
292 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
|
293 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
|
294 |
e4cdf82de430
planemo 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 data_manager_input = json.loads(open(args.data_manager_json).read()) |
e4cdf82de430
planemo 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 |
e4cdf82de430
planemo 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 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
|
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 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
|
300 os.mkdir( 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
|
301 except OSError as exc: |
e4cdf82de430
planemo 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 if exc.errno == errno.EEXIST and os.path.isdir( 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
|
303 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
|
304 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
|
305 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
|
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 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
|
308 |
e4cdf82de430
planemo 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 if str(args.database_type) == '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
|
310 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
|
311 "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
|
312 "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
|
313 "minimizer_spaces": args.minimizer_spaces, |
e4cdf82de430
planemo 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 "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
|
315 "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
|
316 } |
e4cdf82de430
planemo 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 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
|
318 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
|
319 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
|
320 ) |
e4cdf82de430
planemo 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 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
|
322 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
|
323 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
|
324 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 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
|
327 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
|
328 "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
|
329 "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
|
330 "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
|
331 "minimizer_spaces": args.minimizer_spaces, |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
332 "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
|
333 "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
|
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 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
|
336 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
|
337 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
|
338 ) |
e4cdf82de430
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit 30d1a86d5c8a3fa434e24ff915f85f51e514ceb2
iuc
parents:
diff
changeset
|
339 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
|
340 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
|
341 "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
|
342 "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
|
343 "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
|
344 "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
|
345 "minimizer_spaces": args.minimizer_spaces, |
e4cdf82de430
planemo 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 "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
|
347 "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
|
348 } |
e4cdf82de430
planemo 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_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
|
350 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
|
351 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
|
352 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
|
353 ) |
e4cdf82de430
planemo 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 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
|
355 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
|
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 open(args.data_manager_json, 'w').write(json.dumps(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
|
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 |
e4cdf82de430
planemo 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 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
|
361 main() |