diff --git a/samtools.wdl b/samtools.wdl index ff2daf0d74058fab973c1b523c6bc1553aa71734..0d43015794579ba27f7ce58d7d3b144ea778f58f 100644 --- a/samtools.wdl +++ b/samtools.wdl @@ -36,11 +36,10 @@ task Index { } output { + File index = select_first(flatten([[bamIndexPath], glob(sub(basename(bamFile), "\.bam$", "") + "*.bai")])) IndexedBamFile outputBam = object { file: bamFile, - index: if defined(bamIndexPath) - then select_first([bamIndexPath]) - else bamFile + ".bai" + index: index } } }