Hi, I've started to standardized the bcftools modu...
# modules
l
Hi, I've started to standardized the bcftools modules here are some of the modification: • Add support for all extensions
path("*.{vcf,vcf.gz,bcf,bcf.gz}")
+
def extension
+ set
vcf.gz
as default • Input fasta and fai as tuple
tuple val(meta2), path(fasta), path(fai)
• Rename input to
tuple val(meta), path(input), path(index)
• Export index
tbi
and
csi
as separated channels • Update stub • Check for name input / output collision • Align + lint Here are some questions: • Should I add a index creation step before calling the tools
Copy code
def index_names = index.findAll { file -> !(file instanceof List) }.collect { file -> file.name }
def create_input_index = input.collect { vcf -> index_names.contains(vcf.name + ".(tbi|csi)") ? "" : "tabix ${vcf}" }.join("\n    ")
• The output vcf channel is written differently, which one is better ? Personnaly I prefer 2 as it is more explicit
Copy code
tuple val(meta), path("*.${extension}"), emit: vcf // 1
tuple val(meta), path("${prefix}.${extension}"), emit: vcf // 2
tuple val(meta), path("*.{vcf,vcf.gz,bcf,bcf.gz}"), emit: vcf // 3
• Should the optionality of an output be a closure
Copy code
tuple val(meta), path("*.tbi")                 , emit: tbi, optional: {index_extension == "tbi"}
BCFTOOLS_CSQ
also set the extension through a function as follow:
Copy code
String getVcfExtension(String args) {
    return 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.gz";
}
I really like it, should I implement it for all ? We could also do the same for the index detection.
m
I’m going to say it again, but I think each output type should have it’s own channel 🤷🏻 #small-mound-i-feel-strongly-about-but-not-enough-to-fight-everyone
l
So for
BCFTOOLS_VIEW
we would have 4 different channels
vcf
,
vcf.gz
,
bcf
,
bcf.gz
that would need to be
.mix()
afterwards ? I would argue on my side that those 4 files contain the same information (therefore same type?) and only one of them can be created at once...
m
No,
view
can only output one type at the time, and it’s up to the pipeline dev to set this in the config. Afterwards only the desired channel should be used.
👍 1
If you get no output in the desired channel, you know your config is faulty
With the ambiguous output channel you could ‘miss’ those kinds of errors
Also, I would opt to skip the plain
vcf
output, since we have https://nf-co.re/docs/guidelines/components/modules#compression-of-input-and-output-files
l
I see your point and it does make sense. We might need to reach a consensus with everyone before updating as the bcftools modules does not have the same behaviour.
Also, I would opt to skip the plain
vcf
output, since we have
Should we trigger a warning in this case ?
m
Should we trigger a warning in this case ?
Possibly 🤷🏻
l
Yeah but the point 3.6 goes against 😅
m
I guess you should either make a poll in the #team-maintainers channel or put it on the agenda for next friday
either way, I will concede to the majority, since it’s not a #hill-to-die-on
I’ve put the issue on the agenda for the maintainers meeting
l
Thanks, I've also added a poll to the #team-maintainers so that you'll know how much everyone agree / disagree 😄
😅 1