Mercurial > repos > dfornika > data_manager_build_kraken2_database
annotate data_manager/kraken2_build_standard.py @ 7:ae6180bdb1e9 draft
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 70494d589aa1990618ebc7a895e91477d41c3203-dirty
author | dfornika |
---|---|
date | Mon, 04 Mar 2019 19:20:33 -0500 |
parents | 1f6fe9dc5490 |
children | 1601703ae511 |
rev | line source |
---|---|
0
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
1 #!/usr/bin/env python |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
2 |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
3 from __future__ import print_function |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
4 |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
5 import argparse |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
6 import datetime |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
7 import errno |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
8 import json |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
9 import os |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
10 import string |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
11 import subprocess |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
12 import sys |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
13 |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
14 |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
15 DATA_TABLE_NAME = "kraken2_databases" |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
16 |
5
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
17 def run(args, cwd): |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
18 proc = subprocess.Popen(args=args, shell=False, cwd=cwd) |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
19 return_code = proc.wait() |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
20 if return_code: |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
21 print("Error building database.", file=sys.stderr) |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
22 sys.exit( return_code ) |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
23 |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
24 def kraken2_build_standard(data_manager_dict, kraken2_args, target_directory, data_table_name=DATA_TABLE_NAME): |
0
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
25 today = datetime.date.today().isoformat() |
5
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
26 database_name = "_".join([ |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
27 today, |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
28 "standard", |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
29 "kmer-len=" + str(kraken2_args["kmer_len"]), |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
30 "minimizer-len=" + str(kraken2_args["minimizer_len"]), |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
31 "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]), |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
32 ]) |
0
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
33 args = [ |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
34 '--threads', str(kraken2_args["threads"]), |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
35 '--standard', |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
36 '--kmer-len', str(kraken2_args["kmer_len"]), |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
37 '--minimizer-len', str(kraken2_args["minimizer_len"]), |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
38 '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]), |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
39 '--db', database_name |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
40 ] |
5
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
41 |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
42 run(['kraken2-build'] + args, target_directory) |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
43 |
1
32d04371ed19
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit f05f93ee024df8b38efa1c92db9785d52c726f85-dirty
dfornika
parents:
0
diff
changeset
|
44 args = [ |
32d04371ed19
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit f05f93ee024df8b38efa1c92db9785d52c726f85-dirty
dfornika
parents:
0
diff
changeset
|
45 '--threads', str(kraken2_args["threads"]), |
32d04371ed19
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit f05f93ee024df8b38efa1c92db9785d52c726f85-dirty
dfornika
parents:
0
diff
changeset
|
46 '--clean', |
32d04371ed19
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit f05f93ee024df8b38efa1c92db9785d52c726f85-dirty
dfornika
parents:
0
diff
changeset
|
47 '--db', database_name |
32d04371ed19
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit f05f93ee024df8b38efa1c92db9785d52c726f85-dirty
dfornika
parents:
0
diff
changeset
|
48 ] |
5
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
49 |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
50 run(['kraken2-build'] + args, target_directory) |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
51 |
0
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
52 data_table_entry = { |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
53 "value": database_name, |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
54 "name": database_name, |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
55 "path": database_name |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
56 } |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
57 |
5
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
58 _add_data_table_entry(data_manager_dict, data_table_entry) |
0
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
59 |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
60 |
5
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
61 def _add_data_table_entry(data_manager_dict, data_table_entry, data_table_name=DATA_TABLE_NAME): |
0
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
62 data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} ) |
5
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
63 data_manager_dict['data_tables'][data_table_name] = data_manager_dict['data_tables'].get( data_table_name, [] ) |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
64 data_manager_dict['data_tables'][data_table_name].append( data_table_entry ) |
0
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
65 return data_manager_dict |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
66 |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
67 |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
68 def main(): |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
69 parser = argparse.ArgumentParser() |
5
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
70 parser.add_argument('data_manager_json') |
0
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
71 parser.add_argument( '-k', '--kmer-len', dest='kmer_len', type=int, default=35, help='kmer length' ) |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
72 parser.add_argument( '-m', '--minimizer-len', dest='minimizer_len', type=int, default=31, help='minimizer length' ) |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
73 parser.add_argument( '-s', '--minimizer-spaces', dest='minimizer_spaces', default=6, help='minimizer spaces' ) |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
74 parser.add_argument( '-t', '--threads', dest='threads', default=1, help='threads' ) |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
75 args = parser.parse_args() |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
76 |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
77 kraken2_args = { |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
78 "kmer_len": args.kmer_len, |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
79 "minimizer_len": args.minimizer_len, |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
80 "minimizer_spaces": args.minimizer_spaces, |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
81 "threads": args.threads, |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
82 } |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
83 |
5
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
84 data_manager_input = json.loads(open(args.data_manager_json).read()) |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
85 |
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
86 target_directory = data_manager_input['output_data'][0]['extra_files_path'] |
0
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
87 |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
88 try: |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
89 os.mkdir( target_directory ) |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
90 except OSError as exc: |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
91 if exc.errno == errno.EEXIST and os.path.isdir( target_directory ): |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
92 pass |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
93 else: |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
94 raise |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
95 |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
96 kraken2_build_standard( |
5
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
97 data_manager_input, |
0
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
98 kraken2_args, |
5
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
99 target_directory, |
0
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
100 ) |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
101 |
5
1f6fe9dc5490
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit 47bcc8467200adee842a5574b67bc6ef46c0be71-dirty
dfornika
parents:
1
diff
changeset
|
102 open(args.data_manager_json, 'wb').write(json.dumps(data_manager_input)) |
0
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
103 |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
104 |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
105 if __name__ == "__main__": |
7e43f66abe9d
planemo upload for repository https://github.com/dfornika/galaxytools/tree/master/data_managers/data_manager_build_kraken2_database/ commit cc42cd530378bfa3df83b08b6b41aaf2f5072b49-dirty
dfornika
parents:
diff
changeset
|
106 main() |