-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplotECDF.nf
89 lines (67 loc) · 1.92 KB
/
plotECDF.nf
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
86
87
88
#!/usr/bin/env nextflow
params.bam = false
params.outDir = false
params.prefix = 'myResult'
params.help = false
def helpMessage() {
log.info"""
Usage:
The typical command for running the pipeline is as follows:
plotECDF --bam ./path/to/lib1,./path/to/lib2,./path/to/lib3,... --outDir path/to/results/
or
plotECDF --prefix myResult --bam ./path/to/lib1,./path/to/lib2,./path/to/lib3,... --outDir path/to/results/
or
plotECDF --bam \$(find \${PWD}/to/bam/ -name '*.bam' |xargs |tr ' ' ,) --outDir path/to/results/
Mandatory arguments:
--bam [path] Comma delimited list of paths to bam files
--outDir [path] Path to a diectory to save the bigwig coveage files (can be local or valid S3 location. Default
Facutativ argument:
--prefix [string] A string to name the _ecdf.pdf file. Default: myResult
""".stripIndent()
}
if (params.help){
helpMessage()
exit 0
}
if (!(params.bam && params.outDir)) {
exit 1, "--bam and --outDir area required arguments. Use --help to get the full usage."
}
process index {
label 'index'
tag '_${id}'
cpus 48
memory '100 GB'
container 'mblanche/bwa-samtools'
input:
path(bam) from Channel
.from(params.bam)
.splitCsv()
.flatten()
output:
path(bam) into bam_ch
path("*.bam.bai") into idx_ch
script:
id = bam.name.toString().take(bam.name.toString().lastIndexOf('.'))
"""
samtools index -@${task.cpus} ${bam}
"""
}
process plotECDF {
echo true
label 'batch'
tag "_${id}"
cpus 24
memory '48 GB'
container 'mblanche/r-prod-qc'
publishDir "${params.outDir}",
mode: 'copy'
input:
path(bam) from bam_ch.collect()
path(idx) from idx_ch.collect()
output:
path "*.pdf"
script:
"""
plotECDF.R ${task.cpus} ${params.prefix} ${bam}
"""
}