I would like to pass in bam files pair_id.sorted.bam
and their corresponding index files pair_id.sorted.bam.csi
into a nextflow workflow. However I am having trouble passing in the files, with errors being thrown for def indexFile = new File("${it.getPath()}.bai")
.
Not a valid path value type: java.io.File ({it.getPath()}.bai)
Alternatively, would Channel.fromFilePairs
be appropriate, or is this operator only for fastq file pairs?
nextflow.config:
input = "${directory}/*/*.sorted{.bam,.bam.csi}"
workflow.nf:
process my_process {
input:
tuple val(pair_id), path(pf_bam), path(pf_bam_index)
...
}
workflow {
Channel
.fromPath(params.input, checkIfExists: true)
.filter{it.name.endsWith('.bam')}
.map{
def indexFile = new File("${it.getPath()}.bai")
tuple(it.name.split('.sorted')[0], it, indexFile)
}
.set{input_ch}
my_process(input_ch)
}