diff 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
line wrap: on
line diff
--- a/data_manager/kraken2_build_database.py	Thu May 30 03:03:22 2019 -0400
+++ b/data_manager/kraken2_build_database.py	Sat Aug 03 05:31:12 2019 -0400
@@ -83,13 +83,14 @@
 
     subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
 
-    args = [
-        '--threads', str(kraken2_args["threads"]),
-        '--clean',
-        '--db', database_path
-    ]
+    if kraken2_args["clean"]:
+        args = [
+            '--threads', str(kraken2_args["threads"]),
+            '--clean',
+            '--db', database_path
+        ]
 
-    subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
+        subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
 
     data_table_entry = {
         'data_tables': {
@@ -195,13 +196,14 @@
 
     subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
 
-    args = [
-        '--threads', str(kraken2_args["threads"]),
-        '--clean',
-        '--db', database_path
-    ]
+    if kraken2_args["clean"]:
+        args = [
+            '--threads', str(kraken2_args["threads"]),
+            '--clean',
+            '--db', database_path
+        ]
 
-    subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
+        subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
 
     data_table_entry = {
         'data_tables': {
@@ -250,13 +252,14 @@
 
     subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
 
-    args = [
-        '--threads', str(kraken2_args["threads"]),
-        '--clean',
-        '--db', custom_database_name
-    ]
+    if kraken2_args["clean"]:
+        args = [
+            '--threads', str(kraken2_args["threads"]),
+            '--clean',
+            '--db', custom_database_name
+        ]
 
-    subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
+        subprocess.check_call(['kraken2-build'] + args, cwd=target_directory)
 
     data_table_entry = {
         'data_tables': {
@@ -286,6 +289,7 @@
     parser.add_argument('--custom-fasta', dest='custom_fasta', help='fasta file for custom database (only applies to --database-type custom)')
     parser.add_argument('--custom-database-name', dest='custom_database_name', help='Name for custom database (only applies to --database-type custom)')
     parser.add_argument('--skip-maps', dest='skip_maps', action='store_true', help='')
+    parser.add_argument('--clean', dest='clean', action='store_true', help='Clean up extra files')
     args = parser.parse_args()
 
     data_manager_input = json.loads(open(args.data_manager_json).read())
@@ -308,6 +312,7 @@
             "minimizer_len": args.minimizer_len,
             "minimizer_spaces": args.minimizer_spaces,
             "threads": args.threads,
+            "clean": args.clean,
         }
         data_manager_output = kraken2_build_standard(
             kraken2_args,
@@ -325,6 +330,7 @@
             "minimizer_len": args.minimizer_len,
             "minimizer_spaces": args.minimizer_spaces,
             "threads": args.threads,
+            "clean": args.clean,
         }
         data_manager_output = kraken2_build_special(
             kraken2_args,
@@ -338,6 +344,7 @@
             "minimizer_len": args.minimizer_len,
             "minimizer_spaces": args.minimizer_spaces,
             "threads": args.threads,
+            "clean": args.clean,
         }
         data_manager_output = kraken2_build_custom(
             kraken2_args,