Hi there,

I'm needing to perform the same type of iteration on data as Marco describes
in the email below.

http://markmail.org/message/hwoipvurcgsi6dey

Is there now a way of doing this in without having to use the echo list
processor and a nested workflow by configuring a processor's list handling
functionality in Taverna 2?

Thanks, Peter.

--

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(A*a),f(A*b]. 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 :

[A*[a,b], B*[c,d], C*[e,f]]

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

[f(A*a),f(A*b)],[f(B*c),f(B*d)],[f(C*e),f(C*f)]]

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

_______________________________________________
Taverna-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/taverna-users
Documentation: http://www.mygrid.org.uk/usermanual1.6/
FAQ: http://www.mygrid.org.uk/wiki/Mygrid/TavernaFaq
Biological Services:
http://www.mygrid.org.uk/wiki/Mygrid/BiologicalWebServices



------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
taverna-users mailing list
[email protected]
[email protected]
Web site: http://www.taverna.org.uk
Mailing lists: http://www.taverna.org.uk/taverna-mailing-lists/

Reply via email to