Hello people! I found myself in a bit of predicam...
# modules
e
Hello people! I found myself in a bit of predicament while updating the PureCN module. Given a prefix of
foo
, I expect outputs like •
foo_loh.csv
•
foo_amplification_pvalues.csv
•
foo.csv
(new, what I want to add) I obviously can't use
*.csv
as a glob, and I wouldn't use
${meta.id}
because the user can choose a different prefix. Any suggestions?
e
In such cases, you remove "def" when defining the prefix and you use ${prefix}.csv to capture that..and you ll probably need to use ${prefix}_loh.csv to capture the other one
e
Well, I expect either
meta.id
or a prefix... how do I handle such a case? Or I just focus on one? The others are easier because I can do
*_loh.csv
, it's just this one that is a plain
.csv
.
e
prefix is your friend, because it is either equal to meta.id
prefix = task.ext.prefix ?: "${meta.id}"
or you overwrite it through the modules configuration file. so the outputs should be:
Copy code
output:
    tuple val(meta), path("${prefix}_loh.csv")                  , emit: loh
    tuple val(meta), path("${prefix}_amplification_pvalues.csv"), emit: amp
    tuple val(meta), path("${prefix}.csv")                      , emit: csv
    path "versions.yml"                                         , emit: versions
something like this
e
Oh, I get it.
def
makes the variable local, doesn't it?
party this 1
e
Yep!
e
OK, this should be enough to get the ball running (and make the stub tests pass, at least...)
🙌 3