annotate data_manager/bowtie_index_builder.py @ 7:39a922d01b0d draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit a54e50916ebdb0858b049cdc549a43df801e1a71
author iuc
date Tue, 21 May 2024 07:35:37 +0000
parents 08a3583826fa
children
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
4
86e9af693a33 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 67d76bc24ec6a5eb145f05416dc2098999897bae
iuc
parents: 3
diff changeset
2 from __future__ import print_function
86e9af693a33 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 67d76bc24ec6a5eb145f05416dc2098999897bae
iuc
parents: 3
diff changeset
3
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
4 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
5 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
6 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
7 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
8 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
9 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
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 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
12
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 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
14
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
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
16 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
17 # 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
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
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
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):
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
31 # TODO: allow multiple FASTA input files
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
32 fasta_base_name = os.path.split(fasta_filename)[-1]
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
33 sym_linked_fasta_filename = os.path.join(target_directory, fasta_base_name)
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
34 os.symlink(fasta_filename, sym_linked_fasta_filename)
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
35 args = ['bowtie-build']
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 if color_space:
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
37 args.append('-C')
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
38 args.append(sym_linked_fasta_filename)
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
39 args.append(fasta_base_name)
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
40 args.append(sym_linked_fasta_filename)
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
41 tmp_stderr = tempfile.NamedTemporaryFile(prefix="tmp-data-manager-bowtie-index-builder-stderr")
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
42 proc = subprocess.Popen(args=args, shell=False, cwd=target_directory, stderr=tmp_stderr.fileno())
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
43 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
44 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
45 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
46 tmp_stderr.seek(0)
4
86e9af693a33 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 67d76bc24ec6a5eb145f05416dc2098999897bae
iuc
parents: 3
diff changeset
47 print("Error building index:", file=sys.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
48 while True:
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
49 chunk = tmp_stderr.read(CHUNK_SIZE)
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
50 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
51 break
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
52 sys.stderr.write(chunk)
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
53 sys.exit(return_code)
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
54 tmp_stderr.close()
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
55 data_table_entry = dict(value=sequence_id, dbkey=dbkey, name=sequence_name, path=fasta_base_name)
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
56 _add_data_table_entry(data_manager_dict, data_table_name, data_table_entry)
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
57
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
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
59 def _add_data_table_entry(data_manager_dict, data_table_name, data_table_entry):
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
60 data_manager_dict['data_tables'] = data_manager_dict.get('data_tables', {})
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
61 data_manager_dict['data_tables'][data_table_name] = data_manager_dict['data_tables'].get(data_table_name, [])
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
62 data_manager_dict['data_tables'][data_table_name].append(data_table_entry)
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
63 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
64
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 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
67 parser = optparse.OptionParser()
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
68 parser.add_option('-f', '--fasta_filename', dest='fasta_filename', action='store', type="string", default=None, help='fasta_filename')
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
69 parser.add_option('-d', '--fasta_dbkey', dest='fasta_dbkey', action='store', type="string", default=None, help='fasta_dbkey')
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
70 parser.add_option('-t', '--fasta_description', dest='fasta_description', action='store', type="string", default=None, help='fasta_description')
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
71 parser.add_option('-n', '--data_table_name', dest='data_table_name', action='store', type="string", default=None, help='data_table_name')
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
72 parser.add_option('-c', '--color_space', dest='color_space', action='store_true', default=False, help='color_space')
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
73 (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
74
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 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
76
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
77 with open(filename) as fh:
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
78 params = json.load(fh)
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
79 target_directory = params['output_data'][0]['extra_files_path']
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
80 os.mkdir(target_directory)
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
81 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
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 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
84
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
85 if dbkey in [None, '', '?']:
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
86 raise Exception('"%s" is not a valid dbkey. You must specify a valid dbkey.' % (dbkey))
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
87
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
88 sequence_id, sequence_name = get_id_name(params, dbkey=dbkey, fasta_description=options.fasta_description)
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
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
90 # build the index
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
91 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)
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
92
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
93 # save info to json file
5
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
94 with open(filename, 'w') as fh:
08a3583826fa "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_bowtie_index_builder commit 02d2967f77e3fa5a18aea63dc84aa9ab418dc165"
iuc
parents: 4
diff changeset
95 json.dump(data_manager_dict, fh, sort_keys=True)
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
96
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
97
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
98 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
99 main()