-
Notifications
You must be signed in to change notification settings - Fork 307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scatter over multiple items with literate names (as syntactic sugar) #279
Comments
I am not sure how you are generating the upstream information, but would it be possible to use a IE: struct SampleInfo {
File bam
File metric
File vcf
}
workflow myWorkflow {
Array[SampleInfo] sampleInfo
scatter(info in SampleInfo){
call task { input: bam=info.bam, metric=info.metric, vcf=info.vcf }
}
} |
So I'd also consider if an arbitrary tuple would make sense, and if so, if there's something that's providing that's not provided by a struct (and/or just syntactic sugar over a struct) |
Thanks for the response!
I'm not sure :) . Right now this is the combination of a number of calls (slightly contrived example, but gets at the root of it):
The reason I wouldn't just put this all in one scatter is because I have a normalization step that takes in all fastqs (or I might want to call out to some subworkflows). Regardless I end up with a bunch of lists and I'm not sure how to convert that into structs. Does that make sense?
Arbitrary tuple makes sense in the sense that it's pretty natural to want to iterate over a set of arrays that are all have items in the same order (esp because different scatters still guarantee output in same order) |
@jtratner One way you could go about doing this would be to build a series of structs or even using a # Approach using Maps which can be implemented now
scatter(fastq in fastqs) {
call bwa { input: fastq=fastq}
Map[String,File] intermediate_1 = {"fastq":intermediate["fastq"],"bam":bam}
}
scatter (intermediate in intermediate_1) {
call filter_bam { input: bam=intermediate["bam"]}
Map[String,File] intermediate_2 = {"fastq":intermediate["fastq"],"bam":intermediate["bam"],"filter_bam": filter_bam.bam}
}
# filter_bam is still defined so you can still call it and receive a `Arrary[File]` type
call calc_metrics { input: bams=filter_bam.bam}
scatter (intermediate in intermediate_2) {
File bam = intermediate["bam"]
File fastq = intermediate["fastq"]
File filt_bam = intermediate["filter_bam"]
call ...
}
|
Is it possible to extract a key from an array of structs? I.e. get an array of File bams from the struct SampleInfo above? Or can you coerce a zip of arrays to an array of structs? Sorry just realized zip can only zip 2 arrays max. Makes sense since on files have an index and not another auxiliary file. |
I agree with @geoffjentry - |
If we switch from |
While the pair syntax is helpful, if you have three or more arrays you're trying to zip, the syntax gets pretty messy.
For example, right now I can do:
But I'd much prefer to be able to say:
If the concern is scoping rules, perhaps it could be the equivalent to:
The text was updated successfully, but these errors were encountered: