forked from labsyspharm/mcmicro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexemplar.nf
65 lines (51 loc) · 1.47 KB
/
exemplar.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
#!/usr/bin/env nextflow
// Expect the following params
// .name - Name of the exemplar, e.g., "exemplar-001", "exemplar-002", etc.
// .path - Path of the local folder for downloading to
// Optional parameters
// .nc - Number of cycles to download (between 1 and 10)
dir_raw = "raw"
dir_ilp = "illumination"
// Map the exemplar name to remote URL
switch( params.name ) {
case "exemplar-001":
url = 'https://mcmicro.s3.amazonaws.com/exemplars/001/exemplar-001'
params.nc = 3
break
case "exemplar-002":
url = 'https://mcmicro.s3.amazonaws.com/exemplars/002/exemplar-002'
params.nc = 10
break
default:
error "Unknown exemplar name"
}
// Sequence of individual cycles to download
seq = Channel.of( 1..params.nc )
nm = params.nc * 4 + 1 // Four markers per channel, plus header
process getImages {
publishDir "${params.path}/${params.name}", mode: 'copy'
input:
val i from seq
output:
file '**'
shell:
'''
mkdir !{dir_raw}
mkdir !{dir_ilp}
name="!{params.name}-cycle-$(printf %02d !{i})"
name_raw="!{dir_raw}/$name.ome.tiff"
name_dfp="!{dir_ilp}/$name-dfp.tif"
name_ffp="!{dir_ilp}/$name-ffp.tif"
curl -f -o $name_raw "!{url}/$name_raw"
curl -f -o $name_dfp "!{url}/$name_dfp"
curl -f -o $name_ffp "!{url}/$name_ffp"
'''
}
process getMarkers {
publishDir "${params.path}/${params.name}", mode: 'copy'
output:
file '**'
"""
curl -f "${url}/markers.csv" | head -n ${nm} > markers.csv
"""
}