Skip to content

Commit 1096fc1

Browse files
authored
Merge pull request #399 from bjlang/dev
use subworkflows/local/bam_bedgraph_bigwig_bedtools_ucsc from nf-core…
2 parents 50915a7 + 53c152c commit 1096fc1

File tree

2 files changed

+56
-23
lines changed

2 files changed

+56
-23
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
//
2+
// Convert BAM to normalised bigWig via bedGraph using BEDTools and UCSC
3+
//
4+
5+
include { BEDTOOLS_GENOMECOV } from '../../modules/local/bedtools_genomecov'
6+
include { UCSC_BEDGRAPHTOBIGWIG } from '../../modules/nf-core/ucsc/bedgraphtobigwig/main'
7+
8+
workflow BAM_BEDGRAPH_BIGWIG_BEDTOOLS_UCSC {
9+
take:
10+
ch_bam_flagstat // channel: [ val(meta), [bam], [flagstat] ]
11+
ch_chrom_sizes // channel: [ bed ]
12+
13+
main:
14+
15+
ch_versions = Channel.empty()
16+
17+
//
18+
// Create bedGraph coverage track
19+
//
20+
BEDTOOLS_GENOMECOV (
21+
ch_bam_flagstat
22+
)
23+
ch_versions = ch_versions.mix(BEDTOOLS_GENOMECOV.out.versions.first())
24+
25+
//
26+
// Create bigWig coverage tracks
27+
//
28+
UCSC_BEDGRAPHTOBIGWIG (
29+
BEDTOOLS_GENOMECOV.out.bedgraph,
30+
ch_chrom_sizes
31+
)
32+
ch_versions = ch_versions.mix(UCSC_BEDGRAPHTOBIGWIG.out.versions.first())
33+
34+
emit:
35+
bedgraph = BEDTOOLS_GENOMECOV.out.bedgraph // channel: [ val(meta), [ bedgraph ] ]
36+
scale_factor = BEDTOOLS_GENOMECOV.out.scale_factor // channel: [ val(meta), [ txt ] ]
37+
38+
bigwig = UCSC_BEDGRAPHTOBIGWIG.out.bigwig // channel: [ val(meta), [ bigwig ] ]
39+
40+
versions = ch_versions // channel: [ versions.yml ]
41+
}

workflows/chipseq.nf

+15-23
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
//
88
// MODULE: Loaded from modules/local/
99
//
10-
include { BEDTOOLS_GENOMECOV } from '../modules/local/bedtools_genomecov'
1110
include { FRIP_SCORE } from '../modules/local/frip_score'
1211
include { PLOT_MACS2_QC } from '../modules/local/plot_macs2_qc'
1312
include { PLOT_HOMER_ANNOTATEPEAKS } from '../modules/local/plot_homer_annotatepeaks'
@@ -22,13 +21,14 @@ include { MULTIQC_CUSTOM_PEAKS } from '../modules/local/multiqc_c
2221
//
2322
// SUBWORKFLOW: Consisting of a mix of local and nf-core/modules
2423
//
25-
include { paramsSummaryMap } from 'plugin/nf-validation'
26-
include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'
27-
include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline'
28-
include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_chipseq_pipeline'
29-
include { INPUT_CHECK } from '../subworkflows/local/input_check'
30-
include { ALIGN_STAR } from '../subworkflows/local/align_star'
31-
include { BAM_FILTER_BAMTOOLS } from '../subworkflows/local/bam_filter_bamtools'
24+
include { paramsSummaryMap } from 'plugin/nf-validation'
25+
include { paramsSummaryMultiqc } from '../subworkflows/nf-core/utils_nfcore_pipeline'
26+
include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pipeline'
27+
include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_chipseq_pipeline'
28+
include { INPUT_CHECK } from '../subworkflows/local/input_check'
29+
include { ALIGN_STAR } from '../subworkflows/local/align_star'
30+
include { BAM_FILTER_BAMTOOLS } from '../subworkflows/local/bam_filter_bamtools'
31+
include { BAM_BEDGRAPH_BIGWIG_BEDTOOLS_UCSC } from '../subworkflows/local/bam_bedgraph_bigwig_bedtools_ucsc'
3232

3333
/*
3434
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -44,7 +44,6 @@ include { PICARD_MERGESAMFILES } from '../modules/nf-core/picard/merges
4444
include { PICARD_COLLECTMULTIPLEMETRICS } from '../modules/nf-core/picard/collectmultiplemetrics/main'
4545
include { PRESEQ_LCEXTRAP } from '../modules/nf-core/preseq/lcextrap/main'
4646
include { PHANTOMPEAKQUALTOOLS } from '../modules/nf-core/phantompeakqualtools/main'
47-
include { UCSC_BEDGRAPHTOBIGWIG } from '../modules/nf-core/ucsc/bedgraphtobigwig/main'
4847
include { DEEPTOOLS_COMPUTEMATRIX } from '../modules/nf-core/deeptools/computematrix/main'
4948
include { DEEPTOOLS_PLOTPROFILE } from '../modules/nf-core/deeptools/plotprofile/main'
5049
include { DEEPTOOLS_PLOTHEATMAP } from '../modules/nf-core/deeptools/plotheatmap/main'
@@ -358,29 +357,22 @@ workflow CHIPSEQ {
358357
}
359358

360359
//
361-
// MODULE: BedGraph coverage tracks
360+
// SUBWORKFLOW: Normalised bigWig coverage tracks
362361
//
363-
BEDTOOLS_GENOMECOV (
364-
BAM_FILTER_BAMTOOLS.out.bam.join(BAM_FILTER_BAMTOOLS.out.flagstat, by: [0])
365-
)
366-
ch_versions = ch_versions.mix(BEDTOOLS_GENOMECOV.out.versions.first())
367-
368-
//
369-
// MODULE: BigWig coverage tracks
370-
//
371-
UCSC_BEDGRAPHTOBIGWIG (
372-
BEDTOOLS_GENOMECOV.out.bedgraph,
362+
BAM_BEDGRAPH_BIGWIG_BEDTOOLS_UCSC (
363+
BAM_FILTER_BAMTOOLS.out.bam.join(BAM_FILTER_BAMTOOLS.out.flagstat, by: [0]),
373364
ch_chrom_sizes
374365
)
375-
ch_versions = ch_versions.mix(UCSC_BEDGRAPHTOBIGWIG.out.versions.first())
366+
ch_versions = ch_versions.mix(BAM_BEDGRAPH_BIGWIG_BEDTOOLS_UCSC.out.versions)
367+
376368

377369
ch_deeptoolsplotprofile_multiqc = Channel.empty()
378370
if (!params.skip_plot_profile) {
379371
//
380372
// MODULE: deepTools matrix generation for plotting
381373
//
382374
DEEPTOOLS_COMPUTEMATRIX (
383-
UCSC_BEDGRAPHTOBIGWIG.out.bigwig,
375+
BAM_BEDGRAPH_BIGWIG_BEDTOOLS_UCSC.out.bigwig,
384376
ch_gene_bed
385377
)
386378
ch_versions = ch_versions.mix(DEEPTOOLS_COMPUTEMATRIX.out.versions.first())
@@ -678,7 +670,7 @@ workflow CHIPSEQ {
678670
params.aligner,
679671
params.narrow_peak ? 'narrow_peak' : 'broad_peak',
680672
ch_fasta,
681-
UCSC_BEDGRAPHTOBIGWIG.out.bigwig.collect{it[1]}.ifEmpty([]),
673+
BAM_BEDGRAPH_BIGWIG_BEDTOOLS_UCSC.out.bigwig.collect{it[1]}.ifEmpty([]),
682674
ch_macs2_peaks.collect{it[1]}.ifEmpty([]),
683675
ch_macs2_consensus_bed_lib.collect{it[1]}.ifEmpty([]),
684676
ch_macs2_consensus_txt_lib.collect{it[1]}.ifEmpty([])

0 commit comments

Comments
 (0)