comparison data_manager/kraken2_build_database.py @ 4:0eebe086fd58 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_build_kraken2_database/ commit fed92935f1f0b52173d2fddbdd2bbf44e802b51e"
author iuc
date Mon, 23 Nov 2020 20:49:52 +0000
parents 19b6a2f0dbe2
children 2f27f3b86827
comparison
equal deleted inserted replaced
3:19b6a2f0dbe2 4:0eebe086fd58
57 now, 57 now,
58 "standard", 58 "standard",
59 "kmer-len", str(kraken2_args["kmer_len"]), 59 "kmer-len", str(kraken2_args["kmer_len"]),
60 "minimizer-len", str(kraken2_args["minimizer_len"]), 60 "minimizer-len", str(kraken2_args["minimizer_len"]),
61 "minimizer-spaces", str(kraken2_args["minimizer_spaces"]), 61 "minimizer-spaces", str(kraken2_args["minimizer_spaces"]),
62 "load-factor", str(kraken2_args["load_factor"]),
62 ]) 63 ])
63 64
64 database_name = " ".join([ 65 database_name = " ".join([
65 "Standard", 66 "Standard",
66 "(Created:", 67 "(Created:",
67 now + ",", 68 now + ",",
68 "kmer-len=" + str(kraken2_args["kmer_len"]) + ",", 69 "kmer-len=" + str(kraken2_args["kmer_len"]) + ",",
69 "minimizer-len=" + str(kraken2_args["minimizer_len"]) + ",", 70 "minimizer-len=" + str(kraken2_args["minimizer_len"]) + ",",
70 "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]) + ")", 71 "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]) + ")",
72 "load-factor", str(kraken2_args["load_factor"]),
71 ]) 73 ])
72 74
73 database_path = database_value 75 database_path = database_value
74 76
75 args = [ 77 args = [
76 '--threads', str(kraken2_args["threads"]), 78 '--threads', str(kraken2_args["threads"]),
77 '--standard', 79 '--standard',
78 '--kmer-len', str(kraken2_args["kmer_len"]), 80 '--kmer-len', str(kraken2_args["kmer_len"]),
79 '--minimizer-len', str(kraken2_args["minimizer_len"]), 81 '--minimizer-len', str(kraken2_args["minimizer_len"]),
80 '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]), 82 '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]),
83 '--load-factor', str(kraken2_args["load_factor"]),
81 '--db', database_path 84 '--db', database_path
82 ] 85 ]
83 86
84 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) 87 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
85 88
170 now, 173 now,
171 kraken2_args["special_database_type"], 174 kraken2_args["special_database_type"],
172 "kmer-len", str(kraken2_args["kmer_len"]), 175 "kmer-len", str(kraken2_args["kmer_len"]),
173 "minimizer-len", str(kraken2_args["minimizer_len"]), 176 "minimizer-len", str(kraken2_args["minimizer_len"]),
174 "minimizer-spaces", str(kraken2_args["minimizer_spaces"]), 177 "minimizer-spaces", str(kraken2_args["minimizer_spaces"]),
178 "load-factor", str(kraken2_args["load_factor"]),
175 ]) 179 ])
176 180
177 database_name = " ".join([ 181 database_name = " ".join([
178 special_database_names[kraken2_args["special_database_type"]], 182 special_database_names[kraken2_args["special_database_type"]],
179 "(Created:", 183 "(Created:",
180 now + ",", 184 now + ",",
181 "kmer-len=" + str(kraken2_args["kmer_len"]) + ",", 185 "kmer-len=" + str(kraken2_args["kmer_len"]) + ",",
182 "minimizer-len=" + str(kraken2_args["minimizer_len"]) + ",", 186 "minimizer-len=" + str(kraken2_args["minimizer_len"]) + ",",
183 "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]) + ")", 187 "minimizer-spaces=" + str(kraken2_args["minimizer_spaces"]) + ")",
188 "load-factor=" + str(kraken2_args["load_factor"]) + ")",
184 ]) 189 ])
185 190
186 database_path = database_value 191 database_path = database_value
187 192
188 args = [ 193 args = [
189 '--threads', str(kraken2_args["threads"]), 194 '--threads', str(kraken2_args["threads"]),
190 '--special', kraken2_args["special_database_type"], 195 '--special', kraken2_args["special_database_type"],
191 '--kmer-len', str(kraken2_args["kmer_len"]), 196 '--kmer-len', str(kraken2_args["kmer_len"]),
192 '--minimizer-len', str(kraken2_args["minimizer_len"]), 197 '--minimizer-len', str(kraken2_args["minimizer_len"]),
193 '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]), 198 '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]),
199 '--load-factor', str(kraken2_args["load_factor"]),
194 '--db', database_path 200 '--db', database_path
195 ] 201 ]
196 202
197 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) 203 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
198 204
245 '--threads', str(kraken2_args["threads"]), 251 '--threads', str(kraken2_args["threads"]),
246 '--build', 252 '--build',
247 '--kmer-len', str(kraken2_args["kmer_len"]), 253 '--kmer-len', str(kraken2_args["kmer_len"]),
248 '--minimizer-len', str(kraken2_args["minimizer_len"]), 254 '--minimizer-len', str(kraken2_args["minimizer_len"]),
249 '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]), 255 '--minimizer-spaces', str(kraken2_args["minimizer_spaces"]),
256 '--load-factor', str(kraken2_args["load_factor"]),
250 '--db', custom_database_name 257 '--db', custom_database_name
251 ] 258 ]
252 259
253 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory) 260 subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
254 261
280 parser = argparse.ArgumentParser() 287 parser = argparse.ArgumentParser()
281 parser.add_argument('data_manager_json') 288 parser.add_argument('data_manager_json')
282 parser.add_argument('--kmer-len', dest='kmer_len', type=int, default=35, help='kmer length') 289 parser.add_argument('--kmer-len', dest='kmer_len', type=int, default=35, help='kmer length')
283 parser.add_argument('--minimizer-len', dest='minimizer_len', type=int, default=31, help='minimizer length') 290 parser.add_argument('--minimizer-len', dest='minimizer_len', type=int, default=31, help='minimizer length')
284 parser.add_argument('--minimizer-spaces', dest='minimizer_spaces', default=6, help='minimizer spaces') 291 parser.add_argument('--minimizer-spaces', dest='minimizer_spaces', default=6, help='minimizer spaces')
292 parser.add_argument('--load-factor', dest='load_factor', type=float, default=0.7, help='load factor')
285 parser.add_argument('--threads', dest='threads', default=1, help='threads') 293 parser.add_argument('--threads', dest='threads', default=1, help='threads')
286 parser.add_argument('--database-type', dest='database_type', type=KrakenDatabaseTypes, choices=list(KrakenDatabaseTypes), required=True, help='type of kraken database to build') 294 parser.add_argument('--database-type', dest='database_type', type=KrakenDatabaseTypes, choices=list(KrakenDatabaseTypes), required=True, help='type of kraken database to build')
287 parser.add_argument('--minikraken2-version', dest='minikraken2_version', type=Minikraken2Versions, choices=list(Minikraken2Versions), help='MiniKraken2 version (only applies to --database-type minikraken)') 295 parser.add_argument('--minikraken2-version', dest='minikraken2_version', type=Minikraken2Versions, choices=list(Minikraken2Versions), help='MiniKraken2 version (only applies to --database-type minikraken)')
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)') 296 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)')
289 parser.add_argument('--custom-fasta', dest='custom_fasta', help='fasta file for custom database (only applies to --database-type custom)') 297 parser.add_argument('--custom-fasta', dest='custom_fasta', help='fasta file for custom database (only applies to --database-type custom)')
310 if str(args.database_type) == 'standard': 318 if str(args.database_type) == 'standard':
311 kraken2_args = { 319 kraken2_args = {
312 "kmer_len": args.kmer_len, 320 "kmer_len": args.kmer_len,
313 "minimizer_len": args.minimizer_len, 321 "minimizer_len": args.minimizer_len,
314 "minimizer_spaces": args.minimizer_spaces, 322 "minimizer_spaces": args.minimizer_spaces,
323 "load_factor": args.load_factor,
315 "threads": args.threads, 324 "threads": args.threads,
316 "clean": args.clean, 325 "clean": args.clean,
317 } 326 }
318 data_manager_output = kraken2_build_standard( 327 data_manager_output = kraken2_build_standard(
319 kraken2_args, 328 kraken2_args,
328 kraken2_args = { 337 kraken2_args = {
329 "special_database_type": str(args.special_database_type), 338 "special_database_type": str(args.special_database_type),
330 "kmer_len": args.kmer_len, 339 "kmer_len": args.kmer_len,
331 "minimizer_len": args.minimizer_len, 340 "minimizer_len": args.minimizer_len,
332 "minimizer_spaces": args.minimizer_spaces, 341 "minimizer_spaces": args.minimizer_spaces,
342 "load_factor": args.load_factor,
333 "threads": args.threads, 343 "threads": args.threads,
334 "clean": args.clean, 344 "clean": args.clean,
335 } 345 }
336 data_manager_output = kraken2_build_special( 346 data_manager_output = kraken2_build_special(
337 kraken2_args, 347 kraken2_args,
342 "custom_fasta": args.custom_fasta, 352 "custom_fasta": args.custom_fasta,
343 "skip_maps": args.skip_maps, 353 "skip_maps": args.skip_maps,
344 "kmer_len": args.kmer_len, 354 "kmer_len": args.kmer_len,
345 "minimizer_len": args.minimizer_len, 355 "minimizer_len": args.minimizer_len,
346 "minimizer_spaces": args.minimizer_spaces, 356 "minimizer_spaces": args.minimizer_spaces,
357 "load_factor": args.load_factor,
347 "threads": args.threads, 358 "threads": args.threads,
348 "clean": args.clean, 359 "clean": args.clean,
349 } 360 }
350 data_manager_output = kraken2_build_custom( 361 data_manager_output = kraken2_build_custom(
351 kraken2_args, 362 kraken2_args,