-
Notifications
You must be signed in to change notification settings - Fork 0
/
cool2mustache.nf
77 lines (56 loc) · 1.66 KB
/
cool2mustache.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
#!/usr/bin/env nextflow
params.coolDir = false
params.outDir = false
params.resolution = 5
params.help = false
def helpMessage() {
log.info"""
Usage:
The typical command for running the pipeline is as follows:
cool2mustanche --coolDir ~/path/to/coolFiles/location
or
cool2mustanche --coolDir ~/path/to/coolFiles/location --outDir ~/path/to/where/to/save/files
Mandatory arguments:
--coolDir [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).
--resolution [integer] Resolution in kb to build look for loop. Default: 5kb
""".stripIndent()
}
if (params.help){
helpMessage()
exit 0
}
if (!params.coolDir) {
exit 1, "--coolDir is a required arguments. Use --help to get the full usage."
}
if(!params.outDir){
outDir = file(params.coolDir).getParent() + "/mustache"
} else {
outDir = params.outDir
}
Channel
.fromPath("${params.coolDir}/*.cool")
.set{mustache_mcool_ch}
process mustache {
tag "_${id}"
cpus 24
memory '48 GB'
container "mblanche/mustache"
publishDir "${params.outDir}",
mode: 'copy'
input:
tuple path(mcool), val(res) from mustache_mcool_ch
.combine(Channel.from(1000,4000,16000))
output:
tuple id, path("*.tsv") into mustache_out_ch
script:
id = mcool.name.take(mcool.name.lastIndexOf('.'))
"""
touch ${id}_${res}kb_loops.tsv
mustache -p ${task.cpus} \
-f ${mcool} \
-r ${res} \
-o ${id}_${res}kb_loops.tsv
"""
}