Workflow Entry: TestIteratorStrategy_withNesting

Created at: 29/11/07 @ 15:31:33
Information Version 1 (of 1)

Version created on: 29/11/07 @ 15:31:32 by: Marco Roos   |   Revision comments Expand

Title: TestIteratorStrategy_withNesting

Type: Taverna 1


Information Preview

(Click on the image to get the full size)

Testiteratorstrategy_withnesting_29185_1


Information Description

Implementation of the iteration workaround by Tom Oin conform the Q&A below. The nested workflow ‘NestedProcessor’ is called that to conform to Tom’s explanation. For an alternative solution using a java beanshell to clone list items see ‘TestIteratorStrategy_withCloning.

This workflow implements the following Q&A: Marco Roos wrote: > Dear Taverna user, > > Issue 1: Complex iteration > > I would like to perform an iteration including a dot product between > a list and a list of lists; example: > Input: > > [1] > [A,B,C] > [[a,b],[c,d],[e,f]] > > Desired output: > > [1Aa, 1Ab, 1Bc, 1Bd, 1Ce, 1Cf] > > Is this possible? If so, how can I achieve this?

Yes, but not directly. This is actually the reason for the new T2 feature called ‘staged iteration’. The issue is that assuming you iterate down to single items (which appears to be the case) you want to go half way with a dot product and then use a cross product. As the iteration strategies always (in the current code) drill down to the final thing you’re asking for you can’t do this, at least you can’t do it without a trick…

So… the trick :

First off the [1] is a red herring, that’s the easy bit! it doesn’t matter where you put that in as it’ll always be added onto every single job.

So you now have a list and a list of lists, you want to combine item ‘n’ in the first list with all the items of list ‘n’ in the second. Firstly you’ll need a nested workflow into which you put your processor, the trick being that you also put in an ‘echo list’ operation. Connect the echo list output to the input of your processor being fed needing the list of lists and the echo list input to a workflow input. Connect the other input (the list) of your processor to a workflow input. The workflow inputs will have type of ‘single item’ and ‘list’ as the workflow inputs copy the types of the inputs they’re connected to.

It should be obvious that if you give this nested workflow the inputs ‘A’ and [a,b] it’ll iterate and give you [f(Aa),f(Ab]. Also note that now the nested workflow mismatches by the same level on both inputs – it has one input with a single item type which you’ll feed it a list and another of a list where you feed it a list of lists. This means you can set a dot iteration strategy over the nested workflow with the cross product (default) iteration strategy over the processor within it.

This nested workflow will now produce the result you want; it will be called three times with :

B, C[e,f]]

Each one of these then creates a cross product iteration within the nested workflow, so the output is :

Passing the output through a list flatten operation then gives you (leaving out the ‘F(x)’ and replacing with ‘x’) :

[Aa,Ab,Bc,Bd,Ce,Cf] which is what I believe you wanted? :) Adding the [1] bit in is easy from there!

We actually did this exact thing some time ago for Paul, he had a structure he was viewing as two lists of directories where the lists were the same length but the directories could have any number of items in, he wanted a comparison between every item in directory ‘n’ from list 1 and every item in directory ‘n’ from list 2.

Hope that helps, if you were wondering why we have a superficially pointless ‘echo list’ local worker now you know :)

Tom


Information Download


Information Run

Run this Workflow in the Taverna Workbench...

Option 1:

Note: you need to have both the WHIP Launcher and the Taverna myExperiment/WHIP plugin installed on your machine for this to work. See here for information.

Option 2:

Copy and paste this link into File > 'Open workflow location...'
http://www.myexperiment.org/workflows/105/download?version=1
[ More InfoExpand ]


Information Workflow Components

Inputs (0)
Processors (6)
Outputs (5)
Links (10)
Coordinations (0)
Taverna 1 workflow

Information Original Uploader

Information License

All versions of this Workflow are licensed under the Creative Commons Attribution-Share Alike 3.0 License.

Information Credits (2)

(People/Groups)

Information Attributions (0)

(Workflows/Files)

None

Information Tags (5)

Log in to add Tags

Information Shared with Groups (0)

None

Information Featured In Packs (0)

None

Log in to add to one of your Packs

Information Ratings (0)

Current:

0.0 / 5

(0 ratings)

Log in to rate and see breakdown of ratings

Information Attributed By (0)

(Workflows/Files)

None

Information Favourited By (0)

No one

 

Citations (0)

None


Version History

Earliest Version:
[1] - TestIteratorStrategy_withNesting

Created on: Thursday 29 November 2007 @ 15:31:32 (GMT)

Created by: Marco Roos

Revision comments:

None

This Workflow only has one version.



Reviews Reviews (0)

No reviews yet

Be the first to review!



Comments Comments (0)

No comments yet

Log in to make a comment


New/Upload

Log in / Register

Username or Email:

Password:

Remember me:

OR

Use OpenID:


(eg: name.myopenid.com)

Need an account?
Click here to register

Forgot Password?

Front Page

Home

About Us

Mailing List

Contact Us

API

Publications

Taverna Workflow Workbench

Google Coop Search


Invite people to myExperiment

myGrid

BioCatalogue

JISC

Microsoft

Powered by:

Rails

Icons:
Silk icon set 1.3