Mercurial > repos > iuc > data_manager_build_kraken2_database
comparison 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 |
comparison
equal
deleted
inserted
replaced
0:e4cdf82de430 | 1:6ba1ec5f86fc |
---|---|
81 '--db', database_path | 81 '--db', database_path |
82 ] | 82 ] |
83 | 83 |
84 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) | 84 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) |
85 | 85 |
86 args = [ | 86 if kraken2_args["clean"]: |
87 '--threads', str(kraken2_args["threads"]), | 87 args = [ |
88 '--clean', | 88 '--threads', str(kraken2_args["threads"]), |
89 '--db', database_path | 89 '--clean', |
90 ] | 90 '--db', database_path |
91 | 91 ] |
92 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) | 92 |
93 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) | |
93 | 94 |
94 data_table_entry = { | 95 data_table_entry = { |
95 'data_tables': { | 96 'data_tables': { |
96 data_table_name: [ | 97 data_table_name: [ |
97 { | 98 { |
193 '--db', database_path | 194 '--db', database_path |
194 ] | 195 ] |
195 | 196 |
196 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) | 197 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) |
197 | 198 |
198 args = [ | 199 if kraken2_args["clean"]: |
199 '--threads', str(kraken2_args["threads"]), | 200 args = [ |
200 '--clean', | 201 '--threads', str(kraken2_args["threads"]), |
201 '--db', database_path | 202 '--clean', |
202 ] | 203 '--db', database_path |
203 | 204 ] |
204 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) | 205 |
206 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) | |
205 | 207 |
206 data_table_entry = { | 208 data_table_entry = { |
207 'data_tables': { | 209 'data_tables': { |
208 data_table_name: [ | 210 data_table_name: [ |
209 { | 211 { |
248 '--db', custom_database_name | 250 '--db', custom_database_name |
249 ] | 251 ] |
250 | 252 |
251 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) | 253 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) |
252 | 254 |
253 args = [ | 255 if kraken2_args["clean"]: |
254 '--threads', str(kraken2_args["threads"]), | 256 args = [ |
255 '--clean', | 257 '--threads', str(kraken2_args["threads"]), |
256 '--db', custom_database_name | 258 '--clean', |
257 ] | 259 '--db', custom_database_name |
258 | 260 ] |
259 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) | 261 |
262 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) | |
260 | 263 |
261 data_table_entry = { | 264 data_table_entry = { |
262 'data_tables': { | 265 'data_tables': { |
263 data_table_name: [ | 266 data_table_name: [ |
264 { | 267 { |
284 parser.add_argument('--minikraken2-version', dest='minikraken2_version', type=Minikraken2Versions, choices=list(Minikraken2Versions), help='MiniKraken2 version (only applies to --database-type minikraken)') | 287 parser.add_argument('--minikraken2-version', dest='minikraken2_version', type=Minikraken2Versions, choices=list(Minikraken2Versions), help='MiniKraken2 version (only applies to --database-type minikraken)') |
285 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)') | 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)') |
286 parser.add_argument('--custom-fasta', dest='custom_fasta', help='fasta file for custom database (only applies to --database-type custom)') | 289 parser.add_argument('--custom-fasta', dest='custom_fasta', help='fasta file for custom database (only applies to --database-type custom)') |
287 parser.add_argument('--custom-database-name', dest='custom_database_name', help='Name for custom database (only applies to --database-type custom)') | 290 parser.add_argument('--custom-database-name', dest='custom_database_name', help='Name for custom database (only applies to --database-type custom)') |
288 parser.add_argument('--skip-maps', dest='skip_maps', action='store_true', help='') | 291 parser.add_argument('--skip-maps', dest='skip_maps', action='store_true', help='') |
292 parser.add_argument('--clean', dest='clean', action='store_true', help='Clean up extra files') | |
289 args = parser.parse_args() | 293 args = parser.parse_args() |
290 | 294 |
291 data_manager_input = json.loads(open(args.data_manager_json).read()) | 295 data_manager_input = json.loads(open(args.data_manager_json).read()) |
292 | 296 |
293 target_directory = data_manager_input['output_data'][0]['extra_files_path'] | 297 target_directory = data_manager_input['output_data'][0]['extra_files_path'] |
306 kraken2_args = { | 310 kraken2_args = { |
307 "kmer_len": args.kmer_len, | 311 "kmer_len": args.kmer_len, |
308 "minimizer_len": args.minimizer_len, | 312 "minimizer_len": args.minimizer_len, |
309 "minimizer_spaces": args.minimizer_spaces, | 313 "minimizer_spaces": args.minimizer_spaces, |
310 "threads": args.threads, | 314 "threads": args.threads, |
315 "clean": args.clean, | |
311 } | 316 } |
312 data_manager_output = kraken2_build_standard( | 317 data_manager_output = kraken2_build_standard( |
313 kraken2_args, | 318 kraken2_args, |
314 target_directory, | 319 target_directory, |
315 ) | 320 ) |
323 "special_database_type": str(args.special_database_type), | 328 "special_database_type": str(args.special_database_type), |
324 "kmer_len": args.kmer_len, | 329 "kmer_len": args.kmer_len, |
325 "minimizer_len": args.minimizer_len, | 330 "minimizer_len": args.minimizer_len, |
326 "minimizer_spaces": args.minimizer_spaces, | 331 "minimizer_spaces": args.minimizer_spaces, |
327 "threads": args.threads, | 332 "threads": args.threads, |
333 "clean": args.clean, | |
328 } | 334 } |
329 data_manager_output = kraken2_build_special( | 335 data_manager_output = kraken2_build_special( |
330 kraken2_args, | 336 kraken2_args, |
331 target_directory, | 337 target_directory, |
332 ) | 338 ) |
336 "skip_maps": args.skip_maps, | 342 "skip_maps": args.skip_maps, |
337 "kmer_len": args.kmer_len, | 343 "kmer_len": args.kmer_len, |
338 "minimizer_len": args.minimizer_len, | 344 "minimizer_len": args.minimizer_len, |
339 "minimizer_spaces": args.minimizer_spaces, | 345 "minimizer_spaces": args.minimizer_spaces, |
340 "threads": args.threads, | 346 "threads": args.threads, |
347 "clean": args.clean, | |
341 } | 348 } |
342 data_manager_output = kraken2_build_custom( | 349 data_manager_output = kraken2_build_custom( |
343 kraken2_args, | 350 kraken2_args, |
344 args.custom_database_name, | 351 args.custom_database_name, |
345 target_directory, | 352 target_directory, |