-
Notifications
You must be signed in to change notification settings - Fork 0
/
hiccups.nf
88 lines (67 loc) · 1.86 KB
/
hiccups.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.hicDir = false
params.outDir = false
params.resolutions = false
params.help = false
def helpMessage() {
log.info"""
Usage:
The typical command for running the pipeline is as follows:
hiccups --coolDir ~/path/to/coolFiles/location
or
hiccups --coolDir ~/path/to/coolFiles/location --outDir ~/path/to/where/to/save/files
Mandatory arguments:
--hicDir [path] Name of the a direcoty with cool files (can be local or valid S3 location).
Facultative arguments
--outDir [path] Path to a diectory to save result files (can be local or valid S3 location).
--resolutions [integers] Comma-seperated list of resolutions in kb. Default: [5,10,25]
""".stripIndent()
}
if (params.help){
helpMessage()
exit 0
}
if (!params.hicDir) {
exit 1, "--hicDir is a required arguments. Use --help to get the full usage."
}
if(!params.outDir){
outDir = file(params.hicDir).getParent() + "/hiccups"
} else {
outDir = params.outDir
}
if (params.resolutions){
resolutions = params.resolutions.split(/,/,-1)
} else {
resolutions = [5,10,25]
}
Channel
.fromPath("${params.hicDir}/*.hic")
.set{hiccups_ch}
process hiccups {
label 'gpu'
accelerator 1
cpus 6
memory '30 GB'
container "mblanche/hiccups-gpu"
publishDir "${outDir}",
mode: 'copy'
input:
tuple path(hic), val(res) from hiccups_ch.first()
.combine(Channel.from(resolutions.collect{it*1000}.join(',')))
output:
tuple id, path("${id}_loops") into hiccups_out_ch
script:
id = hic.name.toString().take(hic.name.toString().lastIndexOf('.'))
"""
java -Xmx24000m \
-jar /juicer_tools.jar \
hiccups \
--threads ${task.cpus} \
--ignore-sparsity \
-m 500 \
-r ${res} \
-k KR \
${hic} \
${id}_loops
"""
}