Commit 08ca4872 authored by Acivico's avatar Acivico
Browse files
parents 5cdd0e69 0f0fc8d7
......@@ -81,8 +81,8 @@ include { SUB_TRIMMED_FASTQ } from './subworkflows/trimmed_fastq'
include { SUB_BWA_MEM } from './subworkflows/bwa_mem'
include { SUB_SAMTOOLS_VIEW_SAM2BAM } from './subworkflows/samtools_view_sam2bam'
include { SUB_SAMTOOLS_SORT } from './subworkflows/samtools_sort'
include { SUB_SAMTOOLS_MERGE } from './subworkflows/samtools_merge'
include { SUB_SAMTOOLS_INDEX } from './subworkflows/samtools_index'
include { SAMTOOLS_MERGE } from './modules/samtools_merge'
include { SAMTOOLS_INDEX } from './modules/samtools_index'
include { SUB_PICARD_MARKDUPLICATES } from './subworkflows/picard_markduplicates'
include { SUB_BAM_FILTERING } from './subworkflows/bam_filtering'
include { SUB_CNV_MANTA } from './subworkflows/cnv_manta'
......@@ -91,7 +91,7 @@ include { SUB_CNV_EXOMEDEPTH } from './subworkflows/cnv_exomedepth'
include { SUB_CNV_CODEX } from './subworkflows/cnv_codex'
include { SUB_FINAL_FILTERING } from './subworkflows/final_filtering'
workflow{
workflow {
if( params.generate_bwa_indexes ) {
output_bwa_index = SUB_BWA_INDEX(reference_fasta)
indexFiles = output_bwa_index.indexs.combine(output_bwa_index.fai).collect()
......@@ -103,66 +103,65 @@ workflow{
SUB_TRIMMED_FASTQ(fastq)
SUB_BWA_MEM(SUB_TRIMMED_FASTQ.out.reads, indexFiles)
SUB_BWA_MEM(
SUB_TRIMMED_FASTQ.out.reads,
indexFiles
)
SUB_SAMTOOLS_VIEW_SAM2BAM(
SUB_BWA_MEM.out.output_paired,
SUB_BWA_MEM.out.output_unpairedR1,
SUB_BWA_MEM.out.output_unpairedR2
SUB_BWA_MEM.out.paired,
SUB_BWA_MEM.out.unpairedR1,
SUB_BWA_MEM.out.unpairedR2
)
SUB_SAMTOOLS_SORT(
SUB_SAMTOOLS_VIEW_SAM2BAM.out.reads,
SUB_SAMTOOLS_VIEW_SAM2BAM.out.paired,
SUB_SAMTOOLS_VIEW_SAM2BAM.out.unpairedR1,
SUB_SAMTOOLS_VIEW_SAM2BAM.out.unpairedR2
)
SUB_SAMTOOLS_MERGE(
SAMTOOLS_MERGE(
SUB_SAMTOOLS_SORT.out.paired,
SUB_SAMTOOLS_SORT.out.unpairedR1,
SUB_SAMTOOLS_SORT.out.unpairedR2
)
SUB_SAMTOOLS_INDEX(
SUB_SAMTOOLS_MERGE.out.output
SAMTOOLS_INDEX(
SAMTOOLS_MERGE.out.output
)
SUB_PICARD_MARKDUPLICATES(
SUB_SAMTOOLS_INDEX.out.output
)
SUB_BAM_FILTERING(
SUB_PICARD_MARKDUPLICATES.out.alignments
)
SUB_PICARD_MARKDUPLICATES( SUB_SAMTOOLS_INDEX.out.output )
SUB_BAM_FILTERING( SUB_PICARD_MARKDUPLICATES.out.alignments )
if( params.enable_manta )
SUB_CNV_MANTA (
SUB_CNV_MANTA (
SUB_BAM_FILTERING.out,
samples,
indexFiles,
bed,
manta_filter_script,
collapse_script,
tbi
)
if( params.enable_gridss )
SUB_CNV_GRIDSS (
bed
)
SUB_CNV_GRIDSS (
SUB_BAM_FILTERING.out,
samples,
indexFiles,
blacklist,
structural_variants_script,
gridss_filter_script,
collapse_script
)
if( params.enable_exomeDepth )
SUB_CNV_EXOMEDEPTH (
SUB_BAM_FILTERING.out,
samples,
indexFiles
)
if( params.enable_codex )
SUB_CNV_CODEX (
SUB_BAM_FILTERING.out,
samples,
bed
)
// SUB_FINAL_FILTERING ( final_filtering )
indexFiles
)
SUB_CNV_EXOMEDEPTH (
SUB_BAM_FILTERING.out,
samples,
indexFiles
)
SUB_CNV_CODEX(
SUB_BAM_FILTERING.out,
samples,
bed
)
SUB_FINAL_FILTERING(final_filtering)
}
process BWA_MEM_PAIRED {
tag { "bwa-mem paired" }
tag { "bwa mem" }
container 'quay.io/biocontainers/bwa:0.7.17--h84994c4_5'
input:
......
process BWA_MEM_UNPAIRED {
tag { "bwa-mem unpaired" }
tag { "bwa mem" }
container 'quay.io/biocontainers/bwa:0.7.17--h84994c4_5'
input:
......
process PICARD_MARKDUPLICATES {
tag "picard markduplicates"
tag { "picard MarkDuplicates "}
container 'quay.io/biocontainers/picard:2.10.6--py35_0'
input:
path input
......@@ -20,4 +20,4 @@ process PICARD_MARKDUPLICATES {
METRICS_FILE=\$outputName.dedup.metrics.txt \\
ASSUME_SORTED=TRUE
"""
}
\ No newline at end of file
}
params.bamsDir = ""
process SAMTOOLS_INDEX {
tag "samtools index"
tag { "samtools index" }
container 'quay.io/biocontainers/samtools:1.5--2'
publishDir "${params.outputDir}/${params.bamsDir}", enabled: params.bamsDir, mode: 'copy'
input:
path input
output:
tuple path(input), path("*.sorted*.bai")
tuple path(input), path("*.sorted*.bai"), emit: output
script:
"""
samtools index -b $input
"""
}
\ No newline at end of file
}
process SAMTOOLS_MERGE {
tag "samtools merge"
tag { "samtools merge" }
container 'quay.io/biocontainers/samtools:1.5--2'
input:
path paired
path unpairedR1
path unpairedR2
output:
path "${paired.simpleName}.sorted.bam", emit: output_samtools_merge
path "${paired.simpleName}.sorted.bam", emit: output
script:
def threadsArgument = params.threads_samtools ? "--threads $params.threads_samtools" : ""
"""
samtools merge -f $threadsArgument ${paired.simpleName}.sorted.bam $paired $unpairedR1 $unpairedR2
"""
}
\ No newline at end of file
}
process SAMTOOLS_SORT {
tag "samtools sort"
tag { "samtools sort" }
container 'quay.io/biocontainers/samtools:1.5--2'
input:
path input
output:
path "*.sorted.bam", emit: output
path "*.sorted.bam"
script:
def threadsArgument = params.threads_samtools ? "--threads $params.threads_samtools" : ""
"""
name=\$(basename $input)
outputName=\$(echo \${name%.*})
samtools sort $threadsArgument $input -o \$outputName.sorted.bam
"""
}
\ No newline at end of file
}
process SAMTOOLS_VIEW {
tag 'samtools view'
tag { "samtools view" }
container 'quay.io/biocontainers/samtools:1.5--2'
input:
path input
output:
path '*.filtered.bam', emit: output
path '*.filtered.bam'
script:
def min_mapping_qualityArgument = params.min_mapping_quality ? "-q $params.min_mapping_quality" : ''
def bits_setArgument = params.bits_set ? "-F $params.bits_set" : ''
......@@ -18,4 +18,4 @@ process SAMTOOLS_VIEW {
samtools view $threadsArgument $min_mapping_qualityArgument $bits_setArgument $input -o \$outputName.filtered.bam
"""
}
\ No newline at end of file
}
process SAMTOOLS_VIEW_SAM2BAM {
tag "samtools view sam2bam"
tag { "samtools view sam2bam" }
container 'quay.io/biocontainers/samtools:1.5--2'
input:
path input
output:
path "*.bam", emit: output
path "*.bam"
script:
def threadsArgument = params.threads_samtools ? "--threads $params.threads_samtools" : ""
"""
name=\$(basename $input)
outputName=\$(echo \${name%.*})
samtools view $threadsArgument -bS $input -o \$outputName.bam
"""
}
\ No newline at end of file
}
......@@ -9,7 +9,13 @@
// Global default params, used in configs
params {
//Files
fastq = [ "data/fastq_simple/SRR081254_{1,2}.fastq.gz", "data/fastq_simple/SRR078847_{1,2}.fastq.gz" ]
fastq = [ "data/fastq/SRR709972_{1,2}.fastq.gz",
"data/fastq/SRR070528_{1,2}.fastq.gz",
"data/fastq/SRR070819_{1,2}.fastq.gz",
"data/fastq/SRR764718_{1,2}.fastq.gz",
"data/fastq/SRR764689_{1,2}.fastq.gz"
]
generate_bwa_indexes = false
reference_fasta = "data/hs37d5.fa"
reference_fasta_indexs = [ "data/hs37d5.fa.{amb,ann,bwt,pac,sa,fai}" ]
......@@ -30,12 +36,12 @@ params {
merge_all_script = "templates/merge_all.sh"
//params
//threads_fastqc = 2
//threads_fastp = 12
//threads_bwa_mem = 24
//threads_bwa_mem = 1
//threads_samtools = 8
//threads_gridss = 8
threads_fastqc = 2
threads_fastp = 12
threads_bwa_mem = 24
threads_bwa_mem = 1
threads_samtools = 8
threads_gridss = 8
cut_right = true
cut_right_window_size = 5
cut_right_mean_quality = 24
......
params.bamsDir = "output_bams"
/*
* Include for bam_filtering
*/
......@@ -6,20 +8,20 @@ include {
} from "../modules/samtools_view"
include {
SAMTOOLS_INDEX
} from "../modules/samtools_index"
} from "../modules/samtools_index" params([*:params, "bamsDir": ""])
/*
* Subworkflow bam_filtering
* Subworkflow bam_filtering
*/
workflow SUB_BAM_FILTERING {
take:
input
input
main:
SAMTOOLS_VIEW( input )
SAMTOOLS_INDEX( SAMTOOLS_VIEW.out )
SAMTOOLS_VIEW(input)
SAMTOOLS_INDEX(SAMTOOLS_VIEW.out)
emit:
output = SAMTOOLS_INDEX.out
}
\ No newline at end of file
bams = SAMTOOLS_INDEX.out
}
......@@ -2,7 +2,7 @@
* Include for bwa_mem
*/
include {
BWA_MEM_PAIRED as BWA_MEM_READS
BWA_MEM_PAIRED as BWA_MEM_PAIRED
} from "../modules/bwa_mem_paired"
include {
BWA_MEM_UNPAIRED as BWA_MEM_UNPAIRED1
......@@ -27,12 +27,12 @@ workflow SUB_BWA_MEM {
unpaired1 = reads.map{it[3]}
unpaired2 = reads.map{it[4]}
BWA_MEM_READS(srr_id, paired1, paired2, indexFiles)
BWA_MEM_PAIRED(srr_id, paired1, paired2, indexFiles)
BWA_MEM_UNPAIRED1(srr_id, unpaired1, indexFiles)
BWA_MEM_UNPAIRED2(srr_id, unpaired2, indexFiles)
emit:
output_paired = BWA_MEM_READS.out
output_unpairedR1 = BWA_MEM_UNPAIRED1.out
output_unpairedR2 = BWA_MEM_UNPAIRED2.out
paired = BWA_MEM_PAIRED.out
unpairedR1 = BWA_MEM_UNPAIRED1.out
unpairedR2 = BWA_MEM_UNPAIRED2.out
}
......@@ -4,10 +4,6 @@
include {
PICARD_MARKDUPLICATES
} from "../modules/picard_markduplicates"
/*
* Include for samtools_index
*/
include {
SAMTOOLS_INDEX
} from "../modules/samtools_index"
......@@ -18,12 +14,12 @@ include {
workflow SUB_PICARD_MARKDUPLICATES {
take:
input
main:
PICARD_MARKDUPLICATES(input)
SAMTOOLS_INDEX(PICARD_MARKDUPLICATES.out.alignments)
emit:
alignments = SAMTOOLS_INDEX.out
metrics = PICARD_MARKDUPLICATES.out.metrics
}
\ No newline at end of file
}
/*
* Include for samtools_index
*/
include {
SAMTOOLS_INDEX
} from "../modules/samtools_index"
/*
* Subworkflow samtools_index
*/
workflow SUB_SAMTOOLS_INDEX {
take:
input
main:
SAMTOOLS_INDEX(input)
emit:
output = SAMTOOLS_INDEX.out
}
\ No newline at end of file
/*
* Include for samtools_merge
*/
include {
SAMTOOLS_MERGE
} from "../modules/samtools_merge"
/*
* Subworkflow samtools_merge
*/
workflow SUB_SAMTOOLS_MERGE {
take:
paired
unpaired_R1
unpaired_R2
main:
SAMTOOLS_MERGE(paired,
unpaired_R1,
unpaired_R2)
emit:
output = SAMTOOLS_MERGE.out
}
\ No newline at end of file
......@@ -29,4 +29,4 @@ workflow SUB_SAMTOOLS_SORT {
paired = SAMTOOLS_SORT_PAIRED.out
unpairedR1 = SAMTOOLS_SORT_UNPAIRED_R1.out
unpairedR2 = SAMTOOLS_SORT_UNPAIRED_R2.out
}
\ No newline at end of file
}
/*
* Include for samtools_view_sam2bam
* Include for samtools_view_sam2bam
*/
include {
SAMTOOLS_VIEW_SAM2BAM as SAMTOOLS_VIEW_SAM2BAM_READS
SAMTOOLS_VIEW_SAM2BAM as SAMTOOLS_VIEW_SAM2BAM_PAIRED
} from "../modules/samtools_view_sam2bam"
include {
SAMTOOLS_VIEW_SAM2BAM as SAMTOOLS_VIEW_SAM2BAM_UNPAIRED1
......@@ -22,12 +22,12 @@ workflow SUB_SAMTOOLS_VIEW_SAM2BAM {
unpairedR2
main:
SAMTOOLS_VIEW_SAM2BAM_READS(paired)
SAMTOOLS_VIEW_SAM2BAM_PAIRED(paired)
SAMTOOLS_VIEW_SAM2BAM_UNPAIRED1(unpairedR1)
SAMTOOLS_VIEW_SAM2BAM_UNPAIRED2(unpairedR2)
emit:
reads = SAMTOOLS_VIEW_SAM2BAM_READS.out
paired = SAMTOOLS_VIEW_SAM2BAM_PAIRED.out
unpairedR1 = SAMTOOLS_VIEW_SAM2BAM_UNPAIRED1.out
unpairedR2 = SAMTOOLS_VIEW_SAM2BAM_UNPAIRED2.out
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment