Hey all, probably a rather simple question but: I'...
# nostupidquestions
l
Hey all, probably a rather simple question but: I'm trying to use module SEQKIT_RMDUP, to which I pass a channel with a tuple (meta, file.fasta) However, meta.id and file happen to be the same, which means that in this part of the code:
Copy code
script:
    def args        = task.ext.args ?: ''
    prefix          = task.ext.prefix ?: "${meta.id}"
    extension       = "fastq"
    if ("$fastx" ==~ /.+\.fasta|.+\.fasta.gz|.+\.fa|.+\.fa.gz|.+\.fas|.+\.fas.gz|.+\.fna|.+\.fna.gz|.+\.fsa|.+\.fsa.gz/ ) {
        extension   = "fasta"
    }
    extension       = fastx.toString().endsWith('.gz') ? "${extension}.gz" : extension
    // SeqKit/rmdup takes care of compressing the output: https://bioinf.shenwei.me/seqkit/usage/#rmdup
    if("${prefix}.${extension}" == "$fastx") error "Input and output names are the same, use \"task.ext.prefix\" to disambiguate!"
$fastx
(file.fasta) and
${prefix}.${extension}
happen to evaluate to the same. If I understand correctly, setting something through
task.ext.prefix
will replace
${meta.id}
entirely, which will then cause problems with published results as I will have multiple files of the same name for anything coming out of SEQKIT_RMDUP and downstream steps when running multiple samples. What would be the best approach in that case, modify the module to take into account this case (ie change so that
task.ext.prefix
get appended to
${meta.id}
when provided instead of replacing it) or change by
meta.id
in the entry channel so that the two expressions don't evaluate to the same anymore?
j
If I understand correctly, you don't need to modify the module itself! You just need to use a
module.sconfig
to specify a new prefix, and you can still specify `meta.id`afain: https://github.com/nf-core/taxprofiler/blob/master/conf%2Fmodules.config#L203
And this string can be dynamicslly built as they can be specified in a closure
{}
l
wow... thanks haha, that's extremely helpful!