Skip to content

Commit

Permalink
Update subworkflows using macs2 to macs3 after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseEspinosa committed Jul 23, 2024
1 parent 16b73ac commit b0d81e6
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
//
// Call peaks with MACS2, annotate with HOMER and perform downstream QC
// Call peaks with MACS3, annotate with HOMER and perform downstream QC
//

include { MACS2_CALLPEAK } from '../../modules/nf-core/macs2/callpeak/main'
include { MACS3_CALLPEAK } from '../../modules/nf-core/macs3/callpeak/main'
include { HOMER_ANNOTATEPEAKS } from '../../modules/nf-core/homer/annotatepeaks/main'

include { FRIP_SCORE } from '../../modules/local/frip_score'
include { MULTIQC_CUSTOM_PEAKS } from '../../modules/local/multiqc_custom_peaks'
include { PLOT_MACS2_QC } from '../../modules/local/plot_macs2_qc'
include { PLOT_MACS3_QC } from '../../modules/local/plot_macs3_qc'
include { PLOT_HOMER_ANNOTATEPEAKS } from '../../modules/local/plot_homer_annotatepeaks'

workflow BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER {
workflow BAM_PEAKS_CALL_QC_ANNOTATE_MACS3_HOMER {
take:
ch_bam // channel: [ val(meta), [ ip_bam ], [ control_bam ] ]
ch_fasta // channel: [ fasta ]
Expand All @@ -29,29 +29,29 @@ workflow BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER {
ch_versions = Channel.empty()

//
// Call peaks with MACS2
// Call peaks with MACS3
//
MACS2_CALLPEAK (
MACS3_CALLPEAK (
ch_bam,
macs_gsize
)
ch_versions = ch_versions.mix(MACS2_CALLPEAK.out.versions.first())
ch_versions = ch_versions.mix(MACS3_CALLPEAK.out.versions.first())

//
// Filter out samples with 0 MACS2 peaks called
// Filter out samples with 0 MACS3 peaks called
//
MACS2_CALLPEAK
MACS3_CALLPEAK
.out
.peak
.filter {
meta, peaks ->
peaks.size() > 0
}
.set { ch_macs2_peaks }
.set { ch_macs3_peaks }

// Create channels: [ meta, ip_bam, peaks ]
ch_bam
.join(ch_macs2_peaks, by: [0])
.join(ch_macs3_peaks, by: [0])
.map {
meta, ip_bam, control_bam, peaks ->
[ meta, ip_bam, peaks ]
Expand Down Expand Up @@ -86,8 +86,8 @@ workflow BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER {
ch_versions = ch_versions.mix(MULTIQC_CUSTOM_PEAKS.out.versions.first())

ch_homer_annotatepeaks = Channel.empty()
ch_plot_macs2_qc_txt = Channel.empty()
ch_plot_macs2_qc_pdf = Channel.empty()
ch_plot_macs3_qc_txt = Channel.empty()
ch_plot_macs3_qc_pdf = Channel.empty()
ch_plot_homer_annotatepeaks_txt = Channel.empty()
ch_plot_homer_annotatepeaks_pdf = Channel.empty()
ch_plot_homer_annotatepeaks_tsv = Channel.empty()
Expand All @@ -96,7 +96,7 @@ workflow BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER {
// Annotate peaks with HOMER
//
HOMER_ANNOTATEPEAKS (
ch_macs2_peaks,
ch_macs3_peaks,
ch_fasta,
ch_gtf
)
Expand All @@ -105,15 +105,15 @@ workflow BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER {

if (!skip_peak_qc) {
//
// MACS2 QC plots with R
// MACS3 QC plots with R
//
PLOT_MACS2_QC (
ch_macs2_peaks.collect{it[1]},
PLOT_MACS3_QC (
ch_macs3_peaks.collect{it[1]},
is_narrow_peak
)
ch_plot_macs2_qc_txt = PLOT_MACS2_QC.out.txt
ch_plot_macs2_qc_pdf = PLOT_MACS2_QC.out.pdf
ch_versions = ch_versions.mix(PLOT_MACS2_QC.out.versions)
ch_plot_macs3_qc_txt = PLOT_MACS3_QC.out.txt
ch_plot_macs3_qc_pdf = PLOT_MACS3_QC.out.pdf
ch_versions = ch_versions.mix(PLOT_MACS3_QC.out.versions)

//
// Peak annotation QC plots with R
Expand All @@ -131,11 +131,11 @@ workflow BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER {
}

emit:
peaks = ch_macs2_peaks // channel: [ val(meta), [ peaks ] ]
xls = MACS2_CALLPEAK.out.xls // channel: [ val(meta), [ xls ] ]
gapped_peaks = MACS2_CALLPEAK.out.gapped // channel: [ val(meta), [ gapped_peak ] ]
bed = MACS2_CALLPEAK.out.bed // channel: [ val(meta), [ bed ] ]
bedgraph = MACS2_CALLPEAK.out.bdg // channel: [ val(meta), [ bedgraph ] ]
peaks = ch_macs3_peaks // channel: [ val(meta), [ peaks ] ]
xls = MACS3_CALLPEAK.out.xls // channel: [ val(meta), [ xls ] ]
gapped_peaks = MACS3_CALLPEAK.out.gapped // channel: [ val(meta), [ gapped_peak ] ]
bed = MACS3_CALLPEAK.out.bed // channel: [ val(meta), [ bed ] ]
bedgraph = MACS3_CALLPEAK.out.bdg // channel: [ val(meta), [ bedgraph ] ]

frip_txt = FRIP_SCORE.out.txt // channel: [ val(meta), [ txt ] ]

Expand All @@ -144,8 +144,8 @@ workflow BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER {

homer_annotatepeaks = ch_homer_annotatepeaks // channel: [ val(meta), [ txt ] ]

plot_macs2_qc_txt = ch_plot_macs2_qc_txt // channel: [ txt ]
plot_macs2_qc_pdf = ch_plot_macs2_qc_pdf // channel: [ pdf ]
plot_macs3_qc_txt = ch_plot_macs3_qc_txt // channel: [ txt ]
plot_macs3_qc_pdf = ch_plot_macs3_qc_pdf // channel: [ pdf ]

plot_homer_annotatepeaks_txt = ch_plot_homer_annotatepeaks_txt // channel: [ txt ]
plot_homer_annotatepeaks_pdf = ch_plot_homer_annotatepeaks_pdf // channel: [ pdf ]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
include { HOMER_ANNOTATEPEAKS } from '../../modules/nf-core/homer/annotatepeaks/main'
include { SUBREAD_FEATURECOUNTS } from '../../modules/nf-core/subread/featurecounts/main'

include { MACS2_CONSENSUS } from '../../modules/local/macs2_consensus'
include { MACS3_CONSENSUS } from '../../modules/local/macs3_consensus'
include { ANNOTATE_BOOLEAN_PEAKS } from '../../modules/local/annotate_boolean_peaks'
include { DESEQ2_QC } from '../../modules/local/deseq2_qc'

Expand Down Expand Up @@ -54,18 +54,18 @@ workflow BED_CONSENSUS_QUANTIFY_QC_BEDTOOLS_FEATURECOUNTS_DESEQ2 {
//
// Generate consensus peaks across samples
//
MACS2_CONSENSUS (
MACS3_CONSENSUS (
ch_antibody_peaks,
is_narrow_peak
)
ch_versions = ch_versions.mix(MACS2_CONSENSUS.out.versions)
ch_versions = ch_versions.mix(MACS3_CONSENSUS.out.versions)

//
// Annotate consensus peaks
//
if (!skip_peak_annotation) {
HOMER_ANNOTATEPEAKS (
MACS2_CONSENSUS.out.bed,
MACS3_CONSENSUS.out.bed,
ch_fasta,
ch_gtf
)
Expand All @@ -75,13 +75,13 @@ workflow BED_CONSENSUS_QUANTIFY_QC_BEDTOOLS_FEATURECOUNTS_DESEQ2 {
// MODULE: Add boolean fields to annotated consensus peaks to aid filtering
//
ANNOTATE_BOOLEAN_PEAKS (
MACS2_CONSENSUS.out.boolean_txt.join(HOMER_ANNOTATEPEAKS.out.txt, by: [0]),
MACS3_CONSENSUS.out.boolean_txt.join(HOMER_ANNOTATEPEAKS.out.txt, by: [0]),
)
ch_versions = ch_versions.mix(ANNOTATE_BOOLEAN_PEAKS.out.versions)
}

// Create channels: [ meta, [ ip_bams ], saf ]
MACS2_CONSENSUS
MACS3_CONSENSUS
.out
.saf
.map {
Expand Down Expand Up @@ -134,12 +134,12 @@ workflow BED_CONSENSUS_QUANTIFY_QC_BEDTOOLS_FEATURECOUNTS_DESEQ2 {
}

emit:
consensus_bed = MACS2_CONSENSUS.out.bed // channel: [ bed ]
consensus_saf = MACS2_CONSENSUS.out.saf // channel: [ saf ]
consensus_pdf = MACS2_CONSENSUS.out.pdf // channel: [ pdf ]
consensus_txt = MACS2_CONSENSUS.out.txt // channel: [ pdf ]
consensus_boolean_txt = MACS2_CONSENSUS.out.boolean_txt // channel: [ txt ]
consensus_intersect_txt = MACS2_CONSENSUS.out.intersect_txt // channel: [ txt ]
consensus_bed = MACS3_CONSENSUS.out.bed // channel: [ bed ]
consensus_saf = MACS3_CONSENSUS.out.saf // channel: [ saf ]
consensus_pdf = MACS3_CONSENSUS.out.pdf // channel: [ pdf ]
consensus_txt = MACS3_CONSENSUS.out.txt // channel: [ pdf ]
consensus_boolean_txt = MACS3_CONSENSUS.out.boolean_txt // channel: [ txt ]
consensus_intersect_txt = MACS3_CONSENSUS.out.intersect_txt // channel: [ txt ]

featurecounts_txt = SUBREAD_FEATURECOUNTS.out.counts // channel: [ txt ]
featurecounts_summary = SUBREAD_FEATURECOUNTS.out.summary // channel: [ txt ]
Expand Down
26 changes: 13 additions & 13 deletions workflows/chipseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ include { INPUT_CHECK } from '../subworkflows/local/input_check'
include { ALIGN_STAR } from '../subworkflows/local/align_star'
include { BAM_FILTER_BAMTOOLS } from '../subworkflows/local/bam_filter_bamtools'
include { BAM_BEDGRAPH_BIGWIG_BEDTOOLS_UCSC } from '../subworkflows/local/bam_bedgraph_bigwig_bedtools_ucsc'
include { BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER } from '../subworkflows/local/bam_peaks_call_qc_annotate_macs2_homer.nf'
include { BAM_PEAKS_CALL_QC_ANNOTATE_MACS3_HOMER } from '../subworkflows/local/bam_peaks_call_qc_annotate_macs3_homer.nf'
include { BED_CONSENSUS_QUANTIFY_QC_BEDTOOLS_FEATURECOUNTS_DESEQ2 } from '../subworkflows/local/bed_consensus_quantify_qc_bedtools_featurecounts_deseq2.nf'

/*
Expand Down Expand Up @@ -446,9 +446,9 @@ workflow CHIPSEQ {
.set { ch_ip_control_bam }

//
// SUBWORKFLOW: Call peaks with MACS2, annotate with HOMER and perform downstream QC
// SUBWORKFLOW: Call peaks with MACS3, annotate with HOMER and perform downstream QC
//
BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER (
BAM_PEAKS_CALL_QC_ANNOTATE_MACS3_HOMER (
ch_ip_control_bam,
ch_fasta,
ch_gtf,
Expand All @@ -461,7 +461,7 @@ workflow CHIPSEQ {
params.skip_peak_annotation,
params.skip_peak_qc
)
ch_versions = ch_versions.mix(BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER.out.versions)
ch_versions = ch_versions.mix(BAM_PEAKS_CALL_QC_ANNOTATE_MACS3_HOMER.out.versions)

//
// Consensus peaks analysis
Expand All @@ -481,7 +481,7 @@ workflow CHIPSEQ {
.set { ch_antibody_bams }

BED_CONSENSUS_QUANTIFY_QC_BEDTOOLS_FEATURECOUNTS_DESEQ2 (
BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER.out.peaks,
BAM_PEAKS_CALL_QC_ANNOTATE_MACS3_HOMER.out.peaks,
ch_antibody_bams,
ch_fasta,
ch_gtf,
Expand All @@ -491,8 +491,8 @@ workflow CHIPSEQ {
params.skip_peak_annotation,
params.skip_deseq2_qc
)
ch_macs2_consensus_bed_lib = BED_CONSENSUS_QUANTIFY_QC_BEDTOOLS_FEATURECOUNTS_DESEQ2.out.consensus_bed
ch_macs2_consensus_txt_lib = BED_CONSENSUS_QUANTIFY_QC_BEDTOOLS_FEATURECOUNTS_DESEQ2.out.consensus_txt
ch_macs3_consensus_bed_lib = BED_CONSENSUS_QUANTIFY_QC_BEDTOOLS_FEATURECOUNTS_DESEQ2.out.consensus_bed
ch_macs3_consensus_txt_lib = BED_CONSENSUS_QUANTIFY_QC_BEDTOOLS_FEATURECOUNTS_DESEQ2.out.consensus_txt
ch_subreadfeaturecounts_multiqc = BED_CONSENSUS_QUANTIFY_QC_BEDTOOLS_FEATURECOUNTS_DESEQ2.out.featurecounts_summary
ch_deseq2_pca_multiqc = BED_CONSENSUS_QUANTIFY_QC_BEDTOOLS_FEATURECOUNTS_DESEQ2.out.deseq2_qc_pca_multiqc
ch_deseq2_clustering_multiqc = BED_CONSENSUS_QUANTIFY_QC_BEDTOOLS_FEATURECOUNTS_DESEQ2.out.deseq2_qc_dists_multiqc
Expand All @@ -508,9 +508,9 @@ workflow CHIPSEQ {
params.narrow_peak ? 'narrow_peak' : 'broad_peak',
ch_fasta,
BAM_BEDGRAPH_BIGWIG_BEDTOOLS_UCSC.out.bigwig.collect{it[1]}.ifEmpty([]),
BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER.out.peaks.collect{it[1]}.ifEmpty([]),
ch_macs2_consensus_bed_lib.collect{it[1]}.ifEmpty([]),
ch_macs2_consensus_txt_lib.collect{it[1]}.ifEmpty([])
BAM_PEAKS_CALL_QC_ANNOTATE_MACS3_HOMER.out.peaks.collect{it[1]}.ifEmpty([]),
ch_macs3_consensus_bed_lib.collect{it[1]}.ifEmpty([]),
ch_macs3_consensus_txt_lib.collect{it[1]}.ifEmpty([])
)
ch_versions = ch_versions.mix(IGV.out.versions)
}
Expand Down Expand Up @@ -568,9 +568,9 @@ workflow CHIPSEQ {
ch_multiqc_phantompeakqualtools_rsc_multiqc.collect{it[1]}.ifEmpty([]),
ch_multiqc_phantompeakqualtools_correlation_multiqc.collect{it[1]}.ifEmpty([]),

BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER.out.frip_multiqc.collect{it[1]}.ifEmpty([]),
BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER.out.peak_count_multiqc.collect{it[1]}.ifEmpty([]),
BAM_PEAKS_CALL_QC_ANNOTATE_MACS2_HOMER.out.plot_homer_annotatepeaks_tsv.collect().ifEmpty([]),
BAM_PEAKS_CALL_QC_ANNOTATE_MACS3_HOMER.out.frip_multiqc.collect{it[1]}.ifEmpty([]),
BAM_PEAKS_CALL_QC_ANNOTATE_MACS3_HOMER.out.peak_count_multiqc.collect{it[1]}.ifEmpty([]),
BAM_PEAKS_CALL_QC_ANNOTATE_MACS3_HOMER.out.plot_homer_annotatepeaks_tsv.collect().ifEmpty([]),
ch_subreadfeaturecounts_multiqc.collect{it[1]}.ifEmpty([]),

ch_deseq2_pca_multiqc.collect().ifEmpty([]),
Expand Down

0 comments on commit b0d81e6

Please # to comment.