@@ -24,13 +24,15 @@ workflow CELLPOSE_BAYSOR_IMPORT_SEGMENTATION {
2424 ch_image = Channel . empty()
2525 ch_polygons = Channel . empty()
2626 ch_segmentation = Channel . empty()
27+ ch_transcripts = Channel . empty()
2728 ch_filtered_transcripts = Channel . empty()
2829 ch_cellpose_cells_mask = Channel . empty()
2930 ch_cellpose_nuclei_mask = Channel . empty()
3031 ch_cellpose_cells_cells = Channel . empty()
3132 ch_cellpose_nuclei_cells = Channel . empty()
3233 ch_cellpose_cells_flows = Channel . empty()
3334 ch_cellpose_nuclei_flows = Channel . empty()
35+ ch_coordinate_space = Channel . value(" microns" )
3436
3537 cellpose_model = params. cellpose_model ? (Channel . fromPath(params. cellpose_model, checkIfExists : true )) : []
3638
@@ -98,30 +100,35 @@ workflow CELLPOSE_BAYSOR_IMPORT_SEGMENTATION {
98100 ch_versions = ch_versions. mix ( BAYSOR_PREPROCESS_TRANSCRIPTS . out. versions )
99101
100102 ch_filtered_transcripts = BAYSOR_PREPROCESS_TRANSCRIPTS . out. transcripts_parquet
103+ ch_transcripts = ch_filtered_transcripts
101104
105+ } else {
106+
107+ ch_transcripts = ch_transcripts_parquet
102108 }
103109
104110 // run baysor with cellpose results
105111 if ( params. nucleus_segmentation_only ) {
106112
107113 // run baysor with nuclei mask
108- BAYSOR_RUN ( ch_filtered_transcripts , ch_cellpose_nuclei_mask, ch_config, 30 )
114+ BAYSOR_RUN ( ch_transcripts , ch_cellpose_nuclei_mask, ch_config, 30 )
109115 ch_versions = ch_versions. mix ( BAYSOR_RUN . out. versions )
110116
111117 } else if ( params. cell_segmentation_only ) {
112118
113119 // run baysor with cell mask
114- BAYSOR_RUN ( ch_filtered_transcripts , ch_cellpose_cells_mask, ch_config, 30 )
120+ BAYSOR_RUN ( ch_transcripts , ch_cellpose_cells_mask, ch_config, 30 )
115121 ch_versions = ch_versions. mix ( BAYSOR_RUN . out. versions )
116122
117123 } else {
118124
119125 // run baysor with cell mask
120- BAYSOR_RUN ( ch_filtered_transcripts , [], ch_config, 30 )
126+ BAYSOR_RUN ( ch_transcripts , [], ch_config, 30 )
121127 ch_versions = ch_versions. mix ( BAYSOR_RUN . out. versions )
122128
123129 }
124130
131+
125132 // run import-segmentation with baysor outs
126133 ch_segmentation = BAYSOR_RUN . out. segmentation. map {
127134 _meta, segmentation -> return [ segmentation ]
@@ -136,7 +143,7 @@ workflow CELLPOSE_BAYSOR_IMPORT_SEGMENTATION {
136143 [],
137144 ch_segmentation,
138145 ch_polygons,
139- " microns "
146+ ch_coordinate_space
140147 )
141148 ch_versions = ch_versions. mix ( XENIUMRANGER_IMPORT_SEGMENTATION . out. versions )
142149
@@ -152,6 +159,8 @@ workflow CELLPOSE_BAYSOR_IMPORT_SEGMENTATION {
152159 segmentation_mask = ch_segmentation // channel: [ val(meta), [ *segmentation.csv ] ]
153160 polygons = ch_polygons // channel: [ val(meta), [ *polygons.json ] ]
154161
162+ coordinate_space = ch_coordinate_space // channel: [ val("microns") ]
163+
155164 redefined_bundle = XENIUMRANGER_IMPORT_SEGMENTATION . out. bundle // channel: [ val(meta), ["redefined-xenium-bundle"] ]
156165
157166 versions = ch_versions // channel: [ versions.yml ]
0 commit comments