annotate data_manager/bwa_index_builder.py @ 0:ae10d0ddbbb1 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
author devteam
date Fri, 06 Nov 2015 14:15:00 -0500
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
1 #!/usr/bin/env python
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
2 #Dan Blankenberg
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
3
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
4 import sys
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
5 import os
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
6 import tempfile
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
7 import optparse
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
8 import subprocess
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
9
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
10 from json import loads, dumps
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
11
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
12
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
13 CHUNK_SIZE = 2**20
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
14 ONE_GB = 2**30
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
15
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
16 DEFAULT_DATA_TABLE_NAME = "bwa_indexes"
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
17
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
18 def get_id_name( params, dbkey, fasta_description=None):
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
19 #TODO: ensure sequence_id is unique and does not already appear in location file
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
20 sequence_id = params['param_dict']['sequence_id']
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
21 if not sequence_id:
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
22 sequence_id = dbkey
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
23
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
24 sequence_name = params['param_dict']['sequence_name']
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
25 if not sequence_name:
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
26 sequence_name = fasta_description
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
27 if not sequence_name:
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
28 sequence_name = dbkey
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
29 return sequence_id, sequence_name
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
30
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
31 def build_bwa_index( data_manager_dict, fasta_filename, params, target_directory, dbkey, sequence_id, sequence_name, data_table_name=DEFAULT_DATA_TABLE_NAME, color_space = False ):
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
32 #TODO: allow multiple FASTA input files
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
33 #tmp_dir = tempfile.mkdtemp( prefix='tmp-data-manager-bwa-index-builder-' )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
34 fasta_base_name = os.path.split( fasta_filename )[-1]
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
35 sym_linked_fasta_filename = os.path.join( target_directory, fasta_base_name )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
36 os.symlink( fasta_filename, sym_linked_fasta_filename )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
37 if params['param_dict']['index_algorithm'] == 'automatic':
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
38 if os.stat( fasta_filename ).st_size <= ONE_GB: #use 1 GB as cut off for memory vs. max of 2gb database size; this is somewhat arbitrary
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
39 index_algorithm = 'is'
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
40 else:
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
41 index_algorithm = 'bwtsw'
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
42 else:
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
43 index_algorithm = params['param_dict']['index_algorithm']
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
44
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
45 args = [ 'bwa', 'index', '-a', index_algorithm ]
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
46 if color_space:
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
47 args.append( '-c' )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
48 args.append( sym_linked_fasta_filename )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
49 proc = subprocess.Popen( args=args, shell=False, cwd=target_directory )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
50 return_code = proc.wait()
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
51 if return_code:
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
52 print >> sys.stderr, "Error building index."
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
53 sys.exit( return_code )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
54 data_table_entry = dict( value=sequence_id, dbkey=dbkey, name=sequence_name, path=fasta_base_name )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
55 _add_data_table_entry( data_manager_dict, data_table_name, data_table_entry )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
56
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
57 def _add_data_table_entry( data_manager_dict, data_table_name, data_table_entry ):
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
58 data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
59 data_manager_dict['data_tables'][ data_table_name ] = data_manager_dict['data_tables'].get( data_table_name, [] )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
60 data_manager_dict['data_tables'][ data_table_name ].append( data_table_entry )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
61 return data_manager_dict
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
62
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
63 def main():
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
64 #Parse Command Line
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
65 parser = optparse.OptionParser()
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
66 parser.add_option( '-f', '--fasta_filename', dest='fasta_filename', action='store', type="string", default=None, help='fasta_filename' )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
67 parser.add_option( '-d', '--fasta_dbkey', dest='fasta_dbkey', action='store', type="string", default=None, help='fasta_dbkey' )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
68 parser.add_option( '-t', '--fasta_description', dest='fasta_description', action='store', type="string", default=None, help='fasta_description' )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
69 parser.add_option( '-n', '--data_table_name', dest='data_table_name', action='store', type="string", default=None, help='data_table_name' )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
70 parser.add_option( '-c', '--color_space', dest='color_space', action='store_true', default=False, help='color_space' )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
71 (options, args) = parser.parse_args()
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
72
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
73 filename = args[0]
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
74
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
75 params = loads( open( filename ).read() )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
76 target_directory = params[ 'output_data' ][0]['extra_files_path']
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
77 os.mkdir( target_directory )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
78 data_manager_dict = {}
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
79
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
80 dbkey = options.fasta_dbkey
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
81
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
82 if dbkey in [ None, '', '?' ]:
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
83 raise Exception( '"%s" is not a valid dbkey. You must specify a valid dbkey.' % ( dbkey ) )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
84
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
85 sequence_id, sequence_name = get_id_name( params, dbkey=dbkey, fasta_description=options.fasta_description )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
86
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
87 #build the index
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
88 build_bwa_index( data_manager_dict, options.fasta_filename, params, target_directory, dbkey, sequence_id, sequence_name, data_table_name=options.data_table_name or DEFAULT_DATA_TABLE_NAME, color_space=options.color_space )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
89
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
90 #save info to json file
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
91 open( filename, 'wb' ).write( dumps( data_manager_dict ) )
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
92
ae10d0ddbbb1 planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_bwa_index_builder commit 86cf90107482cab1cb47fc0d42d6705f8077daa7
devteam
parents:
diff changeset
93 if __name__ == "__main__": main()