details: http://www.bx.psu.edu/hg/galaxy/rev/edfb84f6371e changeset: 3306:edfb84f6371e user: Dan Blankenberg <dan@bx.psu.edu> date: Sat Jan 30 16:38:12 2010 -0500 description: Allow a default column value to be specified for ColumnListParameter/data_col parameters. diffstat: lib/galaxy/tools/parameters/basic.py | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) diffs (34 lines): diff -r 8b7d2cc963fd -r edfb84f6371e lib/galaxy/tools/parameters/basic.py --- a/lib/galaxy/tools/parameters/basic.py Sat Jan 30 07:48:39 2010 -0500 +++ b/lib/galaxy/tools/parameters/basic.py Sat Jan 30 16:38:12 2010 -0500 @@ -763,6 +763,7 @@ self.force_select = string_as_bool( elem.get( "force_select", True )) self.accept_default = string_as_bool( elem.get( "accept_default", False )) self.data_ref = elem.get( "data_ref", None ) + self.default_value = elem.get( "default_value", None ) self.is_dynamic = True def from_html( self, value, trans=None, context={} ): """ @@ -801,7 +802,7 @@ # Generate options if not dataset.metadata.columns: if self.accept_default: - column_list.append( '1' ) + column_list.append( self.default_value or '1' ) return column_list if not self.force_select: column_list.append( 'None' ) @@ -823,6 +824,13 @@ if col != 'None': options.append( ( 'c' + col, col, False ) ) return options + def get_initial_value( self, trans, context ): + if self.default_value is not None: + # dataset not ready / in workflow / etc + if self.need_late_validation( trans, context ): + return UnvalidatedValue( self.default_value ) + return self.default_value + return SelectToolParameter.get_initial_value( self, trans, context ) def get_legal_values( self, trans, other_values ): return set( self.get_column_list( trans, other_values ) ) def get_dependencies( self ):