Dear all, I'm using `nf-core/samtools/merge` to me...
# help
a
Dear all, I'm using
nf-core/samtools/merge
to merge some BAM files. The input channel that I provide to this process has meta fields
id
and
sample_name
. The former is used by samtools merge to infer the file prefix for merging, while the latter is used in my pipeline to keep provenance info. When I run my pipeline, this performs the merge as intended. However, when I run `nf-core/samtools/merge`'s stub test,
meta.sample_name
ends up being interpreted as the relative path to a docker mount point, and since Docker mount points must be absolute, the stub test is (in my case) bound to fail:
Copy code
$ nf-test test tests/01.stub.nf.test --profile docker
...
Command exit status:
    125
  Command output:
    (empty)
  Command error:
    docker: Error response from daemon: invalid volume specification: 'HG00666:HG00666': invalid mount config for type "volume": invalid mount path: 'HG00666' mount path must be absolute
    Run 'docker run --help' for more information
From `.command.run`:
Copy code
...
nxf_launch() {
    docker run -i --cpu-shares 2048 --memory 12288m -e "NXF_TASK_WORKDIR" -e "NXF_DEBUG=${NXF_DEBUG:=0}" \
        \
        -v HG00666:HG00666 \  # <-- meta.sample_name becomes a mount point
        \
    -v /home/user1/src/nf-ont-vc/.nf-test/tests/5e6015530fd10b4314bec7ef1809a11/work/bb/8f8ce8297ea4c0263e765dcdffacc8:/home/user1/src/nf-ont-vc/.nf-test/tests/5e6015530fd10b4314bec7ef1809a11/work/bb/8f8ce8297ea4c0263e765dcdffacc8 -w "$NXF_TASK_WORKDIR" -u $(id -u):$(id -g) --name $NXF_BOXID quay.io/biocontainers/samtools:1.22.1--h96c455f_0 /bin/bash -c "eval $(nxf_container_env); /bin/bash /home/user1/src/nf-ont-vc/.nf-test/tests/5e6015530fd10b4314bec7ef1809a11/work/bb/8f8ce8297ea4c0263e765dcdffacc8/.command.run nxf_trace"
}
...
How do I make samtools merge ignore
meta.sample_name
when the docker cli is buit?
n
Are you sure that you are actually providing a tuple that looks like
[[id: something, sample_name:something_else], filename]
and not accidently
[id:something, sample_name:something_else]
?
a
Yes, here's a snipped of my pipeline when it feeds samtools merge:
Copy code
include { SAMTOOLS_MERGE as MERGE_BAM_FILES } from '../../../modules/nf-core/samtools/merge/main'
...

    ch_merge_bam_files.view{ println "DEBUG: input to MERGE_BAM_FILES: $it" }
    // Merge each sample's BAM file
    MERGE_BAM_FILES (
        ch_merge_bam_files,
        [[], []],
        [[], []],
        [[], []]
    )
And here's the view of the input channel:
Copy code
DEBUG: input to MERGE_BAM_FILES: [[id:bam_runid_2ee680d0-3a05-4b1f-b2a3-aa43e510e297_0, sample_name:HG00666], [/home/user1/src/nf-ont-vc/tests/inputs/HG00666/bam_runid_2ee680d0-3a05-4b1f-b2a3-aa43e510e297_0_1.bam, /home/user1/src/nf-ont-vc/tests/inputs/HG00666/bam_runid_2ee680d0-3a05-4b1f-b2a3-aa43e510e297_0_0.bam]]
m
Are you using
process.containerOptions
or
docker.runOptions
anywhere in your config?
a
Yes, my
nextflow.config
has the following block:
Copy code
docker {
    docker.enabled          = true
    conda.enabled           = false
    singularity.enabled     = false
    podman.enabled          = false
    shifter.enabled         = false
    charliecloud.enabled    = false
    apptainer.enabled       = false
    docker.runOptions       = '-u $(id -u):$(id -g)'
}
m
but nothing else that could access
meta
for container settings? If that's the case, you should report this as a bug. There's no institutional profile or anything that specifically sets something for SAMTOOLS_MERGE?
Also did you add those
\
for formatting, or is that in the script?
s
if you change
sample_name
to anything else (
foo
), does it still happen? i.e. is it something unique to
sample_name
My gut feeling would be that your "sample" is a directory (or some directory structure) and nextflow assumes it needs to mount that dir (structure) to make the actual file available.
m
That might be on to something: I don't think the issue then is the
meta
map, but how you're supplying the files then. I just noticed that inputs are also in a folder named
HG00666
a
Dear all, thank you very much for your suggestions. I went back to re-running the nextflow pipeline which included the problematic process, and was surprised to notice that it wasn't working "anymore" (not sure how that happened, maybe a
git stash pop
issued from the terminal's history? I really can't tell). That meant that I was writing tests before even having a working pipeline. Once fixed, I could not reproduce the error anymore. The stub test for
nf-core/samtools/merge
works as intended.