# HG changeset patch --
Bitbucket.org
# Project galaxy-dist
# URL
http://bitbucket.org/galaxy/galaxy-dist/overview
# User Dan Blankenberg <dan(a)bx.psu.edu>
# Date 1283439625 14400
# Node ID fa1d4be027649ad4d745c62a053e024fe2db35e9
# Parent 04c59f0a5202a89731f76b33525a4e753e0cfa42
Add 'NullToolOutputActionOption' to tool output dataset actions. This action
option is used implicitly when no ToolOutputActionOption's have been defined. This
will allow e.g. setting a metadata value to a static value on a per ToolOutput basis.
Example which sets the strand assignment of an interval dataset to column 10:
<outputs>
<data format="interval" name="output1">
<actions>
<action type="metadata" name="strandCol"
default="10"/>
</actions>
</data>
</outputs>
--- a/lib/galaxy/tools/parameters/output.py
+++ b/lib/galaxy/tools/parameters/output.py
@@ -104,7 +104,6 @@ class ToolOutputAction( object ):
self.parent = parent
self.default = elem.get( 'default', None )
option_elem = elem.find( 'option' )
- assert option_elem is not None, "Required 'option' element missing
from ToolOutputAction"
self.option = ToolOutputActionOption.from_elem( self, option_elem )
def apply_action( self, output_dataset, other_values ):
raise TypeError( "Not implemented" )
@@ -117,20 +116,29 @@ class ToolOutputActionOption( object ):
@classmethod
def from_elem( cls, parent, elem ):
"""Loads the proper action by the type attribute of
elem"""
- option_type = elem.get( 'type', None )
+ if elem is None:
+ option_type = NullToolOutputActionOption.tag # no
ToolOutputActionOption's have been defined, use implicit NullToolOutputActionOption
+ else:
+ option_type = elem.get( 'type', None )
assert option_type is not None, "Required 'type' attribute missing
from ToolOutputActionOption"
return option_types[ option_type ]( parent, elem )
def __init__( self, parent, elem ):
self.parent = parent
self.filters = []
- for filter_elem in elem.findall( 'filter' ):
- self.filters.append( ToolOutputActionOptionFilter.from_elem( self,
filter_elem ) )
+ if elem is not None:
+ for filter_elem in elem.findall( 'filter' ):
+ self.filters.append( ToolOutputActionOptionFilter.from_elem( self,
filter_elem ) )
def get_value( self, other_values ):
raise TypeError( "Not implemented" )
@property
def tool( self ):
return self.parent.tool
+class NullToolOutputActionOption( ToolOutputActionOption ):
+ tag = "null_option"
+ def get_value( self, other_values ):
+ return None
+
class FromFileToolOutputActionOption( ToolOutputActionOption ):
tag = "from_file"
def __init__( self, parent, elem ):
@@ -454,7 +462,7 @@ for action_type in [ MetadataToolOutputA
action_types[ action_type.tag ] = action_type
option_types = {}
-for option_type in [ FromFileToolOutputActionOption, FromParamToolOutputActionOption,
FromDataTableOutputActionOption ]:
+for option_type in [ NullToolOutputActionOption, FromFileToolOutputActionOption,
FromParamToolOutputActionOption, FromDataTableOutputActionOption ]:
option_types[ option_type.tag ] = option_type
filter_types = {}