Skip to content

Commit

Permalink
add basic host filter step
Browse files Browse the repository at this point in the history
  • Loading branch information
jts authored and mlaszloffy committed Jul 14, 2020
1 parent 42d198f commit 6c68916
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
7 changes: 4 additions & 3 deletions conf/base.config
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ params{
basecalled_fastq = false
fast5_pass = false
sequencing_summary = false
ref = false
bed = false
ref = '/.mounts/labs/simpsonlab/projects/ncov/ref/artic-ncov2019/primer_schemes/nCoV-2019/V3/nCoV-2019.reference.fasta'
bed = '/.mounts/labs/gsiprojects/genomics/SARS-CoV-2/PHOCOV2/ncov2019ArticNf.manual.V3/nCoV-2019.bed'
human_ref = '/.mounts/labs/simpsonlab/data/references/GRCh38_no_alt_analysis_set.GCA_000001405.15.fna'
profile = false

// Repo to download your primer scheme from
Expand All @@ -21,7 +22,7 @@ params{
scheme = 'nCoV-2019'

// Scheme version
schemeVersion = 'V2'
schemeVersion = 'V3'

// Run experimental medaka pipeline? Specify in the command using "--medaka"
medaka = false
Expand Down
4 changes: 4 additions & 0 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ include printHelp from './modules/help.nf'
include {articNcovNanopore} from './workflows/articNcovNanopore.nf'
include {ncovIllumina} from './workflows/illuminaNcov.nf'
include {ncovIlluminaCram} from './workflows/illuminaNcov.nf'
include {getSampleId; prepareFastqPair; performHostFilter} from './modules/utils'

if (params.help){
printHelp()
Expand Down Expand Up @@ -71,7 +72,10 @@ if ( ! params.prefix ) {

// main workflow
workflow {

if ( params.illumina ) {
performHostFilter(prepareFastqPair.out)

if (params.cram) {
Channel.fromPath( "${params.directory}/**.cram" )
.map { file -> tuple(file.baseName, file) }
Expand Down
13 changes: 13 additions & 0 deletions modules/utils.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
process performHostFilter {
input:
tuple(val(sampleId), path(forward), path(reverse))
output:
tuple sampleId, path("${sampleId}_hostfiltered_R1.fastq.gz"), path("${sampleId}_hostfiltered_R2.fastq.gz"), emit: fastqPairs

script:
"""
bwa mem -t ${task.cpus} ${params.human_ref} ${forward} ${reverse} | samtools view -q 30 -U ${sampleId}.host_unaligned.bam -Sb > ${sampleId}.host_aligned.bam
samtools sort -n ${sampleId}.host_unaligned.bam | \
samtools fastq -1 ${sampleId}_hostfiltered_R1.fastq.gz -2 ${sampleId}_hostfiltered_R2.fastq.gz -s ${sampleId}_singletons.fastq.gz -
"""
}

0 comments on commit 6c68916

Please sign in to comment.