Skip to content

Commit c640569

Browse files
committed
Made Polylux output coordinates integers.
1 parent 79bacfa commit c640569

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎xenium_ROI_extractor.py‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def get_arguments():
9696

9797
# Read image
9898
print(f"Reading Maximum Projection Image File: {mip_tiff_file_path}")
99-
image = tiffile.imread(mip_tiff_file_path)
99+
image = tifffile.imread(mip_tiff_file_path)
100100

101101
os.makedirs(ouptut_folder, exist_ok = True)
102102

@@ -137,6 +137,9 @@ def get_arguments():
137137

138138
# Make transcript table for reding with the Polylux viewer (Resolve Biosciences)
139139
polylux_tx = sub_transcripts[["x_location_px_ROI", "y_location_px_ROI", "z_location_px", "feature_name", "qv"]]
140+
polylux_tx["x_location_px_ROI"] = polylux_tx["x_location_px_ROI"].astype(np.int32)
141+
polylux_tx["y_location_px_ROI"] = polylux_tx["y_location_px_ROI"].astype(np.int32)
142+
polylux_tx["z_location_px"] = polylux_tx["z_location_px"].astype(np.int32)
140143

141144
# Output
142145
print(f"Writing {roi_string}")
@@ -161,15 +164,15 @@ def get_arguments():
161164
f_to_write.create_dataset("name", data=feature_h5["features"]["name"])
162165

163166
# Write other output
164-
tiffile.imwrite(os.path.join(subfolder, roi_string + "-morphology_mip.ome.tif"), data = sub_image, ome = True, compression = "lzw")
167+
tifffile.imwrite(os.path.join(subfolder, roi_string + "-morphology_mip.ome.tif"), data = sub_image, ome = True, compression = "lzw")
165168
sub_transcripts.to_parquet(os.path.join(subfolder, roi_string + "-transcritps.parquet"))
166169
sub_transcripts.to_csv(os.path.join(subfolder, roi_string + "-transcritps.csv"))
167-
polylux_tx.to_csv(os.path.join(subfolder, roi_string + "-Polylux_transcritps.tsv"), header = None, index = False, sep = "\t")
170+
polylux_tx.to_csv(os.path.join(subfolder, roi_string + "-Polylux_transcritps.txt"), header = None, index = False, sep = "\t")
168171
sub_cells.to_parquet(os.path.join(subfolder, roi_string + "-cells.parquet"))
169172
sub_cells.to_csv(os.path.join(subfolder, roi_string + "-cells.csv"))
170173
sub_cell_boundaries.to_parquet(os.path.join(subfolder, roi_string + "-cell_boundaries.parquet"))
171174
sub_cell_boundaries.to_csv(os.path.join(subfolder, roi_string + "-cell_boundaries.csv"))
172175
sub_features.to_csv(os.path.join(subfolder, roi_string + "-feature_matrix.csv"))
173-
tiffile.imwrite(os.path.join(subfolder, roi_string + "-xenium_cell_mask.ome.tif"), data = cell_mask, ome = True, compression = "lzw")
176+
tifffile.imwrite(os.path.join(subfolder, roi_string + "-xenium_cell_mask.ome.tif"), data = cell_mask, ome = True, compression = "lzw")
174177

175178

0 commit comments

Comments
 (0)