Skip to content

Commit

Permalink
Add support for aligning untrimmed reads (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
dfornika authored Aug 31, 2024
1 parent 472d69d commit 8dfd971
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 10 deletions.
28 changes: 20 additions & 8 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@ workflow {

fastp(ch_illumina_fastq)

if (! params.align_untrimmed_reads) {
ch_illumina_reads_to_align = fastp.out.trimmed_reads
} else {
ch_illumina_reads_to_align = ch_illumina_fastq
}

nanoq_pre_filter(ch_nanopore_fastq.combine(Channel.of("pre_filter")))

filtlong(ch_nanopore_fastq)
Expand All @@ -74,11 +80,17 @@ workflow {

merge_nanoq_reports(nanoq_pre_filter.out.report.join(nanoq_post_filter.out.report))

bwa_mem(fastp.out.reads.join(ch_indexed_ref))
if (! params.align_unfiltered_reads) {
ch_nanopore_reads_to_align = filtlong.out.filtered_reads
} else {
ch_nanopore_reads_to_align = ch_nanopore_fastq
}

bwa_mem(ch_illumina_reads_to_align.join(ch_indexed_ref))

ch_bwa_alignment = bwa_mem.out.alignment

minimap2(ch_nanopore_fastq.join(ch_indexed_ref))
minimap2(ch_nanopore_reads_to_align.join(ch_indexed_ref))

ch_minimap2_alignment = minimap2.out.alignment

Expand Down Expand Up @@ -137,8 +149,8 @@ workflow {
// ...and then concatenate them all together in the 'collect_provenance' process.
ch_provenance = ch_provenance.combine(ch_pipeline_provenance).map{ it -> [it[0], [it[1]]] }
ch_provenance = ch_provenance.join(hash_ref.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
ch_provenance = ch_provenance.join(hash_fastq_short.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
ch_provenance = ch_provenance.join(fastp.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
ch_provenance = ch_provenance.join(hash_fastq_short.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
ch_provenance = ch_provenance.join(fastp.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
if (params.align_long_reads) {
ch_provenance = ch_provenance.join(hash_fastq_long.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
}
Expand All @@ -149,10 +161,10 @@ workflow {
ch_provenance = ch_provenance.join(nanoq_post_filter.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
ch_provenance = ch_provenance.join(minimap2.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
}
ch_provenance = ch_provenance.join(qualimap_bamqc.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
ch_provenance = ch_provenance.join(samtools_mpileup.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
ch_provenance = ch_provenance.join(samtools_stats.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
ch_provenance = ch_provenance.join(freebayes.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
ch_provenance = ch_provenance.join(qualimap_bamqc.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
ch_provenance = ch_provenance.join(samtools_mpileup.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
ch_provenance = ch_provenance.join(samtools_stats.out.provenance).map{ it -> [it[0], it[1] << it[2]] }
ch_provenance = ch_provenance.join(freebayes.out.provenance).map{ it -> [it[0], it[1] << it[2]] }

collect_provenance(ch_provenance)

Expand Down
2 changes: 1 addition & 1 deletion modules/short_read_qc.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ process fastp {
output:
tuple val(sample_id), path("${sample_id}_fastp.json"), emit: fastp_json
tuple val(sample_id), path("${sample_id}_fastp.csv"), emit: fastp_csv
tuple val(sample_id), path("${sample_id}_trimmed_R1.fastq.gz"), path("${sample_id}_trimmed_R2.fastq.gz"), emit: reads
tuple val(sample_id), path("${sample_id}_trimmed_R1.fastq.gz"), path("${sample_id}_trimmed_R2.fastq.gz"), emit: trimmed_reads
tuple val(sample_id), path("${sample_id}_fastp_provenance.yml"), emit: provenance

script:
Expand Down
3 changes: 2 additions & 1 deletion nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ manifest {
description = 'Alignment and variant calling pipeline'
mainScript = 'main.nf'
nextflowVersion = '>=20.01.0'
version = '0.1.10'
version = '0.1.11'
}

params {
Expand Down Expand Up @@ -33,6 +33,7 @@ params {
coverage_plot_height_inches_per_chrom = 2
coverage_plot_window_size = 1000
qualimap_memory = '4G'
align_untrimmed_reads = false
skip_alignment_cleaning = false
align_long_reads = false
ref = 'NO_FILE'
Expand Down

0 comments on commit 8dfd971

Please sign in to comment.