Skip to content

Commit

Permalink
Merge pull request #191 from scverse/fix/points_zero_len_cosmx
Browse files Browse the repository at this point in the history
Disallow points with zero lenght cosmx
  • Loading branch information
LucaMarconato authored Aug 6, 2024
2 parents 13852de + 7854596 commit dd3b29d
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/spatialdata_io/readers/cosmx.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,17 +271,18 @@ def cosmx(
sub_table[CosmxKeys.INSTANCE_KEY] = sub_table[CosmxKeys.INSTANCE_KEY].astype("category")
# we rename z because we want to treat the data as 2d
sub_table.rename(columns={"z": "z_raw"}, inplace=True)
points[f"{fov}_points"] = PointsModel.parse(
sub_table,
coordinates={"x": CosmxKeys.X_LOCAL_TRANSCRIPT, "y": CosmxKeys.Y_LOCAL_TRANSCRIPT},
feature_key=CosmxKeys.TARGET_OF_TRANSCRIPT,
instance_key=CosmxKeys.INSTANCE_KEY,
transformations={
fov: Identity(),
"global": aff,
"global_only_labels": aff,
},
)
if len(sub_table) > 0:
points[f"{fov}_points"] = PointsModel.parse(
sub_table,
coordinates={"x": CosmxKeys.X_LOCAL_TRANSCRIPT, "y": CosmxKeys.Y_LOCAL_TRANSCRIPT},
feature_key=CosmxKeys.TARGET_OF_TRANSCRIPT,
instance_key=CosmxKeys.INSTANCE_KEY,
transformations={
fov: Identity(),
"global": aff,
"global_only_labels": aff,
},
)

# TODO: what to do with fov file?
# if fov_file is not None:
Expand Down

0 comments on commit dd3b29d

Please sign in to comment.