Skip to content

Commit

Permalink
Merge pull request #399 from bjlang/dev
Browse files Browse the repository at this point in the history
use subworkflows/local/bam_bedgraph_bigwig_bedtools_ucsc from nf-core…
  • Loading branch information
bjlang authored Jul 5, 2024
2 parents 50915a7 + 53c152c commit 1096fc1
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 23 deletions.
41 changes: 41 additions & 0 deletions subworkflows/local/bam_bedgraph_bigwig_bedtools_ucsc.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
//
// Convert BAM to normalised bigWig via bedGraph using BEDTools and UCSC
//

include { BEDTOOLS_GENOMECOV } from '../../modules/local/bedtools_genomecov'
include { UCSC_BEDGRAPHTOBIGWIG } from '../../modules/nf-core/ucsc/bedgraphtobigwig/main'

workflow BAM_BEDGRAPH_BIGWIG_BEDTOOLS_UCSC {
take:
ch_bam_flagstat // channel: [ val(meta), [bam], [flagstat] ]
ch_chrom_sizes // channel: [ bed ]

main:

ch_versions = Channel.empty()

//
// Create bedGraph coverage track
//
BEDTOOLS_GENOMECOV (
ch_bam_flagstat
)
ch_versions = ch_versions.mix(BEDTOOLS_GENOMECOV.out.versions.first())

//
// Create bigWig coverage tracks
//
UCSC_BEDGRAPHTOBIGWIG (
BEDTOOLS_GENOMECOV.out.bedgraph,
ch_chrom_sizes
)
ch_versions = ch_versions.mix(UCSC_BEDGRAPHTOBIGWIG.out.versions.first())

emit:
bedgraph = BEDTOOLS_GENOMECOV.out.bedgraph // channel: [ val(meta), [ bedgraph ] ]
scale_factor = BEDTOOLS_GENOMECOV.out.scale_factor // channel: [ val(meta), [ txt ] ]

bigwig = UCSC_BEDGRAPHTOBIGWIG.out.bigwig // channel: [ val(meta), [ bigwig ] ]

versions = ch_versions // channel: [ versions.yml ]
}
38 changes: 15 additions & 23 deletions workflows/chipseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
//
// MODULE: Loaded from modules/local/
//
include { BEDTOOLS_GENOMECOV } from '../modules/local/bedtools_genomecov'
include { FRIP_SCORE } from '../modules/local/frip_score'
include { PLOT_MACS2_QC } from '../modules/local/plot_macs2_qc'
include { PLOT_HOMER_ANNOTATEPEAKS } from '../modules/local/plot_homer_annotatepeaks'
Expand All @@ -22,13 +21,14 @@ include { MULTIQC_CUSTOM_PEAKS } from '../modules/local/multiqc_c
//
// SUBWORKFLOW: Consisting of a mix of local and nf-core/modules
//
include { paramsSummaryMap } from 'plugin/nf-validation'
include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'
include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline'
include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_chipseq_pipeline'
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 { paramsSummaryMap } from 'plugin/nf-validation'
include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'
include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline'
include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_chipseq_pipeline'
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'

/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand All @@ -44,7 +44,6 @@ include { PICARD_MERGESAMFILES } from '../modules/nf-core/picard/merges
include { PICARD_COLLECTMULTIPLEMETRICS } from '../modules/nf-core/picard/collectmultiplemetrics/main'
include { PRESEQ_LCEXTRAP } from '../modules/nf-core/preseq/lcextrap/main'
include { PHANTOMPEAKQUALTOOLS } from '../modules/nf-core/phantompeakqualtools/main'
include { UCSC_BEDGRAPHTOBIGWIG } from '../modules/nf-core/ucsc/bedgraphtobigwig/main'
include { DEEPTOOLS_COMPUTEMATRIX } from '../modules/nf-core/deeptools/computematrix/main'
include { DEEPTOOLS_PLOTPROFILE } from '../modules/nf-core/deeptools/plotprofile/main'
include { DEEPTOOLS_PLOTHEATMAP } from '../modules/nf-core/deeptools/plotheatmap/main'
Expand Down Expand Up @@ -358,29 +357,22 @@ workflow CHIPSEQ {
}

//
// MODULE: BedGraph coverage tracks
// SUBWORKFLOW: Normalised bigWig coverage tracks
//
BEDTOOLS_GENOMECOV (
BAM_FILTER_BAMTOOLS.out.bam.join(BAM_FILTER_BAMTOOLS.out.flagstat, by: [0])
)
ch_versions = ch_versions.mix(BEDTOOLS_GENOMECOV.out.versions.first())

//
// MODULE: BigWig coverage tracks
//
UCSC_BEDGRAPHTOBIGWIG (
BEDTOOLS_GENOMECOV.out.bedgraph,
BAM_BEDGRAPH_BIGWIG_BEDTOOLS_UCSC (
BAM_FILTER_BAMTOOLS.out.bam.join(BAM_FILTER_BAMTOOLS.out.flagstat, by: [0]),
ch_chrom_sizes
)
ch_versions = ch_versions.mix(UCSC_BEDGRAPHTOBIGWIG.out.versions.first())
ch_versions = ch_versions.mix(BAM_BEDGRAPH_BIGWIG_BEDTOOLS_UCSC.out.versions)


ch_deeptoolsplotprofile_multiqc = Channel.empty()
if (!params.skip_plot_profile) {
//
// MODULE: deepTools matrix generation for plotting
//
DEEPTOOLS_COMPUTEMATRIX (
UCSC_BEDGRAPHTOBIGWIG.out.bigwig,
BAM_BEDGRAPH_BIGWIG_BEDTOOLS_UCSC.out.bigwig,
ch_gene_bed
)
ch_versions = ch_versions.mix(DEEPTOOLS_COMPUTEMATRIX.out.versions.first())
Expand Down Expand Up @@ -678,7 +670,7 @@ workflow CHIPSEQ {
params.aligner,
params.narrow_peak ? 'narrow_peak' : 'broad_peak',
ch_fasta,
UCSC_BEDGRAPHTOBIGWIG.out.bigwig.collect{it[1]}.ifEmpty([]),
BAM_BEDGRAPH_BIGWIG_BEDTOOLS_UCSC.out.bigwig.collect{it[1]}.ifEmpty([]),
ch_macs2_peaks.collect{it[1]}.ifEmpty([]),
ch_macs2_consensus_bed_lib.collect{it[1]}.ifEmpty([]),
ch_macs2_consensus_txt_lib.collect{it[1]}.ifEmpty([])
Expand Down

0 comments on commit 1096fc1

Please sign in to comment.