diff data_manager/bowtie2_index_builder.py @ 4:d1d5feb31804 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie2_index_builder commit 5dd2e762b5b84cec1c8344ecbeaf903e7dcc292e
author iuc
date Thu, 09 May 2019 16:15:47 -0400
parents 83da94c0e4a6
children 1c0f8e9d87c6
line wrap: on
line diff
--- a/data_manager/bowtie2_index_builder.py	Tue Apr 04 18:06:10 2017 -0400
+++ b/data_manager/bowtie2_index_builder.py	Thu May 09 16:15:47 2019 -0400
@@ -31,6 +31,9 @@
     sym_linked_fasta_filename = os.path.join( target_directory, fasta_base_name )
     os.symlink( fasta_filename, sym_linked_fasta_filename )
     args = [ 'bowtie2-build', sym_linked_fasta_filename, sequence_id ]
+    threads = os.environ.get('GALAXY_SLOTS')
+    if threads:
+        args.extend(['--threads', threads])
     proc = subprocess.Popen( args=args, shell=False, cwd=target_directory )
     return_code = proc.wait()
     if return_code:
@@ -74,7 +77,8 @@
     build_bowtie2_index( data_manager_dict, options.fasta_filename, params, target_directory, dbkey, sequence_id, sequence_name, data_table_names=options.data_table_name or DEFAULT_DATA_TABLE_NAMES )
 
     # save info to json file
-    open( filename, 'wb' ).write( dumps( data_manager_dict ) )
+    with open(filename, 'w') as json_out:
+        json_out.write( dumps( data_manager_dict, sort_keys=True ) )
 
 
 if __name__ == "__main__":