annotate data_manager/bowtie_index_builder.py @ 0:0a0c648498e2 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
author iuc
date Tue, 05 Jan 2016 12:57:11 -0500
parents
children 35c1e3785c90
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
1 #!/usr/bin/env python
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
2
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
3 import sys
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
4 import os
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
5 import tempfile
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
6 import optparse
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
7 import subprocess
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
8
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
9 from galaxy.util.json import from_json_string, to_json_string
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
10
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
11
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
12 CHUNK_SIZE = 2**20
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
13
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
14 DEFAULT_DATA_TABLE_NAME = "bowtie_indexes"
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
15
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
16 def get_id_name( params, dbkey, fasta_description=None):
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
17 #TODO: ensure sequence_id is unique and does not already appear in location file
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
18 sequence_id = params['param_dict']['sequence_id']
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
19 if not sequence_id:
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
20 sequence_id = dbkey
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
21
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
22 sequence_name = params['param_dict']['sequence_name']
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
23 if not sequence_name:
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
24 sequence_name = fasta_description
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
25 if not sequence_name:
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
26 sequence_name = dbkey
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
27 return sequence_id, sequence_name
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
28
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
29
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
30 def build_bowtie_index( data_manager_dict, fasta_filename, params, target_directory, dbkey, sequence_id, sequence_name, data_table_name=DEFAULT_DATA_TABLE_NAME, color_space = False ):
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
31 #TODO: allow multiple FASTA input files
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
32 #tmp_dir = tempfile.mkdtemp( prefix='tmp-data-manager-bowtie-index-builder-' )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
33 fasta_base_name = os.path.split( fasta_filename )[-1]
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
34 sym_linked_fasta_filename = os.path.join( target_directory, fasta_base_name )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
35 os.symlink( fasta_filename, sym_linked_fasta_filename )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
36 args = [ 'bowtie-build' ]
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
37 if color_space:
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
38 args.append( '-c' )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
39 args.append( sym_linked_fasta_filename)
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
40 args.append( fasta_base_name )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
41 args.append( sym_linked_fasta_filename )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
42 tmp_stderr = tempfile.NamedTemporaryFile( prefix = "tmp-data-manager-bowtie-index-builder-stderr" )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
43 proc = subprocess.Popen( args=args, shell=False, cwd=target_directory, stderr=tmp_stderr.fileno() )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
44 return_code = proc.wait()
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
45 if return_code:
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
46 tmp_stderr.flush()
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
47 tmp_stderr.seek(0)
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
48 print >> sys.stderr, "Error building index:"
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
49 while True:
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
50 chunk = tmp_stderr.read( CHUNK_SIZE )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
51 if not chunk:
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
52 break
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
53 sys.stderr.write( chunk )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
54 sys.exit( return_code )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
55 tmp_stderr.close()
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
56 data_table_entry = dict( value=sequence_id, dbkey=dbkey, name=sequence_name, path=fasta_base_name )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
57 _add_data_table_entry( data_manager_dict, data_table_name, data_table_entry )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
58
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
59
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
60 def _add_data_table_entry( data_manager_dict, data_table_name, data_table_entry ):
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
61 data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
62 data_manager_dict['data_tables'][ data_table_name ] = data_manager_dict['data_tables'].get( data_table_name, [] )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
63 data_manager_dict['data_tables'][ data_table_name ].append( data_table_entry )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
64 return data_manager_dict
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
65
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
66
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
67 def main():
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
68 #Parse Command Line
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
69 parser = optparse.OptionParser()
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
70 parser.add_option( '-f', '--fasta_filename', dest='fasta_filename', action='store', type="string", default=None, help='fasta_filename' )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
71 parser.add_option( '-d', '--fasta_dbkey', dest='fasta_dbkey', action='store', type="string", default=None, help='fasta_dbkey' )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
72 parser.add_option( '-t', '--fasta_description', dest='fasta_description', action='store', type="string", default=None, help='fasta_description' )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
73 parser.add_option( '-n', '--data_table_name', dest='data_table_name', action='store', type="string", default=None, help='data_table_name' )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
74 parser.add_option( '-c', '--color_space', dest='color_space', action='store_true', default=False, help='color_space' )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
75 (options, args) = parser.parse_args()
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
76
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
77 filename = args[0]
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
78
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
79 params = from_json_string( open( filename ).read() )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
80 target_directory = params[ 'output_data' ][0]['extra_files_path']
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
81 os.mkdir( target_directory )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
82 data_manager_dict = {}
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
83
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
84 dbkey = options.fasta_dbkey
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
85
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
86 if dbkey in [ None, '', '?' ]:
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
87 raise Exception( '"%s" is not a valid dbkey. You must specify a valid dbkey.' % ( dbkey ) )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
88
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
89 sequence_id, sequence_name = get_id_name( params, dbkey=dbkey, fasta_description=options.fasta_description )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
90
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
91 #build the index
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
92 build_bowtie_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 )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
93
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
94 #save info to json file
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
95 open( filename, 'wb' ).write( to_json_string( data_manager_dict ) )
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
96
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
97 if __name__ == "__main__":
0a0c648498e2 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 418f745190d77983c3fb09badb6298493bccf4e0
iuc
parents:
diff changeset
98 main()