Commit 3d7f911f authored by lrodrig1's avatar lrodrig1
Browse files

remove samtools index+merge subworkflows in Nextflow

parent ad399cc9
......@@ -78,8 +78,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'
......@@ -88,7 +88,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()
......@@ -100,52 +100,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_CNV_MANTA (
SUB_BAM_FILTERING.out,
samples,
indexFiles,
bed
)
SUB_CNV_GRIDSS (
SUB_BAM_FILTERING.out,
samples,
indexFiles
)
SUB_CNV_EXOMEDEPTH (
SUB_BAM_FILTERING.out,
samples,
indexFiles
)
SUB_CNV_CODEX(
SUB_BAM_FILTERING.out,
samples,
bed
)
SUB_PICARD_MARKDUPLICATES( SUB_SAMTOOLS_INDEX.out.output )
SUB_BAM_FILTERING( SUB_PICARD_MARKDUPLICATES.out.alignments )
// SUB_CNV_MANTA (
// SUB_BAM_FILTERING.out,
// samples,
// indexFiles,
// bed
// )
// SUB_CNV_GRIDSS (
// SUB_BAM_FILTERING.out,
// samples,
// indexFiles
// )
// SUB_CNV_EXOMEDEPTH (
// SUB_BAM_FILTERING.out,
// samples,
// indexFiles
// )
// SUB_CNV_CODEX (
// SUB_BAM_FILTERING.out,
// samples,
// bed
// )
// SUB_FINAL_FILTERING ( final_filtering )
SUB_FINAL_FILTERING(final_filtering)
}
process SAMTOOLS_INDEX {
tag "samtools index"
tag { "samtools index" }
container 'quay.io/biocontainers/samtools:1.5--2'
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
}
/*
* 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
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