Using RegEx to capture file name in Groovy/NextFlow

My sequencing files are named according to the folowing pattern lane5651_AAGAGGCA_00h_Cell_WT3_L008_R1.fastq.gz. I would like to capture the Sample ID as 00h_Cell_WT3 in order to name all downstream files accordingly. To this end, I wrote the following snippet: 1#!/usr/bin/env nextflow 2 3// fastq files are stored in reads as paired ends R1 and R4 4params.reads = 'reads/lane*_*_*_*_R{1,4}.fastq.gz' 5 6Channel 7 .fromFilePairs(params.reads, flat: true) 8 .map { prefix, file1, file2 -> tuple(getSampleID(prefix), file1, file2) } 9 ....

October 6, 2018 · 2 min · Firas Sadiyah