Skip to content

Commit

Permalink
Merge pull request #4 from BertGalle/project1
Browse files Browse the repository at this point in the history
Added merge count files per pool
  • Loading branch information
ToonRosseel authored Apr 23, 2024
2 parents 6810f0d + ffc19c7 commit 84f9766
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 5 deletions.
23 changes: 23 additions & 0 deletions modules/local/exomedepth/merge_count/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// MERGE COUNT FILES
process EXOMEDEPTH_COUNT_MERGE {
publishDir "$params.outdir/exomedepth/counts", mode: 'copy'

input:
tuple val(meta), path(files)

output:
tuple val(meta), path("${prefix}.txt")

script:
prefix = task.ext.prefix ?: "${meta.id}_${meta.chr}"
"""
for file in $files; do
if [ -f ${prefix}.txt ]; then
paste ${prefix}.txt <(awk '{print \$5}' \$file) > temp_auto.txt
mv temp_auto.txt ${prefix}.txt
else
cp \$file ${prefix}.txt
fi
done
"""
}
37 changes: 32 additions & 5 deletions workflows/exomecnv.nf
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ include { softwareVersionsToYAML } from '../subworkflows/nf-core/utils_nfcore_pi
include { methodsDescriptionText } from '../subworkflows/local/utils_nfcore_exomecnv_pipeline'

// local
include { CRAM_PREPARE } from '../subworkflows/local/cram_prepare/main'
include { EXOMEDEPTH_COUNT as COUNT_X } from '../subworkflows/local/exomedepth_count/main'
include { EXOMEDEPTH_COUNT as COUNT_AUTO } from '../subworkflows/local/exomedepth_count/main'
include { CRAM_PREPARE } from '../subworkflows/local/cram_prepare/main'
include { EXOMEDEPTH_COUNT as COUNT_X } from '../subworkflows/local/exomedepth_count/main'
include { EXOMEDEPTH_COUNT as COUNT_AUTO } from '../subworkflows/local/exomedepth_count/main'
include { EXOMEDEPTH_COUNT_MERGE as COUNT_MERGE_AUTO } from '../modules/local/exomedepth/merge_count/main'
include { EXOMEDEPTH_COUNT_MERGE as COUNT_MERGE_X } from '../modules/local/exomedepth/merge_count/main'


// include { BAM_VARIANT_CALLING_EXOMEDEPTH } from '../subworkflows/local/bam_variant_calling_exomedepth/main'
/*
Expand Down Expand Up @@ -42,8 +45,10 @@ workflow EXOMECNV {
BAM: cram.extension == "bam"
}
.set{ ch_input_prepare }
// ch_input_prepare.BAM.view { "BAM: $it" }
// ch_input_prepare.CRAM.view { "CRAM: $it" }


//ch_input_prepare.BAM.view { "BAM: $it" }
//ch_input_prepare.CRAM.view { "CRAM: $it" }


ch_fasta = Channel.fromPath(params.fasta).map{ [[id:"reference"], it]}.collect()
Expand Down Expand Up @@ -74,10 +79,32 @@ workflow EXOMECNV {
COUNT_AUTO (
ch_input_bam, ch_roi_auto
)

grouped_counts_auto = COUNT_AUTO.out.count
.map { meta, txt ->
def new_meta = [id:meta.pool,chr:"autosomal"]
[new_meta, txt]
}
.groupTuple()

COUNT_MERGE_AUTO (
grouped_counts_auto
)

COUNT_X (
ch_input_bam, ch_roi_x
)

grouped_counts_X = COUNT_X.out.count
.map { meta, txt ->
def new_meta = [id:meta.pool,chr:"chrX"]
[new_meta, txt]
}
.groupTuple()

COUNT_MERGE_X (
grouped_counts_X
)
//
// Collate and save software versions
//
Expand Down

0 comments on commit 84f9766

Please sign in to comment.