Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ampliconstats process for all the files (Samtools development branch) #58

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ This Nextflow pipeline automates the ARTIC network [nCoV-2019 novel coronavirus

You can also use cram file input by passing the --cram flag.
You can also specify cram file output by passing the --outCram flag.
You can also run ampliconstats by passing the --ampliconstats flag.

For production use at large scale, where you will run the workflow many times, you can avoid cloning the scheme repository, creating an ivar bed file and indexing the reference every time by supplying both --ivarBed /path/to/ivar-compatible.bed and --alignerRefPrefix /path/to/bwa-indexed/ref.fa.

Expand Down
2 changes: 2 additions & 0 deletions conf/illumina.config
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ params {
// iVar minimum mapQ to call variant (ivar variants: -q)
ivarMinVariantQuality = 20

// Run samtools ampliconstats
ampliconstats = false
}

def makeFastqSearchPath ( illuminaSuffixes, fastq_exts ) {
Expand Down
22 changes: 22 additions & 0 deletions modules/illumina.nf
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,28 @@ process trimPrimerSequences {
"""
}

process makeAmpliconstats {

publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", pattern: "*.stats", mode: 'copy'
publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", pattern: "*.png", mode: 'copy'
publishDir "${params.outdir}/${task.process.replaceAll(":","_")}", pattern: "*.gp", mode: 'copy'

input:
file (ptrim_bams)
path(bedfile)

output:
path "nCoV-2019.amp.stats", emit: ampstats
path "*.png", emit: amppng
path "*.gp", emit: ampgp

script:
"""
samtools ampliconstats -@8 -d 1,20,100 ${bedfile} *.mapped.primertrimmed.sorted.bam > nCoV-2019.amp.stats
plot-ampliconstats -size 1200,900 nCoV-2019-ampliconstats nCoV-2019.amp.stats
"""
}

process callVariants {

tag { sampleName }
Expand Down
10 changes: 10 additions & 0 deletions workflows/illuminaNcov.nf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ include {readTrimming} from '../modules/illumina.nf'
include {indexReference} from '../modules/illumina.nf'
include {readMapping} from '../modules/illumina.nf'
include {trimPrimerSequences} from '../modules/illumina.nf'
include {makeAmpliconstats} from '../modules/illumina.nf'
include {callVariants} from '../modules/illumina.nf'
include {makeConsensus} from '../modules/illumina.nf'
include {cramToFastq} from '../modules/illumina.nf'
Expand Down Expand Up @@ -121,6 +122,15 @@ workflow sequenceAnalysis {

}

// Generate ampliconstats only if --ampliconstats parameter is passed
if(params.ampliconstats) {
// Create a channel to collect only the mapped.primertrimmed.sorted.bam output files from trimPrimerSequences

trimPrimerSequences.out.ptrim.map{sample, bam -> bam}.collect().set{ ch_ptrim_bam }

makeAmpliconstats(ch_ptrim_bam, ch_bedFile)
}

emit:
qc_pass = collateSamples.out
}
Expand Down