annotate data_manager/twobit_builder.py @ 0:74b09c8e5f6e draft

planemo upload for repository https://github.com/galaxyproject/tools-devteam/tree/master/data_managers/data_manager_twobit_builder commit 130cb0c08ad3c5b858ba46b1024dcdccc3cb68c6-dirty
author devteam
date Thu, 11 Jun 2015 16:14:27 -0400
parents
children 9946bc39c834
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
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
2 #Dan Blankenberg
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
3
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 import sys, os, tempfile, optparse, uuid, subprocess
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
5
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
6 from json import loads, dumps
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
7
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
8
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
9 CHUNK_SIZE = 2**20 #1mb
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
10
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 def get_id_name( params, dbkey, fasta_description=None):
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
12 #TODO: ensure sequence_id is unique and does not already appear in location file
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 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
14 if not 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
15 sequence_id = dbkey #uuid.uuid4() generate and use an uuid
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
16
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_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
18 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
19 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
20 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
21 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
22 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
23
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 def build_twobit( data_manager_dict, fasta_filename, params, target_directory, dbkey, 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
25 twobit_base_name = "%s.2bit" % ( 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
26 twobit_filename = os.path.join( target_directory, twobit_base_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
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
28 args = [ 'faToTwoBit', fasta_filename, twobit_filename ]
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
29 tmp_stderr = tempfile.NamedTemporaryFile( prefix = "tmp-data-manager-twobit-builder-stderr" )
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
30 proc = subprocess.Popen( args=args, shell=False, cwd=target_directory, stderr=tmp_stderr.fileno() )
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
31 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
32 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
33 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
34 tmp_stderr.seek(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
35 print >> sys.stderr, "Error building index:"
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 while True:
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 chunk = tmp_stderr.read( CHUNK_SIZE )
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 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
39 break
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
40 sys.stderr.write( 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
41 sys.exit( 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
42 tmp_stderr.close()
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 #lastz_seqs
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 data_table_entry = dict( value=sequence_id, name=sequence_name, path=twobit_base_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
45
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
46 _add_data_table_entry( data_manager_dict, "lastz_seqs", data_table_entry )
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 #twobit.loc
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
48 data_table_entry = dict( value=sequence_id, path=twobit_base_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
49
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 _add_data_table_entry( data_manager_dict, "twobit", data_table_entry )
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
51 #alignseq
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
52 data_table_entry = dict( type="seq", value=sequence_id, path=twobit_base_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
53
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 _add_data_table_entry( data_manager_dict, "alignseq_seq", data_table_entry )
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
55
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
56 def _add_data_table_entry( data_manager_dict, data_table_name, data_table_entry ):
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
57 data_manager_dict['data_tables'] = data_manager_dict.get( 'data_tables', {} )
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 data_manager_dict['data_tables'][ data_table_name ] = data_manager_dict['data_tables'].get( data_table_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
59 data_manager_dict['data_tables'][ data_table_name ].append( data_table_entry )
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 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
61
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
62 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
63 #Parse Command Line
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
64 parser = optparse.OptionParser()
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
65 parser.add_option( '-f', '--fasta_filename', dest='fasta_filename', action='store', type="string", default=None, help='fasta_filename' )
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 parser.add_option( '-d', '--fasta_dbkey', dest='fasta_dbkey', action='store', type="string", default=None, help='fasta_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
67 parser.add_option( '-t', '--fasta_description', dest='fasta_description', action='store', type="string", default=None, help='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
68 (options, args) = parser.parse_args()
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
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 filename = args[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
71
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
72 params = loads( open( filename ).read() )
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
73
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 target_directory = params[ 'output_data' ][0]['extra_files_path']
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
75 os.mkdir( target_directory )
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 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
77
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
78 dbkey = options.fasta_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
79
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
80 if dbkey in [ None, '', '?' ]:
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
81 raise Exception( '"%s" is not a valid dbkey. You must specify a valid dbkey.' % ( 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
82
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
83 sequence_id, sequence_name = get_id_name( params, dbkey=dbkey, fasta_description=options.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
84
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
85 #build the index
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
86 build_twobit( data_manager_dict, options.fasta_filename, params, target_directory, dbkey, 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
87
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
88 #save info to json file
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
89 open( filename, 'wb' ).write( dumps( 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
90
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
91 if __name__ == "__main__": 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
92