diff --git a/conf/modules.config b/conf/modules.config index 2ba31638..ca616785 100644 --- a/conf/modules.config +++ b/conf/modules.config @@ -216,7 +216,7 @@ process { ext.args2 = '-f ID PRIMER ERROR PRSTART' } - withName: 'PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD' { + withName: PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD { publishDir = [ path: { "${params.outdir}/presto/03-maskprimers/${meta.id}" }, mode: params.publish_dir_mode, @@ -225,7 +225,7 @@ process { ext.args2 = '-f ID PRIMER ERROR' } - withName: 'PRESTO_MASKPRIMERS_SCORE_SANSUMI_REV' { + withName: PRESTO_MASKPRIMERS_SCORE_SANSUMI_REV { publishDir = [ path: { "${params.outdir}/presto/03-maskprimers/${meta.id}" }, mode: params.publish_dir_mode, @@ -234,6 +234,27 @@ process { ext.args2 = '-f ID PRIMER ERROR' } + withName: PRESTO_MASKPRIMERS_ALIGN_SANSUMI_FWD { + publishDir = [ + path: { "${params.outdir}/presto/03-maskprimers/${meta.id}" }, + mode: params.publish_dir_mode, + pattern: "*{txt,log,tab}" + ] + ext.args = '--pf FWD_PRIMER' + ext.args2 = '-f ID PRIMER ERROR' + } + + withName: PRESTO_MASKPRIMERS_ALIGN_SANSUMI_REV { + publishDir = [ + path: { "${params.outdir}/presto/03-maskprimers/${meta.id}" }, + mode: params.publish_dir_mode, + pattern: "*{txt,log,tab}" + ] + ext.args = '--revpr --pf REV_PRIMER' + ext.args2 = '-f ID PRIMER ERROR' + } + + withName: PRESTO_PAIRSEQ { publishDir = [ path: { "${params.outdir}/presto/03-pairseq/${meta.id}" }, @@ -261,12 +282,14 @@ process { ext.args = '--coord illumina' } - withName: PRESTO_CLUSTERSETS { + withName: PRESTO_CLUSTERSETS_UMI { publishDir = [ path: { "${params.outdir}/presto/04-clustersets/${meta.id}" }, mode: params.publish_dir_mode, pattern: "*{txt,log,tab}" ] + ext.args = '--exec vsearch --ident 0.9' + ext.args2 = '-f ID BARCODE SEQCOUNT CLUSTERS' } withName: PRESTO_PARSE_CLUSTER { @@ -277,6 +300,15 @@ process { ] } + withName: PRESTO_PAIRSEQ_CLUSTERSETS { + publishDir = [ + path: { "${params.outdir}/presto/05-parse-clusters/${meta.id}" }, + mode: params.publish_dir_mode, + pattern: "*{txt,log,tab}" + ] + ext.args = '--coord illumina' + } + withName: PRESTO_BUILDCONSENSUS_UMI { publishDir = [ path: { "${params.outdir}/presto/06-build-consensus/${meta.id}" }, @@ -360,7 +392,7 @@ process { mode: params.publish_dir_mode, pattern: "*{txt,log,tab}" ] - ext.args = '--rc tail' + ext.args = '--rc tail --coord illumina' ext.args2 = '-f ID SEQCOUNT PRIMER PRCOUNT PRFREQ LENGTH OVERLAP ERROR PVALUE' } diff --git a/conf/test_maskprimers_extract.config b/conf/test_maskprimers_extract.config index cda79a6b..b43040bc 100644 --- a/conf/test_maskprimers_extract.config +++ b/conf/test_maskprimers_extract.config @@ -21,8 +21,6 @@ params { // Input data input = pipelines_testdata_base_path + 'testdata-bcr/Metadata_test_airr.tsv' - cprimers = pipelines_testdata_base_path + 'testdata-bcr/C_primers.fasta' - vprimers = pipelines_testdata_base_path + 'testdata-bcr/V_primers.fasta' reference_fasta = pipelines_testdata_base_path + 'database-cache/imgtdb_base.zip' reference_igblast = pipelines_testdata_base_path + 'database-cache/igblast_base.zip' diff --git a/modules/local/presto/presto_assemblepairs.nf b/modules/local/presto/presto_assemblepairs.nf index c6ba4287..e108f62a 100644 --- a/modules/local/presto/presto_assemblepairs.nf +++ b/modules/local/presto/presto_assemblepairs.nf @@ -14,7 +14,6 @@ process PRESTO_ASSEMBLEPAIRS { output: tuple val(meta), path("*_assemble-pass.fastq"), emit: reads path("*_command_log.txt"), emit: logs - path("*.log") path("*_table.tab") path "versions.yml" , emit: versions diff --git a/modules/local/presto/presto_assemblepairs_sequential.nf b/modules/local/presto/presto_assemblepairs_sequential.nf index 7d9cabb0..b47b9098 100644 --- a/modules/local/presto/presto_assemblepairs_sequential.nf +++ b/modules/local/presto/presto_assemblepairs_sequential.nf @@ -15,7 +15,6 @@ process PRESTO_ASSEMBLEPAIRS_SEQUENTIAL { output: tuple val(meta), path("*_assemble-pass.fastq"), emit: reads path("*_command_log.txt"), emit: logs - path("*.log") path("*_table.tab") path "versions.yml" , emit: versions diff --git a/modules/local/presto/presto_buildconsensus.nf b/modules/local/presto/presto_buildconsensus.nf index 9572b159..9e6c6c4d 100644 --- a/modules/local/presto/presto_buildconsensus.nf +++ b/modules/local/presto/presto_buildconsensus.nf @@ -14,8 +14,6 @@ process PRESTO_BUILDCONSENSUS { output: tuple val(meta), path("*_R1_consensus-pass.fastq"), path("*_R2_consensus-pass.fastq"), emit: reads path("*_command_log.txt"), emit: logs - path("*_R1.log") - path("*_R2.log") path("*.tab"), emit: log_tab path "versions.yml" , emit: versions diff --git a/modules/local/presto/presto_clustersets.nf b/modules/local/presto/presto_clustersets.nf index 32061f0e..71868b5b 100644 --- a/modules/local/presto/presto_clustersets.nf +++ b/modules/local/presto/presto_clustersets.nf @@ -14,15 +14,16 @@ process PRESTO_CLUSTERSETS { output: tuple val(meta), path("*_R1_cluster-pass.fastq"), path("*_R2_cluster-pass.fastq"), emit: reads path "*_command_log.txt", emit: logs - path "*.log" path "*.tab", emit: log_tab path("versions.yml"), emit: versions script: + def args = task.ext.args ?: '' + def args2 = task.ext.args2 ?: '' """ - ClusterSets.py set --nproc ${task.cpus} -s $R1 --outname ${meta.id}_R1 --exec vsearch --log ${meta.id}_R1.log > ${meta.id}_command_log.txt - ClusterSets.py set --nproc ${task.cpus} -s $R2 --outname ${meta.id}_R2 --exec vsearch --log ${meta.id}_R2.log >> ${meta.id}_command_log.txt - ParseLog.py -l ${meta.id}_R1.log ${meta.id}_R2.log -f ID BARCODE SEQCOUNT CLUSTERS + ClusterSets.py set --nproc ${task.cpus} -s $R1 --outname ${meta.id}_R1 $args --log ${meta.id}_R1.log > ${meta.id}_command_log.txt + ClusterSets.py set --nproc ${task.cpus} -s $R2 --outname ${meta.id}_R2 $args --log ${meta.id}_R2.log >> ${meta.id}_command_log.txt + ParseLog.py -l ${meta.id}_R1.log ${meta.id}_R2.log $args2 cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/local/presto/presto_collapseseq.nf b/modules/local/presto/presto_collapseseq.nf index efbe4def..84177805 100644 --- a/modules/local/presto/presto_collapseseq.nf +++ b/modules/local/presto/presto_collapseseq.nf @@ -14,7 +14,6 @@ process PRESTO_COLLAPSESEQ { output: tuple val(meta), path("*_collapse-unique.fastq") , emit: reads path("*_command_log.txt") , emit: logs - path("*.log") path("*_table.tab") path("versions.yml"), emit: versions diff --git a/modules/local/presto/presto_filterseq.nf b/modules/local/presto/presto_filterseq.nf index a7733147..ee474865 100644 --- a/modules/local/presto/presto_filterseq.nf +++ b/modules/local/presto/presto_filterseq.nf @@ -15,8 +15,6 @@ process PRESTO_FILTERSEQ { tuple val(meta), path("*R1_quality-pass.fastq"), path("*R2_quality-pass.fastq") , emit: reads path "*_command_log_R?.txt" , emit: logs path "versions.yml" , emit: versions - path "*_R1.log" - path "*_R2.log" path "*.tab" , emit: log_tab script: diff --git a/modules/local/presto/presto_filterseq_postassembly.nf b/modules/local/presto/presto_filterseq_postassembly.nf index 0f821f5b..45dfea17 100644 --- a/modules/local/presto/presto_filterseq_postassembly.nf +++ b/modules/local/presto/presto_filterseq_postassembly.nf @@ -15,7 +15,6 @@ process PRESTO_FILTERSEQ_POSTASSEMBLY { tuple val(meta), path("*quality-pass.fastq") , emit: reads path "*_command_log.txt" , emit: logs path "versions.yml" , emit: versions - path "*.log" path "*.tab" , emit: log_tab script: diff --git a/modules/local/presto/presto_maskprimers.nf b/modules/local/presto/presto_maskprimers.nf index 64ba8ac3..26c88854 100644 --- a/modules/local/presto/presto_maskprimers.nf +++ b/modules/local/presto/presto_maskprimers.nf @@ -16,8 +16,6 @@ process PRESTO_MASKPRIMERS { output: tuple val(meta), path("*_R1_primers-pass.fastq"), path("*_R2_primers-pass.fastq") , emit: reads path "*_command_log_R?.txt", emit: logs - path "*_R1.log" - path "*_R2.log" path "*.tab", emit: log_tab path "versions.yml" , emit: versions diff --git a/modules/local/presto/presto_maskprimers_align.nf b/modules/local/presto/presto_maskprimers_align.nf index 055e5d93..59930674 100644 --- a/modules/local/presto/presto_maskprimers_align.nf +++ b/modules/local/presto/presto_maskprimers_align.nf @@ -10,15 +10,15 @@ process PRESTO_MASKPRIMERS_ALIGN { input: tuple val(meta), path(R1) - path(cprimers) + path(primers) val(max_len) val(max_error) val(mask_mode) + val(suffix) output: - tuple val(meta), path("*_R1_primers-pass.fastq") , emit: reads - path "*_command_log_R1.txt", emit: logs - path "*_R1.log" + tuple val(meta), path("*_primers-pass.fastq") , emit: reads + path "*.txt", emit: logs path "*.tab", emit: log_tab path "versions.yml" , emit: versions @@ -28,14 +28,14 @@ process PRESTO_MASKPRIMERS_ALIGN { """ MaskPrimers.py align --nproc ${task.cpus} \\ -s $R1 \\ - -p ${cprimers} \\ + -p ${primers} \\ --maxlen ${max_len} \\ --maxerror ${max_error} \\ --mode ${mask_mode} \\ $args \\ - --outname ${meta.id}_R1 \\ - --log ${meta.id}_R1.log > ${meta.id}_command_log_R1.txt - ParseLog.py -l ${meta.id}_R1.log $args2 + --outname ${meta.id}_${suffix} \\ + --log ${meta.id}_R1.log > ${meta.id}_command_log_${suffix}.txt + ParseLog.py -l ${meta.id}_${suffix}.log $args2 cat <<-END_VERSIONS > versions.yml "${task.process}": diff --git a/modules/local/presto/presto_maskprimers_extract.nf b/modules/local/presto/presto_maskprimers_extract.nf index ddaae736..fad8d624 100644 --- a/modules/local/presto/presto_maskprimers_extract.nf +++ b/modules/local/presto/presto_maskprimers_extract.nf @@ -19,7 +19,6 @@ process PRESTO_MASKPRIMERS_EXTRACT { output: tuple val(meta), path("*_primers-pass.fastq") , emit: reads path "*.txt", emit: logs - path "*.log" path "*.tab", emit: log_tab path "versions.yml" , emit: versions diff --git a/modules/local/presto/presto_maskprimers_postassembly.nf b/modules/local/presto/presto_maskprimers_postassembly.nf index e69a1226..ef5cd4c7 100644 --- a/modules/local/presto/presto_maskprimers_postassembly.nf +++ b/modules/local/presto/presto_maskprimers_postassembly.nf @@ -16,7 +16,6 @@ process PRESTO_MASKPRIMERS_POSTASSEMBLY { output: tuple val(meta), path("*REV_primers-pass.fastq") , emit: reads path "*command_log.txt", emit: logs - path "*.log" path "*.tab", emit: log_tab path "versions.yml" , emit: versions diff --git a/modules/local/presto/presto_maskprimers_score.nf b/modules/local/presto/presto_maskprimers_score.nf index 1e48ea9b..77b90cfc 100644 --- a/modules/local/presto/presto_maskprimers_score.nf +++ b/modules/local/presto/presto_maskprimers_score.nf @@ -21,7 +21,6 @@ process PRESTO_MASKPRIMERS_SCORE { output: tuple val(meta), path("*_primers-pass.fastq"), emit: reads path "*.txt", emit: logs - path "*.log" path "*.tab", emit: log_tab path "versions.yml" , emit: versions diff --git a/subworkflows/local/presto_sans_umi.nf b/subworkflows/local/presto_sans_umi.nf index df121477..0161d769 100644 --- a/subworkflows/local/presto_sans_umi.nf +++ b/subworkflows/local/presto_sans_umi.nf @@ -9,6 +9,8 @@ include { PRESTO_ASSEMBLEPAIRS as PRESTO_ASSEMBLEPAIRS_SANS_UMI } include { PRESTO_FILTERSEQ_POSTASSEMBLY as PRESTO_FILTERSEQ_POSTASSEMBLY_SANS_UMI } from '../../modules/local/presto/presto_filterseq_postassembly' include { PRESTO_MASKPRIMERS_SCORE as PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD } from '../../modules/local/presto/presto_maskprimers_score' include { PRESTO_MASKPRIMERS_SCORE as PRESTO_MASKPRIMERS_SCORE_SANSUMI_REV } from '../../modules/local/presto/presto_maskprimers_score' +include { PRESTO_MASKPRIMERS_ALIGN as PRESTO_MASKPRIMERS_ALIGN_SANSUMI_FWD } from '../../modules/local/presto/presto_maskprimers_align' +include { PRESTO_MASKPRIMERS_ALIGN as PRESTO_MASKPRIMERS_ALIGN_SANSUMI_REV } from '../../modules/local/presto/presto_maskprimers_align' include { PRESTO_PARSEHEADERS_PRIMERS as PRESTO_PARSEHEADERS_PRIMERS_SANS_UMI } from '../../modules/local/presto/presto_parseheaders_primers' include { PRESTO_PARSEHEADERS_METADATA as PRESTO_PARSEHEADERS_METADATA_SANS_UMI } from '../../modules/local/presto/presto_parseheaders_metadata' include { PRESTO_COLLAPSESEQ as PRESTO_COLLAPSESEQ_SANS_UMI } from '../../modules/local/presto/presto_collapseseq' @@ -57,70 +59,126 @@ workflow PRESTO_SANS_UMI { // Mask primers def suffix_FWD = "R1" def suffix_REV = "R2" + def barcode_R1 = false + def barcode_R2 = false ch_reads = PRESTO_FILTERSEQ_POSTASSEMBLY_SANS_UMI.out.reads - if (params.cprimer_position == "R1") { - def start_FWD = "--start ${params.cprimer_start}" - def start_REV = "--start ${params.vprimer_start}" - def revpr_FWD = false - PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD( - ch_reads, - ch_cprimers.collect(), - start_FWD, - params.primer_r1_maxerror, - params.primer_r1_mask_mode, - revpr_FWD, - suffix_FWD - ) - PRESTO_MASKPRIMERS_SCORE_SANSUMI_REV( - PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD.out.reads, - ch_vprimers.collect(), - start_REV, - params.primer_r2_maxerror, - params.primer_r2_mask_mode, - params.primer_revpr, - suffix_REV - ) - } else if (params.cprimer_position == "R2") { - def start_FWD = "--start ${params.vprimer_start}" - def start_REV = "--start ${params.cprimer_start}" - def revpr_FWD = false - - PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD( - ch_reads, - ch_vprimers.collect(), - barcode_R1, - params.primer_r1_maxerror, - params.primer_r1_mask_mode, - revpr_FWD, - suffix_FWD - ) - PRESTO_MASKPRIMERS_SCORE_SANSUMI_REV( - PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD.out.reads, - ch_cprimers.collect(), - barcode_R2, - params.primer_r2_maxerror, - params.primer_r2_mask_mode, - params.primer_revpr, - suffix_REV - ) + if (params.maskprimers_align){ + if (params.cprimer_position == "R1") { + PRESTO_MASKPRIMERS_ALIGN_SANSUMI_FWD( + ch_reads, + ch_cprimers.collect(), + params.primer_maxlen, + params.primer_r1_maxerror, + params.primer_r1_mask_mode, + suffix_FWD + ) + PRESTO_MASKPRIMERS_ALIGN_SANSUMI_REV( + PRESTO_MASKPRIMERS_ALIGN_SANSUMI_FWD.out.reads, + ch_vprimers.collect(), + params.primer_maxlen, + params.primer_r2_maxerror, + params.primer_r2_mask_mode, + suffix_REV + ) + } else if (params.cprimer_position == "R2") { + PRESTO_MASKPRIMERS_ALIGN_SANSUMI_FWD( + ch_reads, + ch_vprimers.collect(), + params.primer_maxlen, + params.primer_r1_maxerror, + params.primer_r1_mask_mode, + suffix_FWD + ) + PRESTO_MASKPRIMERS_ALIGN_SANSUMI_REV( + PRESTO_MASKPRIMERS_ALIGN_SANSUMI_FWD.out.reads, + ch_cprimers.collect(), + params.primer_maxlen, + params.primer_r2_maxerror, + params.primer_r2_mask_mode, + suffix_REV + ) + } else { + error "Error in determining cprimer position. Please choose R1 or R2." + } + + ch_versions = ch_versions.mix(PRESTO_MASKPRIMERS_ALIGN_SANSUMI_FWD.out.versions) + + ch_maskprimers_logs = PRESTO_MASKPRIMERS_ALIGN_SANSUMI_FWD.out.logs + ch_maskprimers_logs = ch_maskprimers_logs.mix(PRESTO_MASKPRIMERS_ALIGN_SANSUMI_REV.out.logs) + + ch_masked_reads = PRESTO_MASKPRIMERS_ALIGN_SANSUMI_REV.out.reads } else { - error "Error in determining cprimer position. Please choose R1 or R2." - } - - ch_versions = ch_versions.mix(PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD.out.versions) + if (params.cprimer_position == "R1") { + def start_FWD = "${params.cprimer_start}" + def start_REV = "${params.vprimer_start}" + def revpr_FWD = false + PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD( + ch_reads, + ch_cprimers.collect(), + start_FWD, + barcode_R1, + params.primer_r1_maxerror, + params.primer_r1_mask_mode, + revpr_FWD, + suffix_FWD + ) + PRESTO_MASKPRIMERS_SCORE_SANSUMI_REV( + PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD.out.reads, + ch_vprimers.collect(), + start_REV, + barcode_R2, + params.primer_r2_maxerror, + params.primer_r2_mask_mode, + params.primer_revpr, + suffix_REV + ) + } else if (params.cprimer_position == "R2") { + def start_FWD = "${params.vprimer_start}" + def start_REV = "${params.cprimer_start}" + def revpr_FWD = false + + PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD( + ch_reads, + ch_vprimers.collect(), + start_FWD, + barcode_R1, + params.primer_r1_maxerror, + params.primer_r1_mask_mode, + revpr_FWD, + suffix_FWD + ) + PRESTO_MASKPRIMERS_SCORE_SANSUMI_REV( + PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD.out.reads, + ch_cprimers.collect(), + start_REV, + barcode_R2, + params.primer_r2_maxerror, + params.primer_r2_mask_mode, + params.primer_revpr, + suffix_REV + ) + } else { + error "Error in determining cprimer position. Please choose R1 or R2." + } + + ch_versions = ch_versions.mix(PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD.out.versions) + + ch_maskprimers_logs = PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD.out.logs + ch_maskprimers_logs = ch_maskprimers_logs.mix(PRESTO_MASKPRIMERS_SCORE_SANSUMI_REV.out.logs) + + ch_masked_reads = PRESTO_MASKPRIMERS_SCORE_SANSUMI_REV.out.reads - ch_maskprimers_logs = PRESTO_MASKPRIMERS_SCORE_SANSUMI_FWD.out.logs - ch_maskprimers_logs = ch_maskprimers_logs.mix(PRESTO_MASKPRIMERS_SCORE_SANSUMI_REV.out.logs) + } // Generate QC stats after reads paired and filtered but before collapsed FASTQC_POSTASSEMBLY_SANS_UMI ( - PRESTO_MASKPRIMERS_SCORE_SANSUMI_REV.out.reads + ch_masked_reads ) ch_versions = ch_versions.mix(FASTQC_POSTASSEMBLY_SANS_UMI.out.versions) // Annotate primers in C_PRIMER and V_PRIMER field PRESTO_PARSEHEADERS_PRIMERS_SANS_UMI ( - PRESTO_MASKPRIMERS_SCORE_SANSUMI_REV.out.reads + ch_masked_reads ) ch_versions = ch_versions.mix(PRESTO_PARSEHEADERS_PRIMERS_SANS_UMI.out.versions) diff --git a/subworkflows/local/presto_umi.nf b/subworkflows/local/presto_umi.nf index 959c42a2..53a932cc 100644 --- a/subworkflows/local/presto_umi.nf +++ b/subworkflows/local/presto_umi.nf @@ -51,6 +51,11 @@ workflow PRESTO_UMI { ch_versions = Channel.empty() + // Validate params + if (params.maskprimers_align & params.umi_position == 'R1') {error "The maskprimers align option is only supported with UMI barcodes in the R2 reads (reads containing V region)."} + if (params.maskprimers_align & params.cprimer_position == 'R2') {error "The maskprimers align option is only supported with Cprimers in the R1 reads (reads containing C region)."} + + // Merge UMI from index file to R1 if provided if (params.index_file) { @@ -120,10 +125,10 @@ workflow PRESTO_UMI { ch_cprimers.collect(), params.primer_maxlen, params.primer_r1_maxerror, - params.primer_r1_mask_mode + params.primer_r1_mask_mode, + "R1" ) - def r2_suffix = "R2" def barcode = true PRESTO_MASKPRIMERS_EXTRACT( ch_reads_R2, @@ -131,7 +136,7 @@ workflow PRESTO_UMI { params.primer_r2_extract_len, params.primer_r2_mask_mode, barcode, - r2_suffix + "R2" ) ch_versions = ch_versions.mix(PRESTO_ALIGN_PRIMERS.out.versions) diff --git a/subworkflows/local/sequence_assembly.nf b/subworkflows/local/sequence_assembly.nf index d001b124..4358394e 100644 --- a/subworkflows/local/sequence_assembly.nf +++ b/subworkflows/local/sequence_assembly.nf @@ -67,18 +67,23 @@ workflow SEQUENCE_ASSEMBLY { // Validate library generation method parameter if (params.library_generation_method == 'specific_pcr_umi'){ - if (params.vprimers) { - ch_vprimers_fasta = Channel.fromPath(params.vprimers, checkIfExists: true) + if (!params.maskprimers_extract){ + if (params.vprimers) { + ch_vprimers_fasta = Channel.fromPath(params.vprimers, checkIfExists: true) + } else { + error "Please provide a V-region primers fasta file with the '--vprimers' option when using the 'specific_pcr_umi' library generation method." + } + if (params.cprimers) { + ch_cprimers_fasta = Channel.fromPath(params.cprimers, checkIfExists: true) + } else { + error "Please provide a C-region primers fasta file with the '--cprimers' option when using the 'specific_pcr_umi' library generation method." + } + if (params.race_linker) { + error "Please do not set '--race_linker' when using the 'specific_pcr_umi' library generation method." + } } else { - error "Please provide a V-region primers fasta file with the '--vprimers' option when using the 'specific_pcr_umi' library generation method." - } - if (params.cprimers) { - ch_cprimers_fasta = Channel.fromPath(params.cprimers, checkIfExists: true) - } else { - error "Please provide a C-region primers fasta file with the '--cprimers' option when using the 'specific_pcr_umi' library generation method." - } - if (params.race_linker) { - error "Please do not set '--race_linker' when using the 'specific_pcr_umi' library generation method." + ch_vprimers_fasta = Channel.of([]) + ch_cprimers_fasta = Channel.of([]) } if (params.umi_length < 2) { error "The 'specific_pcr_umi' library generation method requires setting the '--umi_length' to a value greater than 1." @@ -164,8 +169,6 @@ workflow SEQUENCE_ASSEMBLY { if (params.index_file & params.umi_position == 'R2') {error "Please do not set `--umi_position` option if index file with UMIs is provided."} if (params.umi_length < 0) {error "Please provide the UMI barcode length in the option `--umi_length`. To run without UMIs, set umi_length to 0."} if (!params.index_file & params.umi_start != 0) {error "Setting a UMI start position is only allowed when providing the UMIs in a separate index read file. If so, please provide the `--index_file` flag as well."} - if (params.maskprimers_align & params.umi_position == 'R1') {error "The maskprimers align option is only supported with UMI barcodes in the R2 reads (reads containing V region)."} - if (params.maskprimers_align & params.cprimer_position == 'R2') {error "The maskprimers align option is only supported with Cprimers in the R1 reads (reads containing C region)."} // // SUBWORKFLOW: Read in samplesheet, validate and stage input files