Arthur
04/14/2026, 7:01 AMdef extension = args.contains("--output-type b") || args.contains("-Ob") ? "bcf.gz" :
args.contains("--output-type u") || args.contains("-Ou") ? "bcf" :
args.contains("--output-type z") || args.contains("-Oz") ? "vcf.gz" :
args.contains("--output-type v") || args.contains("-Ov") ? "vcf" :
"vcf"
def stub_index = args.contains("--write-index=tbi") || args.contains("-W=tbi") ? "tbi" :
args.contains("--write-index=csi") || args.contains("-W=csi") ? "csi" :
args.contains("--write-index") || args.contains("-W") ? "csi" :
""
After:
def extension = args.contains("--output-type b") || args.contains("-Ob")
? "bcf.gz"
: args.contains("--output-type u") || args.contains("-Ou")
? "bcf"
: args.contains("--output-type z") || args.contains("-Oz")
? "vcf.gz"
: args.contains("--output-type v") || args.contains("-Ov")
? "vcf"
: "vcf"
def stub_index = args.contains("--write-index=tbi") || args.contains("-W=tbi")
? "tbi"
: args.contains("--write-index=csi") || args.contains("-W=csi")
? "csi"
: args.contains("--write-index") || args.contains("-W")
? "csi"
: ""Mahesh Binzer-Panchal
04/14/2026, 7:17 AMdef extension_map = [
["--output-type b", "-Ob"]: "bcf.gz",
["--output-type u", "-Ou"]: "bcf",
["--output-type z", "-Oz"]: "vcf.gz",
["--output-type v", "-Ov"]: "vcf"
]
def extension = extension_map.find { flags, ext -> flags.any { args.contains(it) } }?.value ?: "vcf"
def index_map = [
["--write-index=tbi", "-W=tbi"]: "tbi",
["--write-index=csi", "-W=csi", "--write-index", "-W"]: "csi"
]
def stub_index = index_map.find { flags, idx -> flags.any { args.contains(it) } }?.value ?: ""
but I guess this makes it harder to read.Arthur
04/14/2026, 7:20 AMMahesh Binzer-Panchal
04/14/2026, 7:22 AMMahesh Binzer-Panchal
04/14/2026, 7:23 AMdef getVal = { list, map, defaultVal ->
map.find { flags, val -> flags.any { list.contains(it) } }?.value ?: defaultVal
}
def extension = getVal(args, [
["--output-type b", "-Ob"]: "bcf.gz",
["--output-type u", "-Ou"]: "bcf",
["--output-type z", "-Oz"]: "vcf.gz"
], "vcf")
def stub_index = getVal(args, [
["--write-index=tbi", "-W=tbi"]: "tbi",
["--write-index=csi", "-W=csi", "--write-index", "-W"]: "csi"
], "")Phil Ewels
04/14/2026, 7:25 AMswitch 😅 @Ben Sherman and I have discussed it a few times, it's not a technical reason, only a simplicity / lack of particularly good use cases for it.Phil Ewels
04/14/2026, 7:26 AMMahesh Binzer-Panchal
04/14/2026, 7:26 AMMaxime Garcia
04/14/2026, 8:08 AMMahesh Binzer-Panchal
04/14/2026, 8:09 AMJim Downie
04/14/2026, 8:13 AMYou can always start a petition to bring back🙏🙏🙏🙏🙏🙏🙏🙏 The only part of the strict syntax changes which truly has never made sense to me... -- Agreed that the config map approach is a nice alternative though - easily extensible and separates the definitions from the selection!😅 @Ben Sherman and I have discussed it a few times, it's not a technical reason, only a simplicity / lack of particularly good use cases for it.switch
Maxime Garcia
04/14/2026, 8:15 AMwhich? The closure (2nd) or the map (1st)?Both
Mahesh Binzer-Panchal
04/14/2026, 8:51 AMBen Sherman
04/14/2026, 3:09 PMmatch expression or just bring back switch expressions if it makes senseBen Sherman
04/14/2026, 3:10 PMMaxime Garcia
04/14/2026, 4:06 PM