comparison 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
comparison
equal deleted inserted replaced
3:83da94c0e4a6 4:d1d5feb31804
29 # TODO: allow multiple FASTA input files 29 # TODO: allow multiple FASTA input files
30 fasta_base_name = os.path.split( fasta_filename )[-1] 30 fasta_base_name = os.path.split( fasta_filename )[-1]
31 sym_linked_fasta_filename = os.path.join( target_directory, fasta_base_name ) 31 sym_linked_fasta_filename = os.path.join( target_directory, fasta_base_name )
32 os.symlink( fasta_filename, sym_linked_fasta_filename ) 32 os.symlink( fasta_filename, sym_linked_fasta_filename )
33 args = [ 'bowtie2-build', sym_linked_fasta_filename, sequence_id ] 33 args = [ 'bowtie2-build', sym_linked_fasta_filename, sequence_id ]
34 threads = os.environ.get('GALAXY_SLOTS')
35 if threads:
36 args.extend(['--threads', threads])
34 proc = subprocess.Popen( args=args, shell=False, cwd=target_directory ) 37 proc = subprocess.Popen( args=args, shell=False, cwd=target_directory )
35 return_code = proc.wait() 38 return_code = proc.wait()
36 if return_code: 39 if return_code:
37 print("Error building index.", file=sys.stderr) 40 print("Error building index.", file=sys.stderr)
38 sys.exit( return_code ) 41 sys.exit( return_code )
72 75
73 # build the index 76 # build the index
74 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 ) 77 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 )
75 78
76 # save info to json file 79 # save info to json file
77 open( filename, 'wb' ).write( dumps( data_manager_dict ) ) 80 with open(filename, 'w') as json_out:
81 json_out.write( dumps( data_manager_dict, sort_keys=True ) )
78 82
79 83
80 if __name__ == "__main__": 84 if __name__ == "__main__":
81 main() 85 main()