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