-
Notifications
You must be signed in to change notification settings - Fork 420
/
aligner.config
85 lines (74 loc) · 3.82 KB
/
aligner.config
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Config file for defining DSL2 per module options and publishing paths
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Available keys to override module options:
ext.args = Additional arguments appended to command in module.
ext.args2 = Second set of arguments appended to command in module (multi-tool modules).
ext.args3 = Third set of arguments appended to command in module (multi-tool modules).
ext.prefix = File name prefix for output files.
ext.when = When to run the module.
----------------------------------------------------------------------------------------
*/
// MAPPING
process {
if (params.step == 'mapping') {
withName: 'BWAMEM1_MEM' {
ext.when = { params.aligner == 'bwa-mem' }
}
withName: 'BWAMEM2_MEM' {
ext.when = { params.aligner == 'bwa-mem2' }
}
withName: 'DRAGMAP_ALIGN' {
ext.args = { "--RGSM ${meta.patient}_${meta.sample} --RGID ${meta.read_group}" }
ext.when = { params.aligner == 'dragmap' }
}
withName: 'SENTIEON_BWAMEM' {
ext.when = { params.aligner == 'sentieon-bwamem' }
}
withName: 'BWAMEM.*_MEM|DRAGMAP_ALIGN|SENTIEON_BWAMEM' {
ext.prefix = { params.split_fastq > 1 ? "${meta.id}".concat('.').concat(reads.get(0).name.tokenize('.')[0]) : "${meta.id}.sorted" }
publishDir = [
mode: params.publish_dir_mode,
path: { "${params.outdir}/preprocessing/" },
pattern: "*bam",
// Only save if save_output_as_bam AND
// (save_mapped OR no_markduplicates OR sentieon_dedup) AND
// only a single BAM file per sample
saveAs: {
if (params.save_output_as_bam &&
(
params.save_mapped ||
(params.skip_tools && params.skip_tools.split(',').contains('markduplicates')) &&
!(params.tools && params.tools.split(',').contains('sentieon_dedup'))
) && (meta.size * meta.num_lanes == 1)
) { "mapped/${meta.id}/${it}" }
else { null }
}
]
}
withName: 'BWAMEM.*_MEM|DRAGMAP_ALIGN' {
// Markduplicates Spark NEEDS name-sorted reads or runtime goes through the roof
// However if it's skipped, reads need to be coordinate-sorted
// Only name sort if Spark for Markduplicates + duplicate marking is not skipped
// Currently SENTIEON_BWAMEM only supports coordinate sorting the reads.
ext.args2 = { params.use_gatk_spark && params.use_gatk_spark.contains('markduplicates') && (!params.skip_tools || (params.skip_tools && !params.skip_tools.split(',').contains('markduplicates'))) ? '-n' : '' }
}
withName: 'BWAMEM.*_MEM|SENTIEON_BWAMEM' {
// Using -B 3 for tumor samples
ext.args = { meta.status == 1 ? "-K 100000000 -Y -B 3 -R ${meta.read_group}" : "-K 100000000 -Y -R ${meta.read_group}" }
}
}
withName: 'MERGE_BAM|INDEX_MERGE_BAM' {
publishDir = [
mode: params.publish_dir_mode,
path: { "${params.outdir}/preprocessing/" },
pattern: "*{bam,bai}",
// Only save if (save_output_as_bam AND (no_markduplicates OR save_mapped ))
saveAs: { (params.save_output_as_bam && (params.save_mapped || params.skip_tools && params.skip_tools.split(',').contains('markduplicates'))) ? "mapped/${meta.id}/${it}" : null }
]
}
withName: 'MERGE_BAM' {
ext.prefix = { "${meta.id}.sorted" }
}
}