Skip to content

Commit 88ae680

Browse files
committed
Make deduplication and gap filling optional.
1 parent 23fa206 commit 88ae680

2 files changed

Lines changed: 24 additions & 17 deletions

File tree

example.config

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22
params.input_path = "input"
33
params.output_path = "output"
44

5+
// Workflow control parameters
6+
params.fill_gaps = true // Set to false to skip MindaGap Gap Filling
7+
params.deduplicate = true // Set to false to skip MindaGap transcript deduplication
8+
params.do_zip = true // Set to false to skip making ImageJ ROIs (faster)
9+
params.segmentation_tool = "mesmer" // Use Mesmer (mesmer) or Cellpose (cellpose) for segmentation
10+
511
// MindaGap transcript deduplication parameters
612
params.tile_size = 2144 // Tile size (distance between gridlines)
713
params.window_size = 30 // Window arround gridlines to search for duplicates
814
params.max_freq = 400 // Maximum transcript count to calculate X/Y shifts (better to discard very common genes)
915
params.min_mode = 10 // Minumum occurances of ~XYZ_shift to consider it valid
1016

11-
// Use Mesmer (mesmer) or Cellpose (cellpose) for segmentation
12-
params.segmentation_tool = "mesmer"
13-
1417
// Cellpose Segmentation Parameters
1518
params.model_name = "cyto"
1619
params.probability_threshold = 1
@@ -25,5 +28,3 @@ params.small_objects_threshold = 15 // Minimum object size. Default(15)
2528
params.fill_holes_threshold = 15 // Max Size for hole filling. Default(15)
2629
params.radius = 2 // Undocuented in Mesmer. Default(2)
2730

28-
// Set to false to skip making ImageJ ROIs (faster)
29-
params.do_zip = true

main.nf

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,25 +28,31 @@ workflow {
2828
counts = sample_metadata.counts.toSortedList().flatten().view()
2929

3030
// Gap Filling with MindaGap
31-
gap_filling(samples, dapi)
32-
33-
filled_images = gap_filling.out.gap_filled_image
34-
.toSortedList(compare_file_names).flatten().view()
31+
if (params.fill_gaps == true){
32+
gap_filling(samples, dapi)
33+
images = gap_filling.out.gap_filled_image
34+
.toSortedList(compare_file_names).flatten().view()
35+
} else {
36+
images = dapi
37+
}
3538

3639
// Deduplicate transcripts with MindaGap
37-
deduplicating(samples, counts, params.tile_size, params.window_size, \
38-
params.max_freq, params.min_mode)
39-
40-
clean_transcripts = deduplicating.out.deduplicated_transcripts
41-
.toSortedList(compare_file_names).flatten().view()
40+
if (params.deduplicate == true){
41+
deduplicating(samples, counts, params.tile_size, params.window_size, \
42+
params.max_freq, params.min_mode)
43+
transcripts = deduplicating.out.deduplicated_transcripts
44+
.toSortedList(compare_file_names).flatten().view()
45+
} else {
46+
transcripts = counts
47+
}
4248

4349
// Cell Segmentation
4450
if(params.segmentation_tool == "cellpose"){
4551
segmentation = cellpose_segmentation(sample_metadata.sample, \
4652
params.model_name, params.probability_threshold, \
47-
params.cell_diameter, filled_images)
53+
params.cell_diameter, images)
4854
}else if (params.segmentation_tool == "mesmer") {
49-
segmentation = mesmer_segmentation(sample_metadata.sample, filled_images, \
55+
segmentation = mesmer_segmentation(sample_metadata.sample, images, \
5056
params.maxima_threshold, params.maxima_smooth, params.interior_threshold, \
5157
params.interior_smooth, params.small_objects_threshold, \
5258
params.fill_holes_threshold, params.radius)
@@ -64,7 +70,7 @@ workflow {
6470
}
6571

6672
// Single Cell Data Extraction
67-
sc_data_extraction(samples, cell_masks, clean_transcripts)
73+
sc_data_extraction(samples, cell_masks, transcripts)
6874
single_cell_data = sc_data_extraction.out.sc_data
6975
.toSortedList(compare_file_names).flatten().view()
7076
}

0 commit comments

Comments
 (0)