Skip to content

Commit

Permalink
Update scene component names
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-dark committed May 3, 2024
1 parent a3d1d7f commit c2aa85d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repos:
- id: mypy
additional_dependencies:
- "pandas-stubs==1.5.3.230214"
- "somacore @ git+https://github.com/single-cell-data/SOMA.git@c403caf9cc48c" # DO NOT MERGE TO MAIN
- "somacore @ git+https://github.com/single-cell-data/SOMA.git@ee2aba7ec7f56996e" # DO NOT MERGE TO MAIN
- "types-setuptools==67.4.0.3"
args: ["--config-file=apis/python/pyproject.toml", "apis/python/src", "apis/python/devtools"]
pass_filenames: false
58 changes: 25 additions & 33 deletions apis/python/src/tiledbsoma/experimental/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,55 +158,47 @@ def from_visium(
spatial, scene_name, scene, use_relative_uri=use_relative_uri
)

scene_exp_uri = f"{scene_uri}/exp"
with _create_or_open_collection(
Collection[AnyTileDBObject], scene_exp_uri, **ingest_ctx
) as scene_exp:
# Write image data and add to the scene.
images_uri = f"{scene_uri}/images"
with _write_visium_images(
images_uri,
scale_factors,
input_hires=input_hires,
input_lowres=input_lowres,
input_fullres=input_fullres,
use_relative_uri=use_relative_uri,
**ingest_ctx,
) as images:
_maybe_set(
scene, "exp", scene_exp, use_relative_uri=use_relative_uri
scene, "images", images, use_relative_uri=use_relative_uri
)

obs_locations_uri = f"{scene_exp_uri}/obs_locations"
obss_uri = f"{scene_uri}/obss"
with _create_or_open_collection(
Collection[AnyTileDBObject], obss_uri, **ingest_ctx
) as obss:
_maybe_set(scene, "obss", obss, use_relative_uri=use_relative_uri)

obs_loc_uri = f"{obss_uri}/obs_locations"

# Write spot data and add to the scene.
with _write_visium_spot_dataframe(
obs_locations_uri,
obs_loc_uri,
input_tissue_positions,
scale_factors,
obs_df,
obs_id_name,
**ingest_ctx,
) as obs_locations:
_maybe_set(
scene_exp,
"obs_locations",
obs_locations,
use_relative_uri=use_relative_uri,
)

# Write image data and add to the scene.
images_uri = f"{scene_exp_uri}/images"
with _write_visium_images(
images_uri,
scale_factors,
input_hires=input_hires,
input_lowres=input_lowres,
input_fullres=input_fullres,
use_relative_uri=use_relative_uri,
**ingest_ctx,
) as images:
) as obs_loc:
_maybe_set(
scene_exp,
"images",
images,
use_relative_uri=use_relative_uri,
obss, "loc", obs_loc, use_relative_uri=use_relative_uri
)

scene_ms_uri = f"{scene_uri}/ms"
scene_ms_uri = f"{scene_uri}/vars"
with _create_or_open_collection(
Collection[Collection[AnyTileDBObject]], scene_ms_uri, **ingest_ctx
) as scene_ms:
_maybe_set(scene, "ms", scene_ms, use_relative_uri=use_relative_uri)
) as vars:
_maybe_set(scene, "vars", vars, use_relative_uri=use_relative_uri)
return uri


Expand Down

0 comments on commit c2aa85d

Please sign in to comment.