Open rlupat opened 4 years ago
Other possible implementation for the example above is by using FilterNotNull Operator
self.step(
"combine_gatk_variants",
CombineVariants_0_0_8(
vcfs=FilterNullOperator([self.splitnormalisevcf.out, self.mutect2.out]),
type="germline",
columns=["AD", "DP", "AF", "GT"],
),
)
which will be translated to WDL select_all
.
However, when the switches involve multiple tools, the workaround above will not work anymore.
For example:
self.conditional("conditionalA", [
(IsDefined(self.toolB2.out),
ToolC(
vcfs=[self.toolB1.out, self.toolB2.out.assert_not_null()],
),
),
ToolD(
vcfs=[self.toolB1.out],
),
])
You should be able to use the FilterNullOperator
to get the non-null values of the array, because you know the second pointer in the array has a value, eg:
CombineVariants_0_0_8(
vcfs=FilterNullOperator([self.splitnormalisevcf.out, self.toolB2.out]),
type="germline",
columns=["AD", "DP", "AF", "GT"],
)
Good point.
How about when ToolC
is not accepting arrays?
E.g.
self.conditional("conditionalA", [
(IsDefined(self.toolB2.out),
ToolC(
vcfs=self.toolB2.out,
),
),
ToolD(
vcfs=self.toolB1.out,
),
])
I don't think FilterNullOperator works for the case above?
Example:
In WDL, this will be translated to:
where
select_first([mutect2.out]
will fail whenmutect2_out
isNull
If this is implemented without
assert_not_null()
andmutect2.out
from the example above isOptional
(due to other conditionals from previous step); subsequent tools that have required inputs will not work.