Skip to content

Commit 09ca349

Browse files
committed
Add antibody directory to consensus peaks in IGV session
1 parent 3ed06fa commit 09ca349

File tree

3 files changed

+21
-27
lines changed

3 files changed

+21
-27
lines changed

modules/local/igv.nf

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,28 +9,31 @@ process IGV {
99
'quay.io/biocontainers/python:3.8.3' }"
1010

1111
input:
12+
val aligner_dir
13+
val peak_dir
1214
path fasta
13-
path ("${bigwig_publish_dir}/*")
14-
path ("${peak_publish_dir}/*")
15-
path ("${consensus_publish_dir}/*")
16-
val bigwig_publish_dir
17-
val peak_publish_dir
18-
val consensus_publish_dir
19-
15+
path ("${aligner_dir}/mergedLibrary/bigwig/*")
16+
path ("${aligner_dir}/mergedLibrary/macs2/${peak_dir}/*")
17+
path ("${aligner_dir}/mergedLibrary/macs2/${peak_dir}/consensus/*")
18+
path ("mappings/*")
19+
2020
output:
2121
path "*files.txt" , emit: txt
2222
path "*.xml" , emit: xml
2323
path "versions.yml", emit: versions
2424

2525
script: // scripts are bundled with the pipeline in nf-core/chipseq/bin/
26+
def consensus_dir = "${aligner_dir}/mergedLibrary/macs2/${peak_dir}/consensus/*"
2627
"""
2728
find * -type l -name "*.bigWig" -exec echo -e ""{}"\\t0,0,178" \\; > bigwig.igv.txt
2829
find * -type l -name "*Peak" -exec echo -e ""{}"\\t0,0,178" \\; > peaks.igv.txt
2930
# Avoid error when consensus not produced
30-
find * -type l -name "*.bed" -exec echo -e ""{}"\\t0,0,178" \\; | { grep "^$consensus_publish_dir" || test \$? = 1; } > bed.igv.txt
31+
find * -type l -name "*.bed" -exec echo -e ""{}"\\t0,0,178" \\; | { grep "^$consensus_dir" || test \$? = 1; } > consensus.igv.txt
32+
33+
cat mappings/* > replace_paths.txt
3134
32-
cat *.txt > igv_files.txt
33-
igv_files_to_session.py igv_session.xml igv_files.txt ../../genome/${fasta.getName()} --path_prefix '../../'
35+
cat *.igv.txt > igv_files_orig.txt
36+
igv_files_to_session.py igv_session.xml igv_files_orig.txt replace_paths.txt ../../genome/${fasta.getName()} --path_prefix '../../'
3437
3538
cat <<-END_VERSIONS > versions.yml
3639
"${task.process}":

modules/local/macs2_consensus.nf

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ process MACS2_CONSENSUS {
1717
tuple val(meta), path("*.bed") , emit: bed
1818
tuple val(meta), path("*.saf") , emit: saf
1919
tuple val(meta), path("*.pdf") , emit: pdf
20+
tuple val(meta), path("*.antibody.txt") , emit: txt
2021
tuple val(meta), path("*.boolean.txt") , emit: boolean_txt
2122
tuple val(meta), path("*.intersect.txt"), emit: intersect_txt
2223
path "versions.yml" , emit: versions
@@ -25,7 +26,6 @@ process MACS2_CONSENSUS {
2526
task.ext.when == null || task.ext.when
2627

2728
script: // This script is bundled with the pipeline, in nf-core/chipseq/bin/
28-
2929
def prefix = task.ext.prefix ?: "${meta.id}"
3030
def peak_type = params.narrow_peak ? 'narrowPeak' : 'broadPeak'
3131
def mergecols = params.narrow_peak ? (2..10).join(',') : (2..9).join(',')
@@ -49,6 +49,8 @@ process MACS2_CONSENSUS {
4949
5050
plot_peak_intersect.r -i ${prefix}.boolean.intersect.txt -o ${prefix}.boolean.intersect.plot.pdf
5151
52+
echo "${prefix}.bed\t${meta.id}/${prefix}.bed" > ${prefix}.antibody.txt
53+
5254
cat <<-END_VERSIONS > versions.yml
5355
"${task.process}":
5456
python: \$(python --version | sed 's/Python //g')

workflows/chipseq.nf

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,7 @@ workflow CHIPSEQ {
543543
// Consensus peaks analysis
544544
//
545545
ch_macs2_consensus_bed_lib = Channel.empty()
546+
ch_macs2_consensus_txt_lib = Channel.empty()
546547
ch_deseq2_pca_multiqc = Channel.empty()
547548
ch_deseq2_clustering_multiqc = Channel.empty()
548549
if (!params.skip_consensus_peaks) {
@@ -579,6 +580,7 @@ workflow CHIPSEQ {
579580
ch_antibody_peaks
580581
)
581582
ch_macs2_consensus_bed_lib = MACS2_CONSENSUS.out.bed
583+
ch_macs2_consensus_txt_lib = MACS2_CONSENSUS.out.txt
582584
ch_versions = ch_versions.mix(MACS2_CONSENSUS.out.versions)
583585

584586
if (!params.skip_peak_annotation) {
@@ -653,26 +655,13 @@ workflow CHIPSEQ {
653655
//
654656
if (!params.skip_igv) {
655657
IGV (
658+
params.aligner,
659+
params.narrow_peak ? 'narrowPeak' : 'broadPeak',
656660
PREPARE_GENOME.out.fasta,
657661
UCSC_BEDGRAPHTOBIGWIG.out.bigwig.collect{it[1]}.ifEmpty([]),
658662
ch_macs2_peaks.collect{it[1]}.ifEmpty([]),
659663
ch_macs2_consensus_bed_lib.collect{it[1]}.ifEmpty([]),
660-
{ "${params.aligner}/mergedLibrary/bigwig" },
661-
{
662-
[
663-
"${params.aligner}/mergedLibrary/macs2",
664-
params.narrow_peak ? '/narrowPeak' : '/broadPeak'
665-
]
666-
.join('')
667-
},
668-
{
669-
[
670-
"${params.aligner}/mergedLibrary/macs2",
671-
params.narrow_peak ? '/narrowPeak' : '/broadPeak',
672-
'/consensus'
673-
]
674-
.join('')
675-
}
664+
ch_macs2_consensus_txt_lib.collect{it[1]}.ifEmpty([])
676665
)
677666
ch_versions = ch_versions.mix(IGV.out.versions)
678667
}

0 commit comments

Comments
 (0)