annotate data_manager/malt_index_builder.py @ 0:5f9d6aee2256 draft default tip

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
author iuc
date Wed, 17 Nov 2021 08:22:56 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
1 #!/usr/bin/env python
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
2
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
3 import json
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
4 import optparse
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
5 import os
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
6 import subprocess
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
7 import sys
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
8
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
9
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
10 def get_id_name(params, dbkey, fasta_description=None):
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
11 sequence_id = params['param_dict']['sequence_id']
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
12 if not sequence_id:
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
13 sequence_id = dbkey
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
14
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
15 sequence_name = params['param_dict']['sequence_name']
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
16 if not sequence_name:
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
17 sequence_name = fasta_description
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
18 if not sequence_name:
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
19 sequence_name = dbkey
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
20 return sequence_id, sequence_name
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
21
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
22
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
23 def build_malt_index(data_manager_dict, fasta_filename, params, target_directory, dbkey, sequence_id, sequence_name, sequence_type, shapes, max_hits_per_seed, protein_reduct):
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
24 # The malt-build program produces a directory of files,
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
25 # so the data table path entry will be a directory and
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
26 # not an index file.
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
27 fasta_base_name = os.path.split(fasta_filename)[-1]
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
28 sym_linked_fasta_filename = os.path.join(target_directory, fasta_base_name)
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
29 os.symlink(fasta_filename, sym_linked_fasta_filename)
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
30 args = ['malt-build', '--input', sym_linked_fasta_filename, '--sequenceType', sequence_type, '--index', target_directory]
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
31 threads = os.environ.get('GALAXY_SLOTS')
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
32 if threads:
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
33 args.extend(['--threads', threads])
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
34 if shapes is not None:
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
35 args.extend(['--shapes', shapes])
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
36 if max_hits_per_seed is not None:
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
37 args.extend(['--maxHitsPerSeed', max_hits_per_seed])
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
38 if protein_reduct is not None:
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
39 args.extend(['--proteinReduct', protein_reduct])
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
40 proc = subprocess.Popen(args=args, shell=False, cwd=target_directory)
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
41 return_code = proc.wait()
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
42 if return_code:
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
43 sys.exit('Error building index, return_code: %d' % return_code)
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
44 # Remove unwanted files from the output directory.
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
45 os.remove(sym_linked_fasta_filename)
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
46 # The path entry here is the directory
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
47 # where the index files will be located,
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
48 # not a single index file (malt-build
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
49 # produces a directory if files, which
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
50 # is considered an index..
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
51 data_table_entry = dict(value=sequence_id, dbkey=dbkey, name=sequence_name, path=None)
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
52 _add_data_table_entry(data_manager_dict, data_table_entry)
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
53
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
54
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
55 def _add_data_table_entry(data_manager_dict, data_table_entry):
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
56 data_table_name = "malt_indices"
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
57 data_manager_dict['data_tables'] = data_manager_dict.get('data_tables', {})
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
58 data_manager_dict['data_tables'][data_table_name] = data_manager_dict['data_tables'].get(data_table_name, [])
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
59 data_manager_dict['data_tables'][data_table_name].append(data_table_entry)
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
60 return data_manager_dict
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
61
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
62
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
63 def main():
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
64 parser = optparse.OptionParser()
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
65 parser.add_option('-f', '--fasta_filename', dest='fasta_filename', action='store', type="string", help='fasta filename')
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
66 parser.add_option('-d', '--fasta_dbkey', dest='fasta_dbkey', action='store', type="string", help='fasta dbkey')
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
67 parser.add_option('-t', '--fasta_description', dest='fasta_description', action='store', type="string", default=None, help='fasta description')
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
68 parser.add_option('-e', '--sequence_type', dest='sequence_type', action='store', type="string", help='DNA or Protein sequences')
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
69 parser.add_option('-p', '--shapes', dest='shapes', action='store', type="string", default=None, help='Comma-separated list of seed shapes')
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
70 parser.add_option('-m', '--max_hits_per_seed', dest='max_hits_per_seed', action='store', type="string", default=None, help='Maximum number of hits per seed')
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
71 parser.add_option('-r', '--protein_reduct', dest='protein_reduct', action='store', type="string", default=None, help='Name or definition of protein alphabet reduction')
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
72 (options, args) = parser.parse_args()
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
73
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
74 filename = args[0]
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
75
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
76 with open(filename) as fh:
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
77 params = json.load(fh)
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
78 target_directory = params['output_data'][0]['extra_files_path']
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
79 os.mkdir(target_directory)
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
80 data_manager_dict = {}
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
81
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
82 dbkey = options.fasta_dbkey
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
83
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
84 if dbkey in [None, '', '?']:
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
85 raise Exception('"%s" is not a valid dbkey. You must specify a valid dbkey.' % (dbkey))
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
86
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
87 sequence_id, sequence_name = get_id_name(params, dbkey=dbkey, fasta_description=options.fasta_description)
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
88
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
89 # Build the index.
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
90 build_malt_index(data_manager_dict, options.fasta_filename, params, target_directory, dbkey, sequence_id, sequence_name, options.sequence_type, options.shapes, options.max_hits_per_seed, options.protein_reduct)
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
91
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
92 # Save info to json file.
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
93 with open(filename, 'w') as fh:
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
94 json.dump(data_manager_dict, fh, sort_keys=True)
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
95
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
96
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
97 if __name__ == "__main__":
5f9d6aee2256 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_malt_index_builder commit 710e56e0e522b0ed060dab2fecf05ed1c79c928f"
iuc
parents:
diff changeset
98 main()