Skip to content

Commit

Permalink
Update code to deal with explicit replicates and control replicates
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseEspinosa committed Jun 20, 2023
1 parent 8f1f57e commit 14e21f7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
2 changes: 1 addition & 1 deletion conf/test.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ params {
max_time = '6.h'

// Input data
input = 'https://github.com/nf-core/test-datasets/chipseq/samplesheet/v2.0/samplesheet_test.csv'
input = 'https://github.com/nf-core/test-datasets/chipseq/samplesheet/v2.1/samplesheet_test.csv'
read_length = 50

// Genome references
Expand Down
23 changes: 17 additions & 6 deletions workflows/chipseq.nf
Original file line number Diff line number Diff line change
Expand Up @@ -423,11 +423,19 @@ workflow CHIPSEQ {
.set { ch_genome_bam_bai }

ch_genome_bam_bai
.combine(ch_genome_bam_bai)
.map {
meta1, bam1, bai1, meta2, bam2, bai2 ->
meta1.control == meta2.id ? [ meta1, [ bam1, bam2 ], [ bai1, bai2 ] ] : null
meta, bam, bai ->
meta.control ? null : [ meta.id, [ bam ] , [ bai ] ]
}
.set { ch_control_bam_bai }

ch_genome_bam_bai
.map {
meta, bam, bai ->
meta.control ? [ meta.control, meta, [ bam ], [ bai ] ] : null
}
.combine(ch_control_bam_bai, by: 0)
.map { it -> [ it[1] , it[2] + it[4], it[3] + it[5] ] }
.set { ch_ip_control_bam_bai }

//
Expand Down Expand Up @@ -482,7 +490,10 @@ workflow CHIPSEQ {
MACS2_CALLPEAK
.out
.peak
.filter { meta, peaks -> peaks.size() > 0 }
.filter {
meta, peaks ->
peaks.size() > 0
}
.set { ch_macs2_peaks }

// Create channels: [ meta, ip_bam, peaks ]
Expand Down Expand Up @@ -564,7 +575,7 @@ workflow CHIPSEQ {
ch_deseq2_clustering_multiqc = Channel.empty()
if (!params.skip_consensus_peaks) {
// Create channels: [ meta , [ peaks ] ]
// Where meta = [ id:antibody, multiple_groups:true/false, replicates_exist:true/false ]
// Where meta = [ id:antibody, multiple_groups:true/false, replicates_exist:true/false ]
ch_macs2_peaks
.map {
meta, peak ->
Expand All @@ -588,7 +599,7 @@ workflow CHIPSEQ {
[ meta_new, peaks ]
}
.set { ch_antibody_peaks }

ch_antibody_peaks.dump()
//
// MODULE: Generate consensus peaks across samples
//
Expand Down

0 comments on commit 14e21f7

Please sign in to comment.