annotate data_manager/twobit_builder.py @ 3:5c77d4091880 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
author iuc
date Mon, 18 Nov 2019 17:43:27 -0500
parents 9946bc39c834
children 625fd9476402
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
1 #!/usr/bin/env python
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
2 # Dan Blankenberg
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
3 from __future__ import print_function
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
4
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
5 import optparse
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
6 import os
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
7 import subprocess
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
8 import sys
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
9 import tempfile
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
10 from json import dumps, loads
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
11
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
12 CHUNK_SIZE = 2**20 # 1mb
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
13
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
14
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
15 def get_id_name(params, dbkey, fasta_description=None):
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
16 # TODO: ensure sequence_id is unique and does not already appear in location file
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
17 sequence_id = params['param_dict']['sequence_id']
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
18 if not sequence_id:
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
19 sequence_id = dbkey # uuid.uuid4() generate and use an uuid
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
20
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
21 sequence_name = params['param_dict']['sequence_name']
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
22 if not sequence_name:
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
23 sequence_name = fasta_description
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
24 if not sequence_name:
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
25 sequence_name = dbkey
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
26 return sequence_id, sequence_name
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
27
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
28
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
29 def build_twobit(data_manager_dict, fasta_filename, params, target_directory, dbkey, sequence_id, sequence_name):
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
30 twobit_base_name = "%s.2bit" % (sequence_id)
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
31 twobit_filename = os.path.join(target_directory, twobit_base_name)
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
32
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
33 args = ['faToTwoBit', fasta_filename, twobit_filename]
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
34 tmp_stderr = tempfile.NamedTemporaryFile(prefix="tmp-data-manager-twobit-builder-stderr")
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
35 proc = subprocess.Popen(args=args, shell=False, cwd=target_directory, stderr=tmp_stderr.fileno())
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
36 return_code = proc.wait()
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
37 if return_code:
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
38 tmp_stderr.flush()
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
39 tmp_stderr.seek(0)
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
40 print("Error building index:", file=sys.stderr)
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
41 while True:
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
42 chunk = tmp_stderr.read(CHUNK_SIZE)
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
43 if not chunk:
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
44 break
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
45 sys.stderr.write(chunk)
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
46 sys.exit(return_code)
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
47 tmp_stderr.close()
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
48 # lastz_seqs
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
49 data_table_entry = dict(value=sequence_id, name=sequence_name, path=twobit_base_name)
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
50
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
51 _add_data_table_entry(data_manager_dict, "lastz_seqs", data_table_entry)
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
52 # twobit.loc
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
53 data_table_entry = dict(value=sequence_id, path=twobit_base_name)
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
54
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
55 _add_data_table_entry(data_manager_dict, "twobit", data_table_entry)
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
56 # alignseq
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
57 data_table_entry = dict(type="seq", value=sequence_id, path=twobit_base_name)
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
58
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
59 _add_data_table_entry(data_manager_dict, "alignseq_seq", data_table_entry)
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
60
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
61
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
62 def _add_data_table_entry(data_manager_dict, data_table_name, data_table_entry):
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
63 data_manager_dict['data_tables'] = data_manager_dict.get('data_tables', {})
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
64 data_manager_dict['data_tables'][data_table_name] = data_manager_dict['data_tables'].get(data_table_name, [])
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
65 data_manager_dict['data_tables'][data_table_name].append(data_table_entry)
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
66 return data_manager_dict
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
67
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
68
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
69 def main():
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
70 parser = optparse.OptionParser()
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
71 parser.add_option('-f', '--fasta_filename', dest='fasta_filename', action='store', type="string", default=None, help='fasta_filename')
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
72 parser.add_option('-d', '--fasta_dbkey', dest='fasta_dbkey', action='store', type="string", default=None, help='fasta_dbkey')
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
73 parser.add_option('-t', '--fasta_description', dest='fasta_description', action='store', type="string", default=None, help='fasta_description')
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
74 (options, args) = parser.parse_args()
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
75
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
76 filename = args[0]
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
77
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
78 params = loads(open(filename).read())
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
79
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
80 target_directory = params['output_data'][0]['extra_files_path']
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
81 os.mkdir(target_directory)
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
82 data_manager_dict = {}
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
83
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
84 dbkey = options.fasta_dbkey
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
85
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
86 if dbkey in [None, '', '?']:
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
87 raise Exception('"%s" is not a valid dbkey. You must specify a valid dbkey.' % (dbkey))
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
88
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
89 sequence_id, sequence_name = get_id_name(params, dbkey=dbkey, fasta_description=options.fasta_description)
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
90
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
91 # build the index
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
92 build_twobit(data_manager_dict, options.fasta_filename, params, target_directory, dbkey, sequence_id, sequence_name)
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
93
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
94 # save info to json file
3
5c77d4091880 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 82ad45497a7b2277a710c634378a4122fb75ce1f"
iuc
parents: 2
diff changeset
95 open(filename, 'w').write(dumps(data_manager_dict, sort_keys=True))
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
96
0
74b09c8e5f6e planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
devteam
parents:
diff changeset
97
2
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
98 if __name__ == "__main__":
9946bc39c834 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/data_managers/data_manager_twobit_builder commit 8652f36a3a3838dca989426961561e81432acf4f
iuc
parents: 0
diff changeset
99 main()