commit/galaxy-central: BjoernGruening: If you have a repeat tag and want to get the filetype from the first element you can't access the first element in a from_param type.
1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/0282484e4c32/ Changeset: 0282484e4c32 User: BjoernGruening Date: 2013-08-14 19:07:31 Summary: If you have a repeat tag and want to get the filetype from the first element you can't access the first element in a from_param type. That commit creates some artifical parameter called 'first' that you can use as value in param_attribute. For example: <option type="from_param" name="singlePaired.mate_list" param_attribute="first.input_mate1.ext" /> I use that to retrive the filetype of paired end reads that are inserted in a repeat tag. Assuming that every mate pair is from the same type as the first element. Affected #: 1 file diff -r 5c9cfd1dea8bfb85bcc1ee07035629a77ee3a051 -r 0282484e4c323e1baf79d05813ea8213239a8b4e lib/galaxy/tools/parameters/output.py --- a/lib/galaxy/tools/parameters/output.py +++ b/lib/galaxy/tools/parameters/output.py @@ -188,7 +188,14 @@ assert ref_name in value, "Required dependency '%s' not found in incoming values" % ref_name value = value.get( ref_name ) for attr_name in self.param_attribute: - value = getattr( value, attr_name ) + # if the value is a list from a repeat tag you can access the first element of the repeat with + # artifical 'first' attribute_name. For example: .. param_attribute="first.input_mate1.ext" + if isinstance(value, list) and attr_name == 'first': + value = value[0] + elif isinstance(value, dict): + value = value[ attr_name ] + else: + value = getattr( value, attr_name ) options = [ [ str( value ) ] ] for filter in self.filters: options = filter.filter_options( options, other_values ) Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.
participants (1)
-
commits-noreply@bitbucket.org