-
Notifications
You must be signed in to change notification settings - Fork 88
Expand file tree
/
Copy pathcalculate_damage.nf
More file actions
62 lines (55 loc) · 2.27 KB
/
calculate_damage.nf
File metadata and controls
62 lines (55 loc) · 2.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// Calculate damage profile
//
include { addNewMetaFromAttributes } from '../../subworkflows/local/utils_nfcore_eager_pipeline/main'
include { DAMAGEPROFILER } from '../../modules/nf-core/damageprofiler/main'
include { MAPDAMAGE2 as CALCULATE_MAPDAMAGE2 } from '../../modules/nf-core/mapdamage2/main'
workflow CALCULATE_DAMAGE {
take:
ch_bam_bai // [ [ meta ], [ bam ], [ bai ] ]
fasta // [ [ meta ], fasta ]
fasta_fai // [ [ meta ], fasta_fai ]
main:
ch_versions = Channel.empty()
ch_multiqc_files = Channel.empty()
//From deduplicate.nf
ch_refs = fasta.join(fasta_fai)
.map {
// Prepend a new meta that contains the meta.id value as the new_meta.reference attribute
addNewMetaFromAttributes( it, "id" , "reference" , false )
}
// Ensure input bam matches the regions file
ch_damagetool_input = ch_bam_bai
.map {
// Prepend a new meta that contains the meta.reference value as the new_meta.reference attribute
addNewMetaFromAttributes( it, "reference" , "reference" , false )
}
.combine(
by:0,
ch_refs
)
.multiMap{
ignore_me, meta, bam, bai, meta2, fasta_, fasta_fai_ ->
bam: [ meta, bam ]
fasta: fasta_
fasta_fai: fasta_fai_
}
// Calculate damage
if ( params.damagecalculation_tool == 'damageprofiler' ) {
DAMAGEPROFILER(
ch_damagetool_input.bam,
ch_damagetool_input.fasta,
ch_damagetool_input.fasta_fai,
[]
)
ch_versions = ch_versions.mix( DAMAGEPROFILER.out.versions.first() )
ch_multiqc_files = ch_multiqc_files.mix( DAMAGEPROFILER.out.results )
} else if ( params.damagecalculation_tool == 'mapdamage' ) {
CALCULATE_MAPDAMAGE2 ( ch_damagetool_input.bam, ch_damagetool_input.fasta )
ch_versions = ch_versions.mix( CALCULATE_MAPDAMAGE2.out.versions.first() )
ch_multiqc_files = ch_multiqc_files.mix( CALCULATE_MAPDAMAGE2.out.folder )
}
emit:
versions = ch_versions // channel: [ versions.yml ]
mqc = ch_multiqc_files
}