-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.nf
91 lines (74 loc) · 1.81 KB
/
main.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
89
90
91
/*
* pipeline input parameters
*/
params.slide = "$baseDir/test/3-11-2022_Visium_Slide1_Raphael.svs"
params.invocation = "$baseDir/bin/_invocation"
params.outdir = "$baseDir/test/out"
params.shift = "0"
params.imagenames = "column_0 column_1 column_2 column_3"
log.info """\
S E G M E N T A T I O N P I P E L I N E
===========================================
slide : ${params.slide}
outdir : ${params.outdir}
"""
.stripIndent()
slide = file(params.slide)
process split_images {
module "python/3.8.2: openslide"
input:
path slide from params.slide
val shift from params.shift
val imagenames from params.imagenames
output:
path "*.jpg" into jpeg_ch
script:
"""
$baseDir/bin/split_visium.py \
$slide \
-s $shift \
-l $imagenames
"""
}
process run_spaceranger_image {
publishDir "$params.outdir/${jpeg.getSimpleName()}", mode: 'copy', overwrite: true
errorStrategy 'ignore'
module "spaceranger/1.3.1"
input:
path jpeg from jpeg_ch.flatten()
path invocation from params.invocation
output:
tuple \
path(jpeg), \
path("output/outs/image_scalefactors.json"), \
path("output/outs/tissue_positions_list.csv") \
into spaceranger_ch
script:
"""
IMAGE=\$(readlink -f $jpeg)
sed "s|<ADD_IMAGE>|\$IMAGE|g" $invocation > _input
spaceranger mrp _input output
"""
}
process run_segmentation {
publishDir "$params.outdir/${jpeg.getSimpleName()}", mode: 'copy', overwrite: true
errorStrategy 'ignore'
input:
tuple \
path(jpeg), \
path(scalefactors), \
path(positions) \
from spaceranger_ch
output:
path "stardist_detections.csv"
path "plots/*"
script:
"""
$baseDir/bin/segment_visium.py $jpeg $scalefactors $positions
"""
}
/*
workflow {
split_images |
}
*/