Skip to content

Commit

Permalink
Fix CSV reader for Visium v1
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-dark committed Jan 2, 2025
1 parent 346b501 commit df48f2a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apis/python/src/tiledbsoma/io/spatial/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,7 @@ def from_visium(
with _write_visium_spots(
loc_uri,
input_paths.tissue_positions,
input_paths.major_version,
pixels_per_spot_diameter,
obs_df,
obs_id_name,
Expand Down Expand Up @@ -679,6 +680,7 @@ def _write_scene_presence_dataframe(
def _write_visium_spots(
df_uri: str,
input_tissue_positions: Path,
major_version: int,
spot_diameter: float,
obs_df: pd.DataFrame,
id_column_name: str,
Expand All @@ -691,8 +693,12 @@ def _write_visium_spots(
"""Creates, opens, and writes data to a ``PointCloudDataFrame`` with the spot
locations and metadata. Returns the open dataframe for writing.
"""
if major_version == 1:
names = [id_column_name, "in_tissue", "array_row", "array_col", "y", "x"]

Check warning on line 697 in apis/python/src/tiledbsoma/io/spatial/ingest.py

View check run for this annotation

Codecov / codecov/patch

apis/python/src/tiledbsoma/io/spatial/ingest.py#L696-L697

Added lines #L696 - L697 were not covered by tests
else:
names = None

Check warning on line 699 in apis/python/src/tiledbsoma/io/spatial/ingest.py

View check run for this annotation

Codecov / codecov/patch

apis/python/src/tiledbsoma/io/spatial/ingest.py#L699

Added line #L699 was not covered by tests
df = (
pd.read_csv(input_tissue_positions)
pd.read_csv(input_tissue_positions, names=names)
.rename(
columns={
"barcode": id_column_name,
Expand Down

0 comments on commit df48f2a

Please sign in to comment.