Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use subworkflows/local/bam_bedgraph_bigwig_bedtools_ucsc from nf-core… #399

Merged
merged 5 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions subworkflows/local/bam_bedgraph_bigwig_bedtools_ucsc.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

bjlang marked this conversation as resolved.
Show resolved Hide resolved
//
// 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
Loading