Skip to content

file() and Channel.fromPath() do not recognise absolute paths when providing multiple inputs #2543

@samirelanduk

Description

@samirelanduk

Bug report

Expected behavior and actual behavior

In my workflow, a process is called as follows:

BOWTIE_ALIGN (
    TRIMGALORE.out.reads,
    file(params.smrna_genome)
)

Where this second input refers to multiple files. I need to provide these files as individual, absolute paths, rather than individual, relative paths or absolute wildcard paths, but this doesn't work - they do not stage the files in the process directory when given in this form. For example, the following values of params.smrna_genome do cause all files to be staged:

assets/smrna_files/small_rna_bowtie*
./assets/smrna_files/small_rna_bowtie*
/absolute/path/assets/smrna_files/small_rna_bowtie*
{assets/smrna_files/small_rna_bowtie.1.ebwt,assets/smrna_files/small_rna_bowtie.2.ebwt}

But the following are not recongised:

{./assets/smrna_files/small_rna_bowtie.1.ebwt,./assets/smrna_files/small_rna_bowtie.2.ebwt}
{/absolute/path/assets/smrna_files/small_rna_bowtie.1.ebwt,/absolute/path/assets/smrna_files/small_rna_bowtie.2.ebwt}

If the individual paths begin with a / or a ., they are not parsed correctly, and the files are not staged in the process directory.

In other words, using wilcard expansion with an absolute path works, using individually listed files with a relative path works, but using individually listed files with an absolute path (a hard requirement for me in this case) does not work.

I have tried every variation of file separator and path structure I can think of, but none of them work. Using Channel.fromPath(...).collect() in place of file(...) has the same problem.

Steps to reproduce the problem

This demonstrates the difference in behaviour when relative and absolute paths are used:

nextflow.enable.dsl=2

workflow {
    println file("{/absolute/path/assets/smrna_files/small_rna_bowtie.1.ebwt,/absolute/path/assets/smrna_files/small_rna_bowtie.2.ebwt}")

    println file("{assets/smrna_files/small_rna_bowtie.1.ebwt,assets/smrna_files/small_rna_bowtie.2.ebwt}")
}

Program output

The above example prints:

N E X T F L O W  ~  version 21.10.4
Launching `workflows/ghexample.nf` [naughty_dubinsky] - revision: 7883b77320
[]
[./assets/smrna_files/small_rna_bowtie.1.ebwt, ./assets/smrna_files/small_rna_bowtie.2.ebwt]

Environment

  • Nextflow version: 21.10.4
  • Java version: 17.0.1
  • Operating system: macOS (M1)
  • Bash version: zsh 5.8 (x86_64-apple-darwin21.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions