Good morning. I'm currently aiming to use the nf-c...
# modules
o
Good morning. I'm currently aiming to use the nf-core Freebayes module. Unfortunately, it seems to accept only two input bam files (and their indices). For population (bacterial) variant calling i want to use the multi-sample calling of Freebayes of a large amount of bam files. Is there any chance to adopt this bahaviour? Currently, it's strictly accepting two input bams, their index and a bed file.
Copy code
input:
    tuple val(meta), path(input_1), path(input_1_index), path(input_2), path(input_2_index), path(target_bed)
I'd suggest something similar to
Copy code
input:
        path(list_bam)
        path(list_bai)
a bit more precise - my suggestion would be
Copy code
input:
    tuple val(meta), path(bam) // modified
    tuple val(meta), path(bam_index) // modified
    tuple val(meta), path(target_bed) // modified
    tuple val(meta2), path(fasta)
    tuple val(meta3), path(fasta_fai)
    tuple val(meta4), path(samples)
    tuple val(meta5), path(populations)
    tuple val(meta6), path(cnv)

    output:
    tuple val(meta), path("*.vcf.gz"), emit: vcf
    tuple val("${task.process}"), val('freebayes'), eval('freebayes --version 2>&1 | sed "s/version:\s*v//g"'), emit: versions_freebayes, topic: versions


    when:
    task.ext.when == null || task.ext.when

    script:
    def args    = task.ext.args   ?: ''
    def prefix  = task.ext.prefix ?: "${meta.id}"
    // def input            = input_2     ? "${input_1} ${input_2}"        : "${input_1}"
    def targets_file     = target_bed  ? "--target ${target_bed}"       : ""
    def samples_file     = samples     ? "--samples ${samples}"         : ""
    def populations_file = populations ? "--populations ${populations}" : ""
    def cnv_file         = cnv         ? "--cnv-map ${cnv}"             : ""
    """
    freebayes \\
        -f ${fasta} \\
        ${targets_file} \\
        ${samples_file} \\
        ${populations_file} \\
        ${cnv_file} \\
        ${args} \\
        ${bam} > ${prefix}.vcf // modified

    bgzip ${prefix}.vcf
    """
m
When including a module in pipeline, you can always use
nf-core modules patch
. Install a module like normal, make your modifications to suit your use-case and then use
nf-core modules patch
to write a patch file which will be applied any time you update the module. I don't want to stop the discussion though on updating module inputs though. It seems quite difficult to make this suit everyone, but I'm not familiar with this tool.
f
I think adding more (optional) inputs might be a good idea to use thw hole versatility of the tool. Maybe it even makes sense to have different subtools based on the application? But I am not sure if the command would be different enough. My suggestion would be to do these changes and then open a PR zo the modules repo so we can discuss it based on the code! Also I would vote to not have many input channels but one input channel with all the inputs (makes more sense also towards future changes).
o
OK - I'll try to come up with a suggestion after some testing.
👍 1