Modified tools using the <select_options> tag approach for dynamic options to use the new <select> tag approach. I modified the microbial import tool to use the older <select_options> approach last week and will modify it to use the new <select> approach next week. A few tools still use the oldest dynamic_options attribute approach, but modifying them to use the new <select> tag will be trivial. I'll do this when I return.

This commit is contained in:
Greg Von Kuster
2007-11-21 18:48:37 +00:00
parent 49bc4a4da4
commit 300d66fb11
28 changed files with 653 additions and 707 deletions
+314 -306
View File
@@ -8,8 +8,20 @@ class DynamicOptions( object ):
def __init__( self, elem ):
# FIXME: Pushing these things in as options ends up being pretty ugly.
# We should find a way to make this work through the validation mechanism.
self.no_data_option = ( 'No data available for this build', 'None', True )
self.no_data_option = [ ( 'No data available for this build', 'None', True ) ]
self.no_elems_option = [ ( 'No elements to display, please choose another column', 'None', True ) ]
self.unspecified_build_option = [ ( 'unspecified', '?', True ) ]
self.build_not_set_option = [ ( 'Build not set, click the pencil icon in your history item to set the build', 'None', True ) ]
self.wait_for_maf_option = [ ( 'You must wait for the MAF file to be created before you can use this tool.', 'None', True ) ]
self.from_file = elem.get( 'from_file', None )
if self.from_file is not None:
self.from_file = self.from_file.strip()
try:
i = self.from_file.rindex( "/" )
self.data_file = self.from_file[ i+1: ]
except:
self.data_file = self.from_file
else: self.data_file = None
if elem.tag == 'select_options':
self.data_ref = elem.get( 'data_ref', None )
self.param_ref = elem.get( 'param_ref', None )
@@ -17,18 +29,19 @@ class DynamicOptions( object ):
assert self.func is not None, "Value for option generator function not found"
self.func_params = elem.findall( 'func_param' )
else: #elem.tag =='options'
self.name_col = int( elem.get( 'name_col', None ) )
assert self.name_col is not None, "Value for option generator name_col not found"
self.value_col = int( elem.get( 'value_col', None ) )
assert self.value_col is not None, "Value for option generator value_col not found"
self.filters = elem.findall( 'filter' )
self.data_ref = None
for filter in self.filters:
filter_type = filter.get( 'type', None )
assert filter_type is not None, "type attribute missing from filter"
filter_type = filter_type.strip()
if filter_type == 'data_meta':
# We're using metadata information from self.data_ref
assert filter_type is not None, "Required 'type' attribute missing from filter"
if filter_type.strip() == 'data_meta':
self.data_ref = filter.get( 'data_ref', None )
assert self.data_ref is not None, "Required 'data_ref' attribute missing from 'data_meta' filter"
self.data_ref = self.data_ref.strip()
elif filter_type.strip() == 'param_meta':
self.param_ref = filter.get( 'param_ref', None )
assert self.param_ref is not None, "Required 'param_ref' attribute missing from 'param_meta' filter"
self.param_ref = self.param_ref.strip()
#FIXME: this attr is used only by microbial import, so shouldn't be at this level
self.microbe_info = None
def get_dataset( self, trans, other_values ):
@@ -37,46 +50,291 @@ class DynamicOptions( object ):
# Get the value of the associated DataToolParameter (a dataset)
dataset = other_values[ self.data_ref ]
if dataset is None or dataset == '':
"""
Both of these values indicate that no dataset is selected. However, 'None' indicates that the dataset is optional
while '' indicates that it is not. Currently dynamically generated select lists do not work well with optional datasets.
"""
# Both of these values indicate that no dataset is selected. However, 'None'
# indicates that the dataset is optional while '' indicates that it is not.
# Currently dynamically generated select lists do not work well with optional datasets.
return None
return dataset
def get_param_value( self, trans, other_values ):
if self.param_ref is None: return None
assert self.param_ref in other_values, "Value for associated parameter %s not found" %self.param_ref.name
return other_values[ self.param_ref ]
def load_from_file( self, key=None, value=None, col=None, sep='\t' ):
"""key: build, value: dbkey, col: 0"""
def get_unique_elems( self, elems ):
seen = set()
return [ x for x in elems if x not in seen and not seen.add( x ) ]
def get_options( self, trans, other_values ):
filters = {}
key = None
# Check for filters and build a dictionary from them
for filter in self.filters:
filter_type = filter.get( 'type', None )
assert filter_type is not None, "type attribute missing from filter"
filter_type = filter_type.strip()
if filter_type == 'data_meta':
filters[ 'data_meta' ] = {}
dataset = self.get_dataset( trans, other_values )
if dataset is None: return []
key = filter.get( 'key', None )
assert key is not None, "key attribute missing from data_meta filter"
filters[ 'data_meta' ][ 'key' ] = key.strip()
value = filter.get( 'value', None )
if value is not None: value = value.strip()
else:
if key == 'build': value = dataset.get_dbkey()
elif key == 'file_name': value = dataset.get_file_name()
elif key == 'species': value = dataset.metadata.species
elif key == 'maf': pass # value does not need to be set, maf tools require special handling - see below
filters[ 'data_meta' ][ 'value' ] = value
if self.data_file == 'maf_index.loc' and key == 'build' and value == '?':
return self.build_not_set_option
elif filter_type == 'param_meta':
filters[ 'param_meta' ] = {}
key = filter.get( 'key', None )
assert key is not None, "key attribute missing from param_meta filter"
filters[ 'param_meta' ][ 'key' ] = key.strip()
value = self.get_param_value( trans, other_values )
filters[ 'param_meta' ][ 'value' ] = value
elif filter_type == 'column':
n = filter.get( 'name', None )
assert n is not None, "column filters require a 'name' attribute"
n = n.strip()
v = filter.get( 'value', None )
assert v is not None, "column filters require a 'value' attribute"
v = v.strip()
try:
filters[ 'columns' ][ n ] = v
except:
filters[ 'columns' ] = {}
filters[ 'columns' ][ n ] = v
elif filter_type == 'param':
# TODO: I'm not sure I like the way 'param' filters are implemented, I may be rethinking this approach...
n = filter.get( 'name', None )
assert n is not None, "param filters require a 'name' attribute"
n = n.strip()
v = filter.get( 'value', None )
assert v is not None, "param filters require a 'value' attribute"
v = v.strip()
try:
filters[ 'params' ][ n ] = v
except:
filters[ 'params' ] = {}
filters[ 'params' ][ n ] = v
# Now that we've parsed our filters, we need to see if the tool is a maf tool which requires special handling
try: key = filters[ 'data_meta' ][ 'key' ]
except: key == None
if key == 'maf':
maf_source = filters[ 'params' ][ 'maf_source' ]
if maf_source == 'cached':
maf_uid = filters[ 'param_meta' ][ 'value' ]
if maf_uid is None: return self.no_data_option
if maf_uid == 'None': return self.build_not_set_option
elif maf_source == 'user':
dataset = self.get_dataset( trans, other_values )
if dataset is None: return self.wait_for_maf_option
filters[ 'data_meta' ][ 'key' ] = 'species'
filters[ 'data_meta' ][ 'value' ] = dataset.metadata.species
return self.generate_options( filters )
def generate_options( self, filters={}, sep='\t' ):
# Extract the info from the tool's options filters, if any
try: key = filters[ 'data_meta' ][ 'key' ]
except: key = None
try: value = filters[ 'data_meta' ][ 'value' ]
except: value = None
if key is None and value is None:
# Look for param_meta filter
try: key = filters[ 'param_meta' ][ 'key' ]
except: key = None
try: value = filters[ 'param_meta' ][ 'value' ]
except: value = None
try: name_col = int( filters[ 'columns' ][ 'name_col' ] )
except: name_col = None
try: value_col = int( filters[ 'columns' ][ 'value_col' ] )
except: value_col = None
try: encode_group = filters[ 'params' ][ 'encode_group' ]
except: encode_group = None
try: build = filters[ 'params' ][ 'build' ]
except: build = None
try: maf_source = filters[ 'params' ][ 'maf_source' ]
except: maf_source = None
# Order of the following conditionals is critical
if encode_group is not None and build is not None:
return self.generate_from_file_for_encode( encode_group, build )
elif key == 'species':
return self.generate_from_dataset_for_species( value )
elif key == 'maf':
return self.generate_from_file_for_maf( maf_source, value )
elif key == 'file_name':
return self.generate_from_dataset( value, value_col )
elif key == 'build':
build_col = int( filters[ 'columns' ][ 'build_col' ].strip() )
return self.generate_from_file_for_build( value, build_col, name_col, value_col )
elif key is None:
return self.generate_from_file( name_col, value_col )
def generate_from_file_for_encode( self, encode_group, build, sep='\t' ):
options = []
def generate():
encode_sets = {}
for line in open( self.from_file ):
line = line.rstrip( '\r\n' )
if line and not line.startswith( '#' ):
try:
fields = line.split( sep )
encode_group = fields[ 0 ]
build = fields[ 1 ]
description = fields[ 2 ]
uid = fields[ 3 ]
path = fields[ 4 ]
try: file_type = fields[ 5 ]
except: file_type = "bed"
#TODO: will remove this later, when galaxy can handle gff files
if file_type != "bed": continue
if not os.path.isfile( path ): continue
except: continue
try: temp = encode_sets[ encode_group ]
except: encode_sets[ encode_group ] = {}
try:
encode_sets[ encode_group ][ build ].append( ( description, uid, False ) )
except:
encode_sets[ encode_group ][ build ] = []
encode_sets[ encode_group ][ build] .append( ( description, uid, False ) )
#Order by description and date, highest date on top and bold
for group in encode_sets:
for build in encode_sets[ group ]:
ordered_build = []
for description, uid, selected in encode_sets[ group ][ build ]:
item = {}
item[ 'date' ] = 0
item[ 'description' ] = ""
item[ 'uid' ] = uid
item[ 'selected' ] = selected
item[ 'partitioned' ] = False
if description[ -21: ] == '[gencode_partitioned]':
item[ 'date' ] = description[ -31:-23 ]
item[ 'description' ] = description[ 0:-32 ]
item[ 'partitioned' ] = True
else:
item[ 'date' ] = description[ -9:-1 ]
item[ 'description' ] = description[ 0:-10 ]
for i in range( len( ordered_build ) ):
ordered_description, ordered_uid, ordered_selected, ordered_item = ordered_build[ i ]
if item[ 'description' ] < ordered_item[ 'description' ]:
ordered_build.insert( i, ( description, uid, selected, item ) )
break
if item[ 'description' ] == ordered_item[ 'description' ] and item[ 'partitioned' ] == ordered_item[ 'partitioned' ]:
if int( item[ 'date' ] ) > int( ordered_item[ 'date' ] ):
ordered_build.insert( i, ( description, uid, selected, item ) )
break
else: ordered_build.append( ( description, uid, selected, item ) )
last_desc = None
last_partitioned = None
for i in range( len( ordered_build ) ) :
description, uid, selected, item = ordered_build[ i ]
if item[ 'partitioned' ] != last_partitioned or last_desc != item[ 'description' ]:
last_desc = item[ 'description' ]
description = "<b>" + description + "</b>"
else:
last_desc = item[ 'description' ]
last_partitioned = item[ 'partitioned' ]
encode_sets[ group ][ build ][ i ] = ( description, uid, selected )
return encode_sets
d = generate()
if len( d ) < 1:
return self.no_data_option
else:
try: options = d[ encode_group ][ build ][ 0: ]
except: return self.no_data_option
return options
def generate_from_dataset_for_species( self, value ):
options = []
for species in value:
options.append( ( species, species, False ) )
return options
def generate_from_file_for_maf( self, maf_source, maf_uid, sep='\t' ):
options = []
d = {}
tool_type = None
# We will only reach here if the maf-source param value is 'cached'
for line in open( self.from_file ):
line = line.rstrip( '\r\n' )
if line and not line.startswith( '#' ):
fields = line.split( sep )
try:
fields = line.split( sep )
if key == 'build':
if col is not None:
if fields[ col ].strip() == 'align': # tool is: Extract blastz alignments1
tool_type = 'blastz'
try: d[ fields[ self.name_col ] ].append( fields[ self.value_col ] )
except: d[ fields[ self.name_col ] ] = [ fields[ self.value_col ] ]
else: # tool is one of: aggregate_scores_in_intervals2, phastOdds_for_intervals, random_intervals1
tool_type = 'intervals'
if not fields[ col ] in d:
d[ fields[ col ] ] = []
d[ fields[ col ] ].append( (fields[ self.name_col ], fields[ self.value_col ]) )
else:
options.append( (fields[ self.name_col ], fields[ self.value_col ], False) )
elif key == 'some future key':
pass
else: # tool is one of: axt_to_concat_fasta, axt_to_fasta, axt_to_lav_1
options.append( (fields[ self.name_col ], fields[ self.value_col ], False) )
name_col_data = fields[ 0 ] # ENCODE TBA (hg17)
value_col_data = fields[ 1 ] # ENCODE_TBA_hg17
builds_col_data = fields[ 2 ] # armadillo=armadillo,baboon=baboon,galGal2=chicken,...
build_list = []
builds = builds_col_data.split( ',' )
for build in builds:
this_build = build.split( '=' )[ 0 ]
build_list.append( this_build )
d[ value_col_data ] = {}
d[ value_col_data ][ 'description' ] = name_col_data
d[ value_col_data ][ 'builds' ] = build_list
except: continue
if tool_type == 'blastz':
for key in d[ maf_uid ][ 'builds' ]:
options.append( ( key, key, False ) )
if not options: return self.no_data_option
return options
def generate_from_dataset( self, value, value_col, sep='\t' ):
options = []
elem_list = []
try: in_file = open( value, "r" )
except: return self.no_data_option
try:
for line in in_file:
line = line.rstrip( "\r\n" )
if line and not line.startswith( '#' ):
elems = line.split( sep )
elem_list.append( elems[ value_col ] )
except: pass
in_file.close()
if not( elem_list ): return self.no_elems_option
elem_list = self.get_unique_elems( elem_list )
for elem in elem_list:
options.append( ( elem, elem, False ) )
return options
def generate_from_file_for_build( self, value, build_col, name_col, value_col, sep='\t' ):
options = []
d = {}
for line in open( self.from_file ):
line = line.rstrip( '\r\n' )
if line and not line.startswith( '#' ):
fields = line.split( sep )
# TDDO: regenerate the following data files so that they follow a column standard.
# build_col = 0 - put build values in column 0
# name_col = 1 - put the select list description values in column 1
# value_col = 2 - put the select list value values in column 2
# This will allow us to eliminate the following data_file conditionals
#
# TODO: the alignseq.loc file is currently ony used by the "Extract blastz alignments1"
# tool, which seems to be deprecated. Can we eliminate it altogether?
if self.data_file == 'alignseq.loc':
if fields[ build_col ].strip() == 'align':
try: d[ fields[ name_col ] ].append( fields[ value_col ] )
except: d[ fields[ name_col ] ] = [ fields[ value_col ] ]
elif self.data_file == 'regions.loc' or self.data_file == 'phastOdds.loc' or self.data_file == 'binned_scores.loc':
if not fields[ build_col ] in d:
d[ fields[ build_col ] ] = []
d[ fields[ build_col ] ].append( (fields[ name_col ], fields[ value_col ]) )
elif self.data_file == 'maf_index.loc':
try:
maf_desc = fields[ name_col ] # ENCODE TBA (hg17)
maf_uid = fields[ value_col ] # ENCODE_TBA_hg17
builds = fields[ build_col ] # armadillo=armadillo,baboon=baboon,galGal2=chicken,...
build_list = []
split_builds = builds.split( ',' )
for build in split_builds:
this_build = build.split( '=' )[0]
build_list.append( this_build )
d[ maf_uid ] = {}
d[ maf_uid ][ 'description' ] = maf_desc
d[ maf_uid ][ 'builds' ] = build_list
except: continue
# TODO: the alignseq.loc file is currently ony used by the "Extract blastz alignments1"
# tool, which seems to be deprecated. Can we eliminate it altogether?
if self.data_file == 'alignseq.loc':
# FIXME: We need a database of descriptive names corresponding to dbkeys.
# We need to resolve the musMusX <--> mmX confusion
if value[ 0:2 ] == "mm": value = value.replace( 'mm', 'musMus' )
@@ -84,279 +342,27 @@ class DynamicOptions( object ):
if value in d:
for val in d[ value ]:
options.append( ( val, val, False ) )
elif tool_type == 'intervals':
elif self.data_file == 'regions.loc' or self.data_file == 'phastOdds.loc' or self.data_file == 'binned_scores.loc':
if value in d:
for (key, val) in d[ value ]:
options.append( (key, val, False) )
else: # tool_type is some future tool type
pass
if key == 'build' and not options: return [ ('unspecified', '?', True ) ]
options.append( ( key, val, False ) )
elif self.data_file == 'maf_index.loc':
for key in d:
if value in d[ key ][ 'builds' ]:
options.append( ( d[ key ][ 'description' ], key, False ) )
if not options:
return self.no_data_option
if not options:
return self.unspecified_build_option
return options
def get_options( self, trans, other_values ):
"""
Used by the following tools so far...
random_intervals1 - associated data file: /depot/data2/galaxy/regions.loc
phastOdds_for_intervals - associated data file: /depot/data2/galaxy/phastOdds.loc
aggregate_scores_in_intervals2 - associated data file: /depot/data2/galaxy/binned_scores.loc
axt_to_concat_fasta - associated data file: static/ucsc/builds.txt
axt_to_fasta - associated data file: static/ucsc/builds.txt
axt_to_lav_1 - - associated data file: static/ucsc/builds.txt
Extract blastz alignments1 - associated data file: /depot/data2/galaxy/alignseq.loc
"""
# Check for filters first and process any that we find
for filter in self.filters:
filter_type = filter.get( 'type', None )
assert filter_type is not None, "type attribute missing from filter"
filter_type = filter_type.strip()
if filter_type == 'data_meta':
# We're using metadata information from self.data_ref
dataset = self.get_dataset( trans, other_values )
if dataset is None:
return options
key = filter.get( 'key', None )
assert key is not None, "key attribute missing from data_meta filter"
key = key.strip()
value = filter.get( 'value', None )
assert value is not None, "value attribute missing from data_meta filter"
value = value.strip()
col = filter.get( 'col', None )
assert col is not None, "col attribute missing from data_meta filter"
col = int( col.strip() )
if key == 'build': # value must be 'dbkey'
value = eval( '''dataset.%s''' %value )
elif key == 'some other future key':
pass
return self.load_from_file( key=key, value=value, col=col, sep='\t' )
elif filter_type == 'some other future type':
pass
# We must not have found a filter, so we'll generate the list generically
return self.load_from_file()
"""
TODO: the following functions should be generalized so that they are not specific to
certain tools (e.g., encode). We may need to standardize data file formats to be able to do this.
Comments in the functions show the tools that use them along with associated data files, if any
"""
def load_from_file_for_maf( self ):
d = {}
def generate_from_file( self, name_col, value_col, sep='\t' ):
options = []
for line in open( self.from_file ):
line = line.rstrip( '\r\n' )
if line and not line.startswith( '#' ):
fields = line.split('\t')
try:
maf_desc = fields[0]
maf_uid = fields[1]
builds = fields[2]
build_list = []
split_builds = builds.split( ',' )
for build in split_builds:
this_build = build.split( '=' )[0]
build_list.append( this_build )
paths = fields[3]
d[maf_uid] = {}
d[maf_uid]['description'] = maf_desc
d[maf_uid]['builds'] = build_list
except: continue
return d
def get_options_for_maf( self, trans, other_values ):
"""
Used by the following tools:
maf_stats1 - associated data file: /depot/data2/galaxy/maf_index.loc
GeneBed_Maf_Fasta1 - associated data file: /depot/data2/galaxy/maf_index.loc
"""
options = []
dataset = self.get_dataset( trans, other_values )
if dataset is None:
return options
if dataset.dbkey == '?':
return [( 'Build not set', 'None', True )]
d = self.load_from_file_for_maf()
for key in d:
if dataset.dbkey in d[key]['builds']:
options.append( ( d[key]['description'], key, False ) )
if len( options ) < 1:
return [self.no_data_option]
return options
def get_options_for_species( self, trans, other_values ):
"""
Used by the following tools:
MAF_Limit_To_Species1 - no associated data file
MAF_Thread_For_Species1 - no associated data file
MAF_To_BED1 - no associated data file
MAF_To_Fasta_Concat1 - no associated data file
TODO: multiple tools with same ID
MAF_To_Fasta1 (maf_to_fasta_multiple_sets.xml) - no associated data file
MAF_To_Fasta1 (maf_to_fasta.xml) - no associated data file
GeneBed_Maf_Fasta_User1 - no associated data file
"""
options = []
dataset = self.get_dataset( trans, other_values )
if dataset is None:
return options
for species in dataset.metadata.species:
options.append( ( species, species, False ) )
return options
def get_options_for_species_for_maf( self, trans, other_values ):
"""
Used by the following tools:
GeneBed_Maf_Fasta1 - associated data file: /depot/data2/galaxy/maf_index.loc
"""
options = []
assert len( self.func_params ) == 1, "Value for 'maf_source' not found"
for func_param in self.func_params:
if func_param.get( 'name' ).strip() == 'maf_source':
maf_source = func_param.get( 'value' ).strip()
if maf_source == 'cached':
d = self.load_from_file_for_maf()
maf_uid = self.get_param_value( trans, other_values )
if maf_uid is None:
return [self.no_data_option]
if maf_uid == 'None':
return [( '<b>Build not set, click pencil icon in your history item to associate a build</b>', 'None', True )]
for key in d[maf_uid]['builds']:
options.append( (key, key, False) )
if len( options ) < 1:
return [self.no_data_option]
else: # maf_source == 'user'
dataset = self.get_dataset( trans, other_values )
if dataset is None:
return [( "<B>You must wait for the MAF file to be created before you can use this tool.</B>", 'None', True )]
for species in dataset.metadata.species:
options.append( ( species, species, False ) )
return options
def get_options_for_features( self, trans, other_values ):
"""
Used by the following tools:
Extract_features1 - no associated data file (tool uses data from selected dataset)
"""
def get_unique_elems( elems ):
seen = set()
return [x for x in elems if x not in seen and not seen.add(x)]
assert len( self.func_params ) == 1, "Value for 'index' not found"
for func_param in self.func_params:
if func_param.get( 'name' ).strip() == 'index':
index = func_param.get( 'value' ).strip()
assert index is not None, "Value for 'index' not properly set"
options = []
elem_list = []
dataset = self.get_dataset( trans, other_values )
if dataset is None:
return options
datafile = dataset.get_file_name()
try:
in_file = open( datafile, "r" )
except:
return [self.no_data_option]
try:
for line in in_file:
line = line.rstrip( "\r\n" )
if line and not line.startswith( '#' ):
elems = line.split( '\t' )
elem_list.append( elems[int( index )] )
except: pass
in_file.close()
if not( elem_list ):
options.append( ( 'No elements to display, please choose another column', 'None', True ) )
return options
elem_list = get_unique_elems( elem_list )
for elem in elem_list:
options.append( ( elem, elem, False ) )
return options
def get_options_for_encode( self, trans, other_values ):
"""
Used by the following tools:
encode_import_all_latest_datasets1 - associated data file: /depot/data2/galaxy/encode_datasets.loc
encode_import_chromatin_and_chromosomes1 - associated data file: /depot/data2/galaxy/encode_datasets.loc
encode_import_gencode1 - associated data file: /depot/data2/galaxy/encode_datasets.loc
encode_import_genes_and_transcripts1 - associated data file: /depot/data2/galaxy/encode_datasets.loc
encode_import_multi-species_sequence_analysis1 - associated data file: /depot/data2/galaxy/encode_datasets.loc
encode_import_transcription_regulation1 - associated data file: /depot/data2/galaxy/encode_datasets.loc
"""
assert len( self.func_params ) == 2, "Values for 'build' and 'encode group' not found"
for func_param in self.func_params:
if func_param.get( 'name' ).strip() == 'build':
build = func_param.get( 'value' ).strip()
elif func_param.get( 'name' ).strip() == 'encode_group':
encode_group = func_param.get( 'value' ).strip()
assert build and encode_group, "Values for 'build' and 'encode group' not properly set"
options = []
def load_from_file_for_encode():
encode_sets = {}
for line in open( self.from_file ):
line = line.rstrip( '\r\n' )
if line and not line.startswith( '#' ):
try:
fields = line.split( "\t" )
encode_group = fields[0]
build = fields[1]
description = fields[2]
uid = fields[3]
path = fields[4]
try: file_type = fields[5]
except: file_type = "bed"
#TODO: will remove this later, when galaxy can handle gff files
if file_type != "bed": continue
if not os.path.isfile(path): continue
except:
continue
try: temp = encode_sets[encode_group]
except: encode_sets[encode_group] = {}
try:
encode_sets[encode_group][build].append((description, uid, False))
except:
encode_sets[encode_group][build]=[]
encode_sets[encode_group][build].append((description, uid, False))
#Order by description and date, highest date on top and bold
for group in encode_sets:
for build in encode_sets[ group ]:
ordered_build = []
for description, uid, selected in encode_sets[ group ][ build ]:
item = {}
item['date']=0
item['description'] = ""
item['uid'] = uid
item['selected'] = selected
item['partitioned'] = False
if description[-21:] == '[gencode_partitioned]':
item['date'] = description[-31:-23]
item['description'] = description[0:-32]
item['partitioned'] = True
else:
item['date'] = description[-9:-1]
item['description'] = description[0:-10]
for i in range(len(ordered_build)):
ordered_description, ordered_uid, ordered_selected, ordered_item = ordered_build[i]
if item['description'] < ordered_item['description']:
ordered_build.insert( i, (description, uid, selected, item) )
break
if item['description'] == ordered_item['description'] and item['partitioned'] == ordered_item['partitioned']:
if int(item['date']) > int(ordered_item['date']):
ordered_build.insert( i, (description, uid, selected, item) )
break
else: ordered_build.append( (description, uid, selected, item) )
last_desc = None
last_partitioned = None
for i in range(len(ordered_build)) :
description, uid, selected, item = ordered_build[i]
if item['partitioned'] != last_partitioned or last_desc != item['description']:
last_desc = item['description']
description = "<b>" + description + "</b>"
else:
last_desc = item['description']
last_partitioned = item['partitioned']
encode_sets[group][build][i] = (description, uid, selected)
return encode_sets
d = load_from_file_for_encode()
if len( d ) < 1:
return [self.no_data_option]
else:
try:
options = d[encode_group][build][0:]
except:
options.append( self.no_data_option )
fields = line.split( sep )
# TODO: this option list should be sorted
options.append( ( fields[ name_col ], fields[ value_col ], False ) )
return options
def load_from_file_for_microbial( self ):
self.from_file = "/depot/data2/galaxy/microbes/microbial_data.loc"
@@ -441,11 +447,15 @@ class DynamicOptions( object ):
kingdoms.sort()
for kingdom in kingdoms:
options.append( (kingdom, kingdom, False) )
if options:
options[0] = ( options[0][0], options[0][1], True)
return options
def get_options_for_orgs_by_kingdom( self, trans, other_values ):
if self.microbe_info == None: self.load_from_file_for_microbial()
options = []
kingdom = self.get_param_value( trans, other_values )
for func_param in self.func_params:
if func_param.get( 'name' ) == 'kingdom':
kingdom = other_values[ func_param.get( 'value' ) ]
orgs = self.microbe_info[kingdom].keys()
#need to sort by name
swap_test = False
@@ -460,10 +470,8 @@ class DynamicOptions( object ):
options.append( ( "<b>" + self.microbe_info[kingdom][org]['name'] + "</b> <a href=\"" + self.microbe_info[kingdom][org]['info_url'] + "\" target=\"_blank\">(about)</a>", org, False ) )
else:
options.append( ( self.microbe_info[kingdom][org]['name'] + " <a href=\"" + self.microbe_info[kingdom][org]['info_url'] + "\" target=\"_blank\">(about)</a>", org, False ) )
"""
if options:
options[0] = ( options[0][0], options[0][1], True)
"""
return options
def get_options_for_kingdom_org_feature( self, trans, other_values ):
if self.microbe_info == None: self.load_from_file_for_microbial()
@@ -6,17 +6,17 @@
<p><div class="toolFormTitle">hg16 (most recent datasets in bold)</div>$hg16</p>
</display>
<param name="hg17" type="select" display="checkboxes" multiple="true">
<select_options from_file="/depot/data2/galaxy/encode_datasets.loc" func="get_options_for_encode">
<func_param name="encode_group" value="ALD" />
<func_param name="build" value="hg17" />
</select_options>
</param>
<options from_file="/depot/data2/galaxy/encode_datasets.loc" >
<filter type="param" name="encode_group" value="ALD" />
<filter type="param" name="build" value="hg17" />
</options>
</param>
<param name="hg16" type="select" display="checkboxes" multiple="true">
<select_options from_file="/depot/data2/galaxy/encode_datasets.loc" func="get_options_for_encode">
<func_param name="encode_group" value="ALD" />
<func_param name="build" value="hg16" />
</select_options>
</param>
<options from_file="/depot/data2/galaxy/encode_datasets.loc">
<filter type="param" name="encode_group" value="ALD" />
<filter type="param" name="build" value="hg16" />
</options>
</param>
</inputs>
<outputs>
<data format="bed" name="output"/>
@@ -5,18 +5,18 @@
<p><div class="toolFormTitle">hg17 (most recent datasets in bold)</div>$hg17</p>
<p><div class="toolFormTitle">hg16 (most recent datasets in bold)</div>$hg16</p>
</display>
<param name="hg17" type="select" display="checkboxes" multiple="true">
<select_options from_file="/depot/data2/galaxy/encode_datasets.loc" func="get_options_for_encode">
<func_param name="encode_group" value="CC" />
<func_param name="build" value="hg17" />
</select_options>
</param>
<param name="hg17" type="select" display="checkboxes" multiple="true">
<options from_file="/depot/data2/galaxy/encode_datasets.loc">
<filter type="param" name="encode_group" value="CC" />
<filter type="param" name="build" value="hg17" />
</options>
</param>
<param name="hg16" type="select" display="checkboxes" multiple="true">
<select_options from_file="/depot/data2/galaxy/encode_datasets.loc" func="get_options_for_encode">
<func_param name="encode_group" value="CC" />
<func_param name="build" value="hg16" />
</select_options>
</param>
<options from_file="/depot/data2/galaxy/encode_datasets.loc">
<filter type="param" name="encode_group" value="CC" />
<filter type="param" name="build" value="hg16" />
</options>
</param>
</inputs>
<outputs>
<data format="bed" name="output"/>
+10 -10
View File
@@ -6,17 +6,17 @@
<p><div class="toolFormTitle">hg16 (most recent datasets in bold)</div>$hg16</p>
</display>
<param name="hg17" type="select" display="checkboxes" multiple="true">
<select_options from_file="/depot/data2/galaxy/encode_datasets.loc" func="get_options_for_encode">
<func_param name="encode_group" value="GENCODE" />
<func_param name="build" value="hg17" />
</select_options>
</param>
<options from_file="/depot/data2/galaxy/encode_datasets.loc">
<filter type="param" name="encode_group" value="GENCODE" />
<filter type="param" name="build" value="hg17" />
</options>
</param>
<param name="hg16" type="select" display="checkboxes" multiple="true">
<select_options from_file="/depot/data2/galaxy/encode_datasets.loc" func="get_options_for_encode">
<func_param name="encode_group" value="GENCODE" />
<func_param name="build" value="hg16" />
</select_options>
</param>
<options from_file="/depot/data2/galaxy/encode_datasets.loc">
<filter type="param" name="encode_group" value="GENCODE" />
<filter type="param" name="build" value="hg16" />
</options>
</param>
</inputs>
<outputs>
<data format="bed" name="output"/>
@@ -6,17 +6,17 @@
<p><div class="toolFormTitle">hg16 (most recent datasets in bold)</div>$hg16</p>
</display>
<param name="hg17" type="select" display="checkboxes" multiple="true">
<select_options from_file="/depot/data2/galaxy/encode_datasets.loc" func="get_options_for_encode">
<func_param name="encode_group" value="GT" />
<func_param name="build" value="hg17" />
</select_options>
</param>
<options from_file="/depot/data2/galaxy/encode_datasets.loc">
<filter type="param" name="encode_group" value="GT" />
<filter type="param" name="build" value="hg17" />
</options>
</param>
<param name="hg16" type="select" display="checkboxes" multiple="true">
<select_options from_file="/depot/data2/galaxy/encode_datasets.loc" func="get_options_for_encode">
<func_param name="encode_group" value="GT" />
<func_param name="build" value="hg16" />
</select_options>
</param>
<options from_file="/depot/data2/galaxy/encode_datasets.loc">
<filter type="param" name="encode_group" value="GT" />
<filter type="param" name="build" value="hg16" />
</options>
</param>
</inputs>
<outputs>
<data format="bed" name="output"/>
@@ -6,17 +6,17 @@
<p><div class="toolFormTitle">hg16 (most recent datasets in bold)</div>$hg16</p>
</display>
<param name="hg17" type="select" display="checkboxes" multiple="true">
<select_options from_file="/depot/data2/galaxy/encode_datasets.loc" func="get_options_for_encode">
<func_param name="encode_group" value="MSA" />
<func_param name="build" value="hg17" />
</select_options>
</param>
<options from_file="/depot/data2/galaxy/encode_datasets.loc">
<filter type="param" name="encode_group" value="MSA" />
<filter type="param" name="build" value="hg17" />
</options>
</param>
<param name="hg16" type="select" display="checkboxes" multiple="true">
<select_options from_file="/depot/data2/galaxy/encode_datasets.loc" func="get_options_for_encode">
<func_param name="encode_group" value="MSA" />
<func_param name="build" value="hg16" />
</select_options>
</param>
<options from_file="/depot/data2/galaxy/encode_datasets.loc">
<filter type="param" name="encode_group" value="MSA" />
<filter type="param" name="build" value="hg16" />
</options>
</param>
</inputs>
<outputs>
<data format="bed" name="output"/>
@@ -6,17 +6,17 @@
<p><div class="toolFormTitle">hg16 (most recent datasets in bold)</div>$hg16</p>
</display>
<param name="hg17" type="select" display="checkboxes" multiple="true">
<select_options from_file="/depot/data2/galaxy/encode_datasets.loc" func="get_options_for_encode">
<func_param name="encode_group" value="TR" />
<func_param name="build" value="hg17" />
</select_options>
</param>
<options from_file="/depot/data2/galaxy/encode_datasets.loc">
<filter type="param" name="encode_group" value="TR" />
<filter type="param" name="build" value="hg17" />
</options>
</param>
<param name="hg16" type="select" display="checkboxes" multiple="true">
<select_options from_file="/depot/data2/galaxy/encode_datasets.loc" func="get_options_for_encode">
<func_param name="encode_group" value="TR" />
<func_param name="build" value="hg16" />
</select_options>
</param>
<options from_file="/depot/data2/galaxy/encode_datasets.loc">
<filter type="param" name="encode_group" value="TR" />
<filter type="param" name="build" value="hg16" />
</options>
</param>
</inputs>
<outputs>
<data format="bed" name="output"/>
+72 -25
View File
@@ -2,35 +2,82 @@
<command interpreter="python">microbial_import.py $CDS,$tRNA,$rRNA,$sequence,$GeneMark,$GeneMarkHMM,$Glimmer3 $output</command>
<inputs>
<page>
<display>
<p><div class="toolFormTitle">Select the Desired Kingdom</div>$kingdom</p>
</display>
<param name="kingdom" type="select" display="radio" multiple="False" dynamic_options="get_kingdoms()"/>
<display>
<p><div class="toolFormTitle">Select the Desired Kingdom</div>$kingdom</p>
</display>
<param name="kingdom" type="select" display="radio">
<select_options func="get_options_for_kingdoms" />
</param>
</page>
<page>
<display>
<p><div class="toolFormTitle">Select the Desired Organism</div>$org</p>
</display>
<param name="org" type="select" display="radio" multiple="False" dynamic_options="get_orgs_by_kingdom(kingdom)"/>
<display>
<p><div class="toolFormTitle">Select the Desired Organism</div>$org</p>
</display>
<param name="org" type="select" display="radio">
<select_options func="get_options_for_orgs_by_kingdom">
<func_param name="kingdom" value="kingdom" />
</select_options>
</param>
</page>
<page>
<display>
<p><div class="toolFormTitle">Select Desired Coding Sequences</div>$CDS</p>
<p><div class="toolFormTitle">Select Desired tRNA</div>$tRNA</p>
<p><div class="toolFormTitle">Select Desired rRNA</div>$rRNA</p>
<p><div class="toolFormTitle">Select Desired DNA Sequences</div>$sequence</p>
<p><div class="toolFormTitle">Select Desired GeneMark Annotations</div>$GeneMark</p>
<p><div class="toolFormTitle">Select Desired GeneMarkHMM Annotations</div>$GeneMarkHMM</p>
<p><div class="toolFormTitle">Select Desired Glimmer3 Annotations</div>$Glimmer3</p>
<p></p>
</display>
<param name="CDS" type="select" display="checkboxes" multiple="True" dynamic_options="get_data_by_kingdom_org_feature(kingdom,org,'CDS')"/>
<param name="tRNA" type="select" display="checkboxes" multiple="True" dynamic_options="get_data_by_kingdom_org_feature(kingdom,org,'tRNA')"/>
<param name="rRNA" type="select" display="checkboxes" multiple="True" dynamic_options="get_data_by_kingdom_org_feature(kingdom,org,'rRNA')"/>
<param name="sequence" type="select" display="checkboxes" multiple="True" dynamic_options="get_data_by_kingdom_org_feature(kingdom,org,'sequence')"/>
<param name="GeneMark" type="select" display="checkboxes" multiple="True" dynamic_options="get_data_by_kingdom_org_feature(kingdom,org,'GeneMark')"/>
<param name="GeneMarkHMM" type="select" display="checkboxes" multiple="True" dynamic_options="get_data_by_kingdom_org_feature(kingdom,org,'GeneMarkHMM')"/>
<param name="Glimmer3" type="select" display="checkboxes" multiple="True" dynamic_options="get_data_by_kingdom_org_feature(kingdom,org,'Glimmer3')"/>
<display>
<p><div class="toolFormTitle">Select Desired Coding Sequences</div>$CDS</p>
<p><div class="toolFormTitle">Select Desired tRNA</div>$tRNA</p>
<p><div class="toolFormTitle">Select Desired rRNA</div>$rRNA</p>
<p><div class="toolFormTitle">Select Desired DNA Sequences</div>$sequence</p>
<p><div class="toolFormTitle">Select Desired GeneMark Annotations</div>$GeneMark</p>
<p><div class="toolFormTitle">Select Desired GeneMarkHMM Annotations</div>$GeneMarkHMM</p>
<p><div class="toolFormTitle">Select Desired Glimmer3 Annotations</div>$Glimmer3</p>
</display>
<param name="CDS" type="select" display="checkboxes" multiple="True">
<select_options func="get_options_for_kingdom_org_feature">
<func_param name="kingdom" value="kingdom" />
<func_param name="org" value="org" />
<func_param name="feature" value="CDS" />
</select_options>
</param>
<param name="tRNA" type="select" display="checkboxes" multiple="True">
<select_options func="get_options_for_kingdom_org_feature">
<func_param name="kingdom" value="kingdom" />
<func_param name="org" value="org" />
<func_param name="feature" value="tRNA" />
</select_options>
</param>
<param name="rRNA" type="select" display="checkboxes" multiple="True">
<select_options func="get_options_for_kingdom_org_feature">
<func_param name="kingdom" value="kingdom" />
<func_param name="org" value="org" />
<func_param name="feature" value="rRNA" />
</select_options>
</param>
<param name="sequence" type="select" display="checkboxes" multiple="True">
<select_options func="get_options_for_kingdom_org_feature">
<func_param name="kingdom" value="kingdom" />
<func_param name="org" value="org" />
<func_param name="feature" value="sequence" />
</select_options>
</param>
<param name="GeneMark" type="select" display="checkboxes" multiple="True">
<select_options func="get_options_for_kingdom_org_feature">
<func_param name="kingdom" value="kingdom" />
<func_param name="org" value="org" />
<func_param name="feature" value="GeneMark" />
</select_options>
</param>
<param name="GeneMarkHMM" type="select" display="checkboxes" multiple="True">
<select_options func="get_options_for_kingdom_org_feature">
<func_param name="kingdom" value="kingdom" />
<func_param name="org" value="org" />
<func_param name="feature" value="GeneMarkHMM" />
</select_options>
</param>
<param name="Glimmer3" type="select" display="checkboxes" multiple="True">
<select_options func="get_options_for_kingdom_org_feature">
<func_param name="kingdom" value="kingdom" />
<func_param name="org" value="org" />
<func_param name="feature" value="Glimmer3" />
</select_options>
</param>
</page>
</inputs>
<outputs>
+6 -201
View File
@@ -1,200 +1,4 @@
#build list of available data
import os, sys
microbe_info= {}
def init():
try:
orgs = {}
for line in open( "/depot/data2/galaxy/microbes/microbial_data.loc" ):
if line[0:1] == "#" : continue
fields = line.split('\t')
#read each line, if not enough fields, go to next line
try:
info_type = fields.pop(0)
if info_type.upper() == "ORG":
#ORG 12521 Clostridium perfringens SM101 bacteria Firmicutes CP000312,CP000313,CP000314,CP000315 http://www.ncbi.nlm.nih.gov/entrez/query.fcgi?db=genomeprj&cmd=Retrieve&dopt=Overview&list_uids=12521
org_num = fields.pop(0)
name = fields.pop(0)
kingdom = fields.pop(0)
group = fields.pop(0)
chromosomes = fields.pop(0)
info_url = fields.pop(0)
link_site = fields.pop(0).replace("\r","").replace("\n","")
if org_num not in orgs:
orgs[org_num]={}
orgs[org_num]['chrs']={}
orgs[org_num]['name']= name
orgs[org_num]['kingdom']= kingdom
orgs[org_num]['group']= group
orgs[org_num]['chromosomes']= chromosomes
orgs[org_num]['info_url']= info_url
orgs[org_num]['link_site']= link_site
elif info_type.upper() == "CHR":
#CHR 12521 CP000315 Clostridium perfringens phage phiSM101, complete genome 38092 110684521 CP000315.1
org_num = fields.pop(0)
chr_acc = fields.pop(0)
name = fields.pop(0)
length = fields.pop(0)
gi = fields.pop(0)
gb = fields.pop(0)
info_url = fields.pop(0).replace("\r","").replace("\n","")
chr = {}
chr['name']=name
chr['length']=length
chr['gi']=gi
chr['gb']=gb
chr['info_url']=info_url
if org_num not in orgs:
orgs[org_num]={}
orgs[org_num]['chrs']={}
orgs[org_num]['chrs'][chr_acc] = chr
elif info_type.upper() == "DATA":
#DATA 12521_12521_CDS 12521 CP000315 CDS bed /home/djb396/alignments/playground/bacteria/12521/CP000315.CDS.bed
uid = fields.pop(0)
org_num = fields.pop(0)
chr_acc = fields.pop(0)
feature = fields.pop(0)
filetype = fields.pop(0)
path = fields.pop(0).replace("\r","").replace("\n","")
data = {}
data['filetype']=filetype
data['path']=path
data['feature']=feature
if org_num not in orgs:
orgs[org_num]={}
orgs[org_num]['chrs']={}
if 'data' not in orgs[org_num]['chrs'][chr_acc]:
orgs[org_num]['chrs'][chr_acc]['data']={}
orgs[org_num]['chrs'][chr_acc]['data'][uid] = data
else: continue
except:
continue
for org_num in orgs:
org = orgs[org_num]
if org['kingdom'] not in microbe_info:
microbe_info[org['kingdom']]={}
#if org['group'] not in microbe_info[org['kingdom']]:
# microbe_info[org['kingdom']][org['group']]={}
if org_num not in microbe_info[org['kingdom']]:
microbe_info[org['kingdom']][org_num]=org
except Exception, exc:
print >>sys.stdout, 'microbial_import_code.py initialization error -> %s' % exc
init()
def get_kingdoms():
ret_val = []
kingdoms = microbe_info.keys()
kingdoms.sort()
for kingdom in kingdoms:
ret_val.append((kingdom,kingdom,False))
if ret_val:
ret_val[0]= (ret_val[0][0],ret_val[0][1],True)
return ret_val
def get_orgs_by_kingdom(kingdom):
ret_val = []
orgs = microbe_info[kingdom].keys()
#need to sort by name
swap_test = False
for i in range(0, len(orgs) - 1):
for j in range(0, len(orgs) - i - 1):
if microbe_info[kingdom][orgs[j]]['name'] > microbe_info[kingdom][orgs[j + 1]]['name']:
orgs[j], orgs[j + 1] = orgs[j + 1], orgs[j]
swap_test = True
if swap_test == False:
break
for org in orgs:
if microbe_info[kingdom][org]['link_site'] == "UCSC":
ret_val.append(("<b>"+microbe_info[kingdom][org]['name']+"</b> <a href=\""+microbe_info[kingdom][org]['info_url']+"\" target=\"_blank\">(about)</a>",org,False))
else:
ret_val.append((microbe_info[kingdom][org]['name']+" <a href=\""+microbe_info[kingdom][org]['info_url']+"\" target=\"_blank\">(about)</a>",org,False))
if ret_val:
ret_val[0]= (ret_val[0][0],ret_val[0][1],True)
return ret_val
def get_data(kingdom,group,org,feature):
ret_val = []
chroms = microbe_info[kingdom][group][org]['chrs'].keys()
chroms.sort()
for chr in chroms:
for data in microbe_info[kingdom][group][org]['chrs'][chr]['data']:
if microbe_info[kingdom][group][org]['chrs'][chr]['data'][data]['feature']==feature:
ret_val.append((microbe_info[kingdom][group][org]['chrs'][chr]['name']+" <a href=\""+microbe_info[kingdom][group][org]['chrs'][chr]['info_url']+"\" target=\"_blank\">(about)</a>",data,False))
return ret_val
def get_groups(kingdom):
ret_val = []
groups = microbe_info[kingdom].keys()
groups.sort()
for group in groups:
ret_val.append((group,group,False))
if ret_val:
ret_val[0]= (ret_val[0][0],ret_val[0][1],True)
return ret_val
def get_orgs(kingdom,group):
ret_val = []
orgs = microbe_info[kingdom][group].keys()
#need to sort by name
swap_test = False
for i in range(0, len(orgs) - 1):
for j in range(0, len(orgs) - i - 1):
if microbe_info[kingdom][group][orgs[j]]['name'] > microbe_info[kingdom][group][orgs[j + 1]]['name']:
orgs[j], orgs[j + 1] = orgs[j + 1], orgs[j]
swap_test = True
if swap_test == False:
break
for org in orgs:
if microbe_info[kingdom][group][org]['link_site'] == "UCSC":
ret_val.append(("<b>"+microbe_info[kingdom][group][org]['name']+"</b> <a href=\""+microbe_info[kingdom][group][org]['info_url']+"\" target=\"_blank\">(about)</a>",org,False))
else:
ret_val.append((microbe_info[kingdom][group][org]['name']+" <a href=\""+microbe_info[kingdom][group][org]['info_url']+"\" target=\"_blank\">(about)</a>",org,False))
if ret_val:
ret_val[0]= (ret_val[0][0],ret_val[0][1],True)
return ret_val
def get_data(kingdom,group,org,feature):
ret_val = []
chroms = microbe_info[kingdom][group][org]['chrs'].keys()
chroms.sort()
for chr in chroms:
for data in microbe_info[kingdom][group][org]['chrs'][chr]['data']:
if microbe_info[kingdom][group][org]['chrs'][chr]['data'][data]['feature']==feature:
ret_val.append((microbe_info[kingdom][group][org]['chrs'][chr]['name']+" <a href=\""+microbe_info[kingdom][group][org]['chrs'][chr]['info_url']+"\" target=\"_blank\">(about)</a>",data,False))
return ret_val
def get_data_by_kingdom_org_feature(kingdom,org,feature):
ret_val = []
chroms = microbe_info[kingdom][org]['chrs'].keys()
chroms.sort()
for chr in chroms:
for data in microbe_info[kingdom][org]['chrs'][chr]['data']:
if microbe_info[kingdom][org]['chrs'][chr]['data'][data]['feature']==feature:
ret_val.append((microbe_info[kingdom][org]['chrs'][chr]['name']+" <a href=\""+microbe_info[kingdom][org]['chrs'][chr]['info_url']+"\" target=\"_blank\">(about)</a>",data,False))
return ret_val
#post processing, set build for data and add additional data to history
from galaxy import datatypes, config, jobs
from shutil import copyfile
@@ -203,11 +7,12 @@ def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr
if history == None:
print "unknown history!"
return
kingdom = param_dict.get('kingdom',None)
group = param_dict.get('group',None)
org = param_dict.get('org',None)
kingdom = param_dict.get( 'kingdom', None )
#group = param_dict.get( 'group', None )
org = param_dict.get( 'org', None )
if not (kingdom or group or org):
#if not (kingdom or group or org):
if not (kingdom or org):
print "Parameters are not available."
new_stdout = ""
@@ -222,7 +27,7 @@ def exec_after_process(app, inp_data, out_data, param_dict, tool, stdout, stderr
file_type = fields[4]
name, data = out_data.items()[0]
basic_name = data.name
data.name = data.name + " (" + microbe_info[kingdom][org]['chrs'][chr]['data'][description]['feature'] +" for "+microbe_info[kingdom][org]['name']+":"+chr + ")"
data.name = data.name + " (" + microbe_info[kingdom][org]['chrs'][chr]['data'][description]['feature'] +" for " + microbe_info[kingdom][org]['name'] + ":" + chr + ")"
data.dbkey = dbkey
data.info = data.name
data = app.datatypes_registry.change_datatype( data, file_type )
+5 -2
View File
@@ -14,8 +14,11 @@
<option value="none">None</option>
</param>
<param name="regions" type="select" label="Regions to use">
<options from_file="/depot/data2/galaxy/regions.loc" name_col="1" value_col="2" >
<filter type="data_meta" data_ref="input1" key="build" value="dbkey" col="0" />
<options from_file="/depot/data2/galaxy/regions.loc" >
<filter type="data_meta" data_ref="input1" key="build" />
<filter type="column" name="build_col" value="0" />
<filter type="column" name="name_col" value="1" />
<filter type="column" name="value_col" value="2" />
</options>
</param>
</inputs>
+5 -2
View File
@@ -4,8 +4,11 @@
<inputs>
<param format="interval" name="input" type="data" label="Between regions of Query"/>
<param name="species" type="select" label="and one of these genomes">
<options from_file="/depot/data2/galaxy/alignseq.loc" name_col="1" value_col="2" >
<filter type="data_meta" data_ref="input" key="build" value="dbkey" col="0" />
<options from_file="/depot/data2/galaxy/alignseq.loc" >
<filter type="data_meta" data_ref="input" key="build" />
<filter type="column" name="build_col" value="0" />
<filter type="column" name="name_col" value="1" />
<filter type="column" name="value_col" value="2" />
</options>
</param>
</inputs>
+34 -31
View File
@@ -12,39 +12,44 @@
<option value="7">Column 8 / Frame</option>
</param>
<when value="0">
<param name="feature" label="Select features" type="select" multiple="true">
<select_options data_ref="input1" func="get_options_for_features">
<func_param name="index" value="0" />
</select_options>
</param>
<param name="feature" type="select" multiple="true" label="Select features" >
<options>
<filter type="data_meta" data_ref="input1" key="file_name" />
<filter type="column" name="value_col" value="0" />
</options>
</param>
</when>
<when value="1">
<param name="feature" label="Select features" type="select" multiple="true">
<select_options data_ref="input1" func="get_options_for_features">
<func_param name="index" value="1" />
</select_options>
</param>
</when>
<when value="2">
<param name="feature" label="Select features" type="select" multiple="true">
<select_options data_ref="input1" func="get_options_for_features">
<func_param name="index" value="2" />
</select_options>
<param name="feature" type="select" multiple="true" label="Select features" >
<options>
<filter type="data_meta" data_ref="input1" key="file_name" />
<filter type="column" name="value_col" value="1" />
</options>
</param>
</when>
<when value="6">
<param name="feature" label="Select features" type="select" multiple="true">
<select_options data_ref="input1" func="get_options_for_features">
<func_param name="index" value="6" />
</select_options>
<when value="2">
<param name="feature" type="select" multiple="true" label="Select features" >
<options>
<filter type="data_meta" data_ref="input1" key="file_name" />
<filter type="column" name="value_col" value="2" />
</options>
</param>
</when>
<when value="6">
<param name="feature" type="select" multiple="true" label="Select features" >
<options>
<filter type="data_meta" data_ref="input1" key="file_name" />
<filter type="column" name="value_col" value="6" />
</options>
</param>
</when>
<when value="7">
<param name="feature" label="Select features" type="select" multiple="true">
<select_options data_ref="input1" func="get_options_for_features">
<func_param name="index" value="7" />
</select_options>
</param>
<param name="feature" type="select" multiple="true" label="Select features" >
<options>
<filter type="data_meta" data_ref="input1" key="file_name" />
<filter type="column" name="value_col" value="7" />
</options>
</param>
</when>
</conditional>
<!--
@@ -57,16 +62,14 @@
<outputs>
<data format="gff" name="out_file1" />
</outputs>
<!--
<tests>
<test>
<param name="input1" value="5.gff"/>
<param name="column_choice" value="0 chr5" />
<param name="column_choice|feature" value="chr5,chr6,chr7,chr8" />
<output name="out_file1" file="gff_features.gff"/>
<param name="col" value="0" />
<param name="feature" value="chr5,chr6,chr7,chr8" />
<output name="out_file1" file="Extract_features1_out.gff"/>
</test>
</tests>
-->
<help>
**What it does**
+15 -8
View File
@@ -14,19 +14,26 @@
<when value="user">
<param name="maf_file" type="data" format="maf" label="MAF File" />
<param name="species" type="select" display="checkboxes" multiple="true" label="Choose species" help="Select species to be included in the final alignment">
<select_options data_ref="maf_file" func="get_options_for_species_for_maf">
<func_param name="maf_source" value="user" />
</select_options>
<options>
<filter type="data_meta" data_ref="maf_file" key="maf" />
<filter type="param" name="maf_source" value="user" />
</options>
</param>
</when>
<when value="cached">
<param name="maf_identifier" type="select" label="MAF Type" >
<select_options from_file="/depot/data2/galaxy/maf_index.loc" data_ref="input1" func="get_options_for_maf" />
</param>
<options from_file="/depot/data2/galaxy/maf_index.loc" >
<filter type="data_meta" data_ref="input1" key="build" />
<filter type="column" name="build_col" value="2" />
<filter type="column" name="name_col" value="0" />
<filter type="column" name="value_col" value="1" />
</options>
</param>
<param name="species" type="select" display="checkboxes" multiple="true" label="Choose species" help="Select species to be included in the final alignment">
<select_options param_ref="maf_identifier" from_file="/depot/data2/galaxy/maf_index.loc" func="get_options_for_species_for_maf">
<func_param name="maf_source" value="cached" />
</select_options>
<options from_file="/depot/data2/galaxy/maf_index.loc">
<filter type="param_meta" param_ref="maf_identifier" key="maf" />
<filter type="param" name="maf_source" value="cached" />
</options>
</param>
</when>
</conditional>
+42 -36
View File
@@ -1,44 +1,50 @@
<tool id="Interval2Maf1" name="Extract MAF blocks">
<description>given a set of genomic intervals</description>
<command interpreter="python2.4">#if $maf_source_type.maf_source == "user":#interval2maf.py --dbkey=$input1_dbkey --chromCol=$input1_chromCol --startCol=$input1_startCol --endCol=$input1_endCol --strandCol=$input1_strandCol --mafFile=$maf_source_type.mafFile --interval_file=$input1 --output_file=$out_file1
#else:#interval2maf.py --dbkey=$input1_dbkey --chromCol=$input1_chromCol --startCol=$input1_startCol --endCol=$input1_endCol --strandCol=$input1_strandCol --mafType=$maf_source_type.mafType --interval_file=$input1 --output_file=$out_file1
#end if
<command interpreter="python2.4">
#if $maf_source_type.maf_source == "user":#interval2maf.py --dbkey=$input1_dbkey --chromCol=$input1_chromCol --startCol=$input1_startCol --endCol=$input1_endCol --strandCol=$input1_strandCol --mafFile=$maf_source_type.mafFile --interval_file=$input1 --output_file=$out_file1
#else:#interval2maf.py --dbkey=$input1_dbkey --chromCol=$input1_chromCol --startCol=$input1_startCol --endCol=$input1_endCol --strandCol=$input1_strandCol --mafType=$maf_source_type.mafType --interval_file=$input1 --output_file=$out_file1
#end if
</command>
<inputs>
<param format="interval" name="input1" type="data" label="Choose intervals"/>
<conditional name="maf_source_type">
<param name="maf_source" type="select" label="MAF Source">
<option value="cached" selected="true">Locally Cached Alignments</option>
<option value="user">Alignments in Your History</option>
</param>
<when value="user">
<param format="maf" name="mafFile" label="Choose alignments" type="data"/>
</when>
<when value="cached">
<param name="mafType" label="Choose alignments" type="select">
<select_options from_file="/depot/data2/galaxy/maf_index.loc" data_ref="input1" func="get_options_for_maf"/>
</param>
</when>
</conditional>
<param format="interval" name="input1" type="data" label="Choose intervals"/>
<conditional name="maf_source_type">
<param name="maf_source" type="select" label="MAF Source">
<option value="cached" selected="true">Locally Cached Alignments</option>
<option value="user">Alignments in Your History</option>
</param>
<when value="user">
<param format="maf" name="mafFile" label="Choose alignments" type="data"/>
</when>
<when value="cached">
<param name="mafType" type="select" label="Choose alignments">
<options from_file="/depot/data2/galaxy/maf_index.loc" >
<filter type="data_meta" data_ref="input1" key="build" />
<filter type="column" name="build_col" value="2" />
<filter type="column" name="name_col" value="0" />
<filter type="column" name="value_col" value="1" />
</options>
</param>
</when>
</conditional>
</inputs>
<outputs>
<data format="maf" name="out_file1"/>
</outputs>
<tests>
<test>
<param name="input1" value="1.bed"/>
<param name="maf_source" value="cached"/>
<param name="mafType" value="ENCODE_TBA_hg17"/>
<output name="out_file1" file="fsa_interval2maf.dat" />
</test>
<test>
<param name="input1" value="1.bed"/>
<param name="maf_source" value="user"/>
<param name="mafFile" value="fsa_interval2maf.dat"/>
<output name="out_file1" file="fsa_interval2maf.dat" />
</test>
</tests>
<help>
<outputs>
<data format="maf" name="out_file1"/>
</outputs>
<tests>
<test>
<param name="input1" value="1.bed"/>
<param name="maf_source" value="cached"/>
<param name="mafType" value="ENCODE_TBA_hg17"/>
<output name="out_file1" file="fsa_interval2maf.dat" />
</test>
<test>
<param name="input1" value="1.bed"/>
<param name="maf_source" value="user"/>
<param name="mafFile" value="fsa_interval2maf.dat"/>
<output name="out_file1" file="fsa_interval2maf.dat" />
</test>
</tests>
<help>
**What it does**
This tool takes genomic coordinates, superimposes them on multiple alignments (in MAF format) stored on the Galaxy site or from your history, and excises alignment blocks corresponding to each set of coordinates. Alignment blocks that extend past START and/or END positions of an interval are trimmed. Note that a single genomic interval may correspond to two or more alignment blocks.
+18 -11
View File
@@ -15,20 +15,27 @@
<when value="user">
<param name="maf_file" type="data" format="maf" label="MAF File" />
<param name="species" type="select" display="checkboxes" multiple="true" label="Choose species" help="Select species to be included in the final alignment">
<select_options data_ref="maf_file" func="get_options_for_species_for_maf">
<func_param name="maf_source" value="user" />
</select_options>
<options>
<filter type="data_meta" data_ref="maf_file" key="maf" />
<filter type="param" name="maf_source" value="user" />
</options>
</param>
</when>
<when value="cached">
<param name="maf_identifier" type="select" label="MAF Type" >
<select_options from_file="/depot/data2/galaxy/maf_index.loc" data_ref="input1" func="get_options_for_maf" />
</param>
<param name="species" type="select" display="checkboxes" multiple="true" label="Choose species" help="Select species to be included in the final alignment">
<select_options param_ref="maf_identifier" from_file="/depot/data2/galaxy/maf_index.loc" func="get_options_for_species_for_maf">
<func_param name="maf_source" value="cached" />
</select_options>
</param>
<param name="maf_identifier" type="select" label="MAF Type">
<options from_file="/depot/data2/galaxy/maf_index.loc" >
<filter type="data_meta" data_ref="input1" key="build" />
<filter type="column" name="build_col" value="2" />
<filter type="column" name="name_col" value="0" />
<filter type="column" name="value_col" value="1" />
</options>
</param>
<param name="species" type="select" display="checkboxes" multiple="true" label="Choose species" help="Select species to be included in the final alignment">
<options from_file="/depot/data2/galaxy/maf_index.loc">
<filter type="param_meta" param_ref="maf_identifier" key="maf" />
<filter type="param" name="maf_source" value="cached" />
</options>
</param>
</when>
</conditional>
</page>
+5 -2
View File
@@ -4,8 +4,11 @@
<inputs>
<param format="interval" name="input" type="data" label="Interval file"/>
<param name="score_file" type="select" label="Available datasets">
<options from_file="/depot/data2/galaxy/phastOdds.loc" name_col="1" value_col="2" >
<filter type="data_meta" data_ref="input" key="build" value="dbkey" col="0" />
<options from_file="/depot/data2/galaxy/phastOdds.loc" >
<filter type="data_meta" data_ref="input" key="build" />
<filter type="column" name="build_col" value="0" />
<filter type="column" name="name_col" value="1" />
<filter type="column" name="value_col" value="2" />
</options>
</param>
<param name="per_col" type="boolean" label="Standardize" help="Standardizes the score to be per alignment column" checked="yes" truevalue="-p" falsevalue=""/>
+8 -2
View File
@@ -4,10 +4,16 @@
<inputs>
<param format="axt" name="axt_input" type="data" label="AXT file"/>
<param name="dbkey_1" type="select" label="Genome">
<options from_file="static/ucsc/builds.txt" name_col="1" value_col="0" />
<options from_file="static/ucsc/builds.txt" >
<filter type="column" name="name_col" value="1" />
<filter type="column" name="value_col" value="0" />
</options>
</param>
<param name="dbkey_2" type="select" label="Genome">
<options from_file="static/ucsc/builds.txt" name_col="1" value_col="0" />
<options from_file="static/ucsc/builds.txt" >
<filter type="column" name="name_col" value="1" />
<filter type="column" name="value_col" value="0" />
</options>
</param>
</inputs>
<outputs>
+8 -2
View File
@@ -4,10 +4,16 @@
<inputs>
<param format="axt" name="axt_input" type="data" label="AXT file"/>
<param name="dbkey_1" type="select" label="Genome">
<options from_file="static/ucsc/builds.txt" name_col="1" value_col="0" />
<options from_file="static/ucsc/builds.txt" >
<filter type="column" name="name_col" value="1" />
<filter type="column" name="value_col" value="0" />
</options>
</param>
<param name="dbkey_2" type="select" label="Genome">
<options from_file="static/ucsc/builds.txt" name_col="1" value_col="0" />
<options from_file="static/ucsc/builds.txt" >
<filter type="column" name="name_col" value="1" />
<filter type="column" name="value_col" value="0" />
</options>
</param>
</inputs>
<outputs>
+8 -2
View File
@@ -5,10 +5,16 @@
<inputs>
<param name="align_input" type="data" format="axt" label="Alignment File" optional="False"/>
<param name="dbkey_1" type="select" label="Genome">
<options from_file="static/ucsc/builds.txt" name_col="1" value_col="0" />
<options from_file="static/ucsc/builds.txt" >
<filter type="column" name="name_col" value="1" />
<filter type="column" name="value_col" value="0" />
</options>
</param>
<param name="dbkey_2" type="select" label="Genome">
<options from_file="static/ucsc/builds.txt" name_col="1" value_col="0" />
<options from_file="static/ucsc/builds.txt" >
<filter type="column" name="name_col" value="1" />
<filter type="column" name="value_col" value="0" />
</options>
</param>
</inputs>
<outputs>
+15 -3
View File
@@ -5,7 +5,11 @@
<page>
<param name="input1" type="data" format="maf" label="MAF File"/>
<repeat name="maf_filters" title="Filter">
<param name="species1" type="select" label="When Species" multiple="false"><select_options data_ref="input1" func="get_options_for_species"/></param>
<param name="species1" type="select" label="When Species" multiple="false">
<options>
<filter type="data_meta" data_ref="input1" key="species" />
</options>
</param>
<conditional name="species1_attributes">
<param name="species1_attribute_type" type="select" label="Species Attribute">
<option value="attribute_strand">Strand</option>
@@ -21,7 +25,11 @@
<option value="-">-</option>
</param>
<repeat name="filter_condition" title="Filter Condition">
<param name="species2" type="select" label="Species" multiple="false"><select_options data_ref="input1" func="get_options_for_species"/></param>
<param name="species2" type="select" label="Species" multiple="false">
<options>
<filter type="data_meta" data_ref="input1" key="species" />
</options>
</param>
<conditional name="species2_attributes">
<param name="species2_attribute_type" type="select" label="Species Attribute">
<option value="attribute_strand" selected="true">Strand</option>
@@ -54,7 +62,11 @@
</param>
<param name="species1_attribute" type="text" label="Chromosome" value="chr1"/>
<repeat name="filter_condition" title="Filter Condition">
<param name="species2" type="select" label="Species" multiple="false"><select_options data_ref="input1" func="get_options_for_species"/></param>
<param name="species2" type="select" label="Species" multiple="false">
<options>
<filter type="data_meta" data_ref="input1" key="species" />
</options>
</param>
<conditional name="species2_attributes">
<param name="species2_attribute_type" type="select" label="Species Attribute">
<option value="attribute_strand">Strand</option>
+3 -1
View File
@@ -12,7 +12,9 @@
<option value="0">No</option>
</param>
<param name="species" type="select" label="Species to keep" display="checkboxes" multiple="true">
<select_options data_ref="input1" func="get_options_for_species" />
<options>
<filter type="data_meta" data_ref="input1" key="species" />
</options>
</param>
</inputs>
<outputs>
+8 -3
View File
@@ -19,9 +19,14 @@
<param format="maf" name="input2" label="MAF File" type="data"/>
</when>
<when value="cached">
<param name="mafType" label="MAF Type" type="select">
<select_options from_file="/depot/data2/galaxy/maf_index.loc" data_ref="input1" func="get_options_for_maf" />
</param>
<param name="mafType" type="select" label="MAF Type">
<options from_file="/depot/data2/galaxy/maf_index.loc" >
<filter type="data_meta" data_ref="input1" key="build" />
<filter type="column" name="build_col" value="2" />
<filter type="column" name="name_col" value="0" />
<filter type="column" name="value_col" value="1" />
</options>
</param>
</when>
</conditional>
<param name="summary" type="select" label="Type of Output">
+3 -1
View File
@@ -4,7 +4,9 @@
<inputs>
<param format="maf" name="input1" type="data" label="MAF file"/>
<param name="species" type="select" label="Species to keep" display="checkboxes" multiple="true">
<select_options data_ref="input1" func="get_options_for_species" />
<options>
<filter type="data_meta" data_ref="input1" key="species" />
</options>
</param>
</inputs>
<outputs>
+3 -1
View File
@@ -4,7 +4,9 @@
<inputs>
<param format="maf" name="input1" type="data" label="MAF file to convert"/>
<param name="species" type="select" label="Select species" display="checkboxes" multiple="true" help="a separate history item will be created for each checked species">
<select_options data_ref="input1" func="get_options_for_species" />
<options>
<filter type="data_meta" data_ref="input1" key="species" />
</options>
</param>
<param name="complete_blocks" type="select" label="Exclude blocks which have a requested species missing">
<option value="partial_allowed">include blocks with missing species</option>
+6 -2
View File
@@ -14,7 +14,9 @@
</param>
<when value="multiple">
<param name="species" type="select" label="Select species" display="checkboxes" multiple="true" help="checked taxa will be included in the output">
<select_options data_ref="input1" func="get_options_for_species" />
<options>
<filter type="data_meta" data_ref="input1" key="species" />
</options>
</param>
<param name="complete_blocks" type="select" label="Choose to">
<option value="partial_allowed">include blocks with missing species</option>
@@ -23,7 +25,9 @@
</when>
<when value="concatenated">
<param name="species" type="select" label="Species to extract" display="checkboxes" multiple="true">
<select_options data_ref="input1" func="get_options_for_species" />
<options>
<filter type="data_meta" data_ref="input1" key="species" />
</options>
</param>
</when>
</conditional>
+3 -1
View File
@@ -7,7 +7,9 @@
<page>
<param format="maf" name="input1" type="data" label="Select data"/>
<param name="outgroup" type="select" label="Select outgroup species">
<select_options data_ref="input1" func="get_options_for_species" />
<options>
<filter type="data_meta" data_ref="input1" key="species" />
</options>
</param>
</page>
</inputs>
+6 -2
View File
@@ -19,10 +19,14 @@
<inputs>
<param format="maf" name="input" type="data" label="Select data"/>
<param name="primary_species" type="select" label="Use quality scores of" display="checkboxes" multiple="true">
<select_options data_ref="input" func="get_options_for_species" />
<options>
<filter type="data_meta" data_ref="input1" key="species" />
</options>
</param>
<param name="mask_species" type="select" label="Mask Species" display="checkboxes" multiple="true">
<select_options data_ref="input" func="get_options_for_species" />
<options>
<filter type="data_meta" data_ref="input1" key="species" />
</options>
</param>
<param name="score" size="10" type="integer" value="20" label="Quality score cut-off" help="Cut-off value of 20 means mask all nucleotides having quality score less than or equal to 20"/>
<param name="mask_char" size="5" type="select" label="Mask character">
@@ -4,8 +4,11 @@
<inputs>
<param format="interval" name="input1" type="data" label="Interval file"/>
<param name="datasets" type="select" label="Available datasets" display="radio">
<options from_file="/depot/data2/galaxy/binned_scores.loc" name_col="1" value_col="2" >
<filter type="data_meta" data_ref="input1" key="build" value="dbkey" col="0" />
<options from_file="/depot/data2/galaxy/binned_scores.loc" >
<filter type="data_meta" data_ref="input1" key="build" />
<filter type="column" name="build_col" value="0" />
<filter type="column" name="name_col" value="1" />
<filter type="column" name="value_col" value="2" />
</options>
</param>
</inputs>