Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Channel.fromFilePairs in Netflow does not work

I’m doing a small Nextflow script for practice. My working directory is:

.
├── metadata_a.txt
├── metadata_b.txt
├── metadata_c.txt
└── parallel.nf

0 directories, 4 files

With my Nextflow script (parallel.nf), I’m trying to cat each metadata file and show the name of each one.

#!/usr/bin/env nextflow

process READFILE{
    input:
    tuple val(name), path(file)

    output:
    stdout

    """
    echo \$(cat $file) of $name
    """
}

workflow {
    input_ch = Channel.fromFilePairs('./metadata_*.txt')
    READFILE(input_ch).view()
}

But my pipeline even actually didn’t run:

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Launching `parallel.nf` [romantic_austin] DSL2 - revision: 4a80e4e585
[-        ] process > READFILE -

Does anyone know about this situation? Please give me some help, thanks.

>Solution :

The workflow ran, but your input channel was empty. The fromFilePairs factory method just needs a size parameter to specify the number of expected input files. Otherwise a pair of files is expected. I think what you want is:

workflow {
    input_ch = Channel.fromFilePairs('./metadata_*.txt', size: 1)

    READFILE(input_ch)

    READFILE.out.view()
}
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading