Mercurial > repos > iuc > data_manager_bowtie_index_builder
annotate data_manager/bowtie_index_builder.py @ 3:ea5faedd0795 draft
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 8652f36a3a3838dca989426961561e81432acf4f
author | iuc |
---|---|
date | Tue, 04 Apr 2017 18:06:27 -0400 |
parents | 086edfff112b |
children | 86e9af693a33 |
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 |
1
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
2 import json |
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
3 import optparse |
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
4 import os |
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
5 import subprocess |
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
|
6 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
|
7 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
|
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 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
|
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 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
|
12 |
1
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
13 |
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
|
14 def get_id_name( params, dbkey, fasta_description=None): |
1
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
15 # TODO: ensure sequence_id is unique and does not already appear in location file |
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
|
16 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
|
17 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
|
18 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
|
19 |
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_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
|
21 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
|
22 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
|
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 = 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
|
25 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
|
26 |
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 |
1
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
28 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 ): |
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
29 # TODO: allow multiple FASTA input files |
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
|
30 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
|
31 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
|
32 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
|
33 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
|
34 if color_space: |
2
086edfff112b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 356a04ca3fb988f20fb63ccf053ef9f62a3d002f
iuc
parents:
1
diff
changeset
|
35 args.append( '-C' ) |
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
|
36 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
|
37 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
|
38 args.append( sym_linked_fasta_filename ) |
1
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
39 tmp_stderr = tempfile.NamedTemporaryFile( prefix="tmp-data-manager-bowtie-index-builder-stderr" ) |
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
|
40 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
|
41 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
|
42 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
|
43 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
|
44 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
|
45 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
|
46 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
|
47 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
|
48 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
|
49 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
|
50 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
|
51 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
|
52 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
|
53 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
|
54 _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
|
55 |
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 |
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 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
|
58 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
|
59 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
|
60 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
|
61 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
|
62 |
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 |
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 def main(): |
1
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
65 # Parse Command Line |
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
|
66 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
|
67 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
|
68 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
|
69 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
|
70 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
|
71 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
|
72 (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
|
73 |
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 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
|
75 |
1
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
76 params = json.loads( open( filename ).read() ) |
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
|
77 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
|
78 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
|
79 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
|
80 |
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 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
|
82 |
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 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
|
84 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
|
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 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
|
87 |
1
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
88 # build the index |
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
|
89 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
|
90 |
1
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
91 # save info to json file |
35c1e3785c90
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 596a23abc0c657eff218d16df685b427ae7cdd0a
iuc
parents:
0
diff
changeset
|
92 open( filename, 'wb' ).write( json.dumps( data_manager_dict ) ) |
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
|
93 |
3
ea5faedd0795
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents:
2
diff
changeset
|
94 |
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
|
95 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
|
96 main() |