diff --git a/base.config b/base.config index a7f99f7..c949cfd 100755 --- a/base.config +++ b/base.config @@ -2,7 +2,7 @@ params { out_dir = "output" wf { basecaller_container = "ontresearch/dorado" - container_sha_basecalling = "shae9327ad17e023b76e4d27cf287b6b9d3a271092b" + container_sha_basecalling = "shac8f356489fa8b44b31beba841b84d2879de2088e" bonito_container = "ontresearch/bonito" bonito_sha = "shaea43ca2333f91fa78a823f640ba158e4268f1f98" common_sha = "sha72f3517dd994984e0e2da0b97cb3f23f8540be4b" diff --git a/lib/signal/ingress.nf b/lib/signal/ingress.nf index 6f0a9a0..48aa8c8 100644 --- a/lib/signal/ingress.nf +++ b/lib/signal/ingress.nf @@ -234,7 +234,7 @@ process split_calls { cpus 1 publishDir "${params.out_dir}/demuxed", mode: 'copy', - pattern: "demuxed/*.bam", + pattern: "demuxed/*", saveAs: { fn -> if (fn.endsWith("unclassified.bam")) { "unclassified/reads.bam" @@ -242,22 +242,36 @@ process split_calls { else if (fn.endsWith("mixed.bam")) { "mixed/reads.bam" } - else { + else if (fn.endsWith("unclassified.fastq")) { + "unclassified/reads.fastq" + } + else if (fn.endsWith("mixed.fastq")) { + "mixed/reads.fastq" + } + else if (fn.endsWith("fastq")) { + "${fn.replace("demuxed/${params.barcode_kit}_","").replace(".fastq","")}/reads.fastq" + } + else if (fn.endsWith("bam")) { "${fn.replace("demuxed/${params.barcode_kit}_","").replace(".bam","")}/reads.bam" } } input: - tuple path(cram), path(crai) - tuple path(ref_cache), env(REF_PATH) + path(cram) output: - path("demuxed/*.bam") + path("demuxed/*") script: + if (params.fastq_only) { + fastq_str = "--emit-fastq" + } else { + fastq_str = "" + } + // CW-4509: as described [here](https://github.com/nanoporetech/dorado#Demultiplexing-mapped-reads) // to preserve mapping information when demuxing, we need to ask for // `--no-trim`. Being aligned, it is also worth ask for it to be sorted/indexed. - def is_aligned = params.ref ? "--no-trim --sort-bam" : "" + def is_aligned = params.ref ? "--no-trim --sort-bam" : "" """ - dorado demux --output-dir demuxed ${is_aligned} --no-classify ${cram} + dorado demux ${fastq_str} --output-dir demuxed ${is_aligned} --no-classify ${cram} """ } diff --git a/main.nf b/main.nf index 3f53ecb..917d3d0 100644 --- a/main.nf +++ b/main.nf @@ -13,7 +13,6 @@ nextflow.preview.recursion=true process getVersions { label "wf_basecalling" - cpus 1 output: path "versions.txt" script: