Hey, I've noticed strange behaviour:
Inside my NF script I've created a function, that just take a key nad a map and pulls out values from this map:
(...)
def parse_sname(snamef, inmapf){
pnamef = inmapf[snamef].pname
bnamef = inmapf[snamef].bname
panelf = inmapf[snamef].panel
numef = inmapf[snamef].nume
idsamplef = pnamef +"_"+ numef
return [pnamef, bnamef, panelf, numef, idsamplef]
}
then I use this function in process like this:
process CoverageExonsDam {
maxForks 3
tag "$pname"
input:
set sname, file(bam), file(bai) from BamCh1
script:
(pname, bname, panel, nume, idsample) = parse_sname(sname, inmap)
"""
echo $sname >> ${sname}.cov.txt
echo $pname >> ${sname}.cov.txt
echo $bam >> ${sname}.cov.txt
"""
}
when I run a script, the output is
unexpected:
Seems like "CoverageExonsDam" is executed three times ONLY for one element from the channel as we see tag "sampA", but in fact processes were finished correctly:
when I don't use parse_sname(sname, inmap) function, everything works normal.
process CoverageExonsDam {
maxForks 3
tag "$pname"
input:
set sname, file(bam), file(bai) from BamCh1
script:
pname = inmap[sname].pname
bname = inmap[sname].bname
panel = inmap[sname].panel
nume = inmap[sname].nume
idsample = pname +"_"+ nume
"""
echo $sname >> ${sname}.cov.txt
echo $pname >> ${sname}.cov.txt
echo $bam >> ${sname}.cov.txt
"""
}
Why using groovy functions under "script" is making such problems?
(I don't use DLS2, it's just a simple nf script)