Mercurial > repos > sanbi-uwc > data_manager_novoalign_index_builder
annotate data_manager/novoalign_index_builder.py @ 2:e51fb8188ed9 draft
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
author | sanbi-uwc |
---|---|
date | Thu, 03 Mar 2016 08:40:42 -0500 |
parents | 85fbd52dbb36 |
children | b63a406719c5 |
rev | line source |
---|---|
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
1 #!/usr/bin/env python |
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
2 # Z. Mashologu (SANBI-UWC) |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
3 # import dict as dict |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
4 import os |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
5 import sys |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
6 import urllib2 |
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
7 import logging |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
8 import argparse |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
9 import shlex |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
10 from subprocess import check_call, CalledProcessError |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
11 from __future__ import print_function |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
12 |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
13 log = logging.getLogger(__name__) |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
14 |
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
15 from json import loads, dumps |
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
16 |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
17 def get_dbkey_id_name(params, dbkey_description=None): |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
18 dbkey = params['param_dict']['dbkey'] |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
19 # TODO: ensure sequence_id is unique and does not already appear in location file |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
20 sequence_id = params['param_dict']['sequence_id'] |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
21 if not sequence_id: |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
22 sequence_id = dbkey # uuid.uuid4() generate and use an uuid instead? |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
23 |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
24 sequence_name = params['param_dict']['sequence_name'] |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
25 if not sequence_name: |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
26 sequence_name = dbkey_description |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
27 if not sequence_name: |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
28 sequence_name = dbkey |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
29 return dbkey, sequence_id, sequence_name |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
30 |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
31 |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
32 def _make_novocraft_index(fasta_filename, target_directory): |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
33 if os.path.exists(target_directory) and not os.path.isdir(target_directory): |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
34 print("Output directory path already exists but is not a directory: {}".format(target_directory), |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
35 file=sys.stderr) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
36 elif not os.path.exists(target_directory): |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
37 os.mkdir(target_directory) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
38 |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
39 if 'GALAXY_SLOTS' in os.environ: |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
40 nslots = os.environ['GALAXY_SLOTS'] |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
41 else: |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
42 nslots = 1 |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
43 |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
44 cmdline_str = 'STAR --runMode genomeGenerate --genomeDir {} --genomeFastaFiles {} --runThreadN {}'.format( |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
45 target_directory, |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
46 fasta_filename, |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
47 nslots) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
48 cmdline = shlex.split(cmdline_str) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
49 try: |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
50 check_call(cmdline) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
51 except CalledProcessError: |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
52 print("Error building RNA STAR index", file=sys.stderr) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
53 return (target_directory) |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
54 |
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
55 |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
56 def download_from_url(params, target_directory): |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
57 # TODO: we should automatically do decompression here |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
58 urls = filter(bool, map(lambda x: x.strip(), params['param_dict']['reference_source']['user_url'].split('\n'))) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
59 fasta_reader = [urllib2.urlopen(url) for url in urls] |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
60 |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
61 _make_novocraft_index(fasta_reader, target_directory) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
62 |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
63 |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
64 def download_from_history( params, target_directory): |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
65 # TODO: allow multiple FASTA input files |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
66 input_filename = params['param_dict']['reference_source']['input_fasta'] |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
67 |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
68 _make_novocraft_index(input_filename, target_directory) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
69 |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
70 REFERENCE_SOURCE_TO_DOWNLOAD = dict(url=download_from_url, history=download_from_history) |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
71 |
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
72 def main(): |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
73 parser = argparse.ArgumentParser(description="Generate Novo-align genome index and JSON describing this") |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
74 parser.add_argument('output_filename') |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
75 parser.add_argument('--data_table_name', default='novocraft_index') |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
76 (options, args) = parser.parse_args() |
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
77 |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
78 filename = args.output_filename |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
79 |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
80 params = loads(open(filename).read()) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
81 target_directory = params['output_data'][0]['extra_files_path'] |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
82 os.mkdir(target_directory) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
83 |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
84 dbkey, sequence_id, sequence_name = get_dbkey_id_name(params, dbkey_description=options.dbkey_description) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
85 if dbkey in [None, '', '?']: |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
86 raise Exception('"%s" is not a valid dbkey. You must specify a valid dbkey.' % (dbkey)) |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
87 |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
88 # Fetch the FASTA |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
89 REFERENCE_SOURCE_TO_DOWNLOAD[params['param_dict']['reference_source']['reference_source_selector']]\ |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
90 (params, target_directory, dbkey, sequence_id, sequence_name) |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
91 |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
92 data_table_entry = dict(value=sequence_id, dbkey=dbkey, name=sequence_name, path=target_directory) |
0
85fbd52dbb36
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit d51fdc6291de173e829a839e98c6c3ae367d84bf
sanbi-uwc
parents:
diff
changeset
|
93 |
2
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
94 output_datatable_dict = dict(data_tables={args.data_table_name: [data_table_entry]}) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
95 open(filename, 'wb').write(dumps(output_datatable_dict)) |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
96 |
e51fb8188ed9
planemo upload for repository https://github.com/zipho/data_manager_novoalign_index_builder commit 7c74dfc33ffac5de44aae81def9c374f5f5e2a20
sanbi-uwc
parents:
0
diff
changeset
|
97 if __name__ == "__main__": main() |