Set up channel to loop through multi location (?)

71 views
Skip to first unread message

Tuan Nguyen

unread,
Mar 4, 2021, 9:58:53 AM3/4/21
to Nextflow
Hi there, 

Maybe a novice question. I'm not sure how to describe my situation, but long story short, I have a few files to run my analysis, each batches are stored in a Chr based folder (Chr1, Chr2...Chr23). How can I set up another channel for Nextflow to loop through 23 Chr ?

Below is my current script that work with 1 folder. 

vcf_ch = Channel
        .fromPath( '/result/Chr1/*.gz' )
        .toSortedList()
        .collect()
tabix_ch = Channel
        .fromPath( '/result/Chr1/*.gz.tbi' )
        .collect()

process VCF_SUBSET {
        publishDir "$baseDir/result/ALL_CHR", mode: 'copy', overwrite: true

        input:
        path file from vcf_ch
        path tabix_file from tabix_ch

        output:
        file "*.vcf.gz" 

        script:
        """
        bcftools merge -i AF:avg,MAF:avg,R2:avg ${file} --threads 20 -Oz  -o test.vcf.gz
        """
}

Many thanks,

Tuan




Xin Gong

unread,
Mar 14, 2021, 11:56:55 AM3/14/21
to Nextflow
I think you can use wildcard character in fromPath, see doc here
Reply all
Reply to author
Forward
0 new messages