Help passing a tuple with paths as input for a process without splitting the files (Invalid method invocation 'call' with arguments: ...)

Hi! :upside_down_face:

I’m quite new in nextflow, and I already saw some other similar topics here, but none seem to work for me.
I am trying to run a process that takes the following tuple as input:

input:
tuple val(meta), path(samplesheet), path(run_dir)

For this, I defined two parameters, that I pass from the command line as:

-- samplecsv <path to csv file> --bcldata <path to BCL tar.gz or folder>

These parameters are passed from my main workflow to a subworkflow like this:

    bcl_dir = params.bcldata
    sample_sheet = params.samplecsv

workflow MYPIPELINE_MAIN {
    take:
    bcl_dir         // path: BCL input
    sample_sheet    // path: SampleSheet CSV

    main:
    MYPIPELINE_CORE(bcl_dir, sample_sheet)

    emit:
    demux_fastq = MYPIPELINE_CORE.out
}

Inside the subworkflow (MYPIPELINE_CORE ), I pass them into the process using a tuple:

workflow MYPIPELINE_CORE {

    take:
    bcl_dir       // path to BCL tar.gz
    sample_sheet  // path to samplesheet CSV

    main:
    Channel
        .of(tuple([id: 'run1'], file(sample_sheet), file(bcl_dir)))
        .set { ch_combinedTuple }

    ch_combinedTuple.view { "Combined tuple-channel content: $it" }

    BCL2FASTQ(ch_combinedTuple)
}

I verified via println statements that sample_sheet and bcl_dir are java.lang.String and correctly point to valid files.
However, when the process has to be run i come across this error:

Combined tuple-channel content: [[id:run1], /beegfs/home/lrenteria/my_pipeline/data/Samplesheet.csv, /beegfs/home/lrenteria/my_pipeline/data/BCL_data.tar.gz]
ERROR ~ Invalid method invocation `call` with arguments: [<data row from samplesheet>] (java.util.ArrayList) on _closure6 type

Interestingly, when I run a minimal test with only the process and the same tuple construction, everything works fine:

include { BCL2FASTQ } from './modules/nf-core/bcl2fastq'
Channel
    .of( tuple([id: 'run1'], file(params.samplecsv), file(params.bcldata)) )
    .set { ch_test }

workflow {
    ch_test.view { "Test channel content: $it" } 
    BCL2FASTQ(ch_test)
}

Any idea what might be going wrong in the subworkflow context?

Thanks a lot in advance! :grin:

First, I think you are using Nextflow DSL1 syntax, not DSL2.
Could you try it in DSL2? the error might be you are trying to use DSL2 syntax in combination of DSL1.

The issue isn’t using DSL1 syntax.

    bcl_dir = params.bcldata
    sample_sheet = params.samplecsv

This part isn’t recognised inside the workflow.

Ideally the call to MYPIPELINE_MAIN should be like:

workflow {
    MYPIPELINE_MAIN (
        params.bcldata,
        params.samplecsv
    )
}

It’s also worth noting that params.bcldata and params.samplecsv are String objects that contain a path. The file function you’re using inside the tuple is what coverts the String into a Path object for the process to stage the file correctly.