Attaching a table to a shape element can drop its shapes
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
R/utils.R の .sync_shapes_on_drop() から始め、そのインスタンスの照合方法を .sync_tables_on_crop() で説明されている検索方法と比較してください。サンプルストアと、インスタンス ID が 0 から始まるテーブルを使って、行が削除されたときの動作を再現してください。テーブルを追加しても一致する shape 行がすべて保持されることを完了条件とし、このケースの回帰テストを追加してください。
索引モデルが issue の本文から書いたものです。
説明
When a table annotating a shape element is attached, .sync_shapes_on_drop() subsets the element with
y <- y[match(instances(t), instances(y), nomatch = 0)]
(R/utils.R, line 45, at 58ec915). For a shape element without an instance_key attribute, instances(y) returns seq_len(nrow(y)), so the table's instance values end up matched against row positions. With ids that start at 0, the last shape goes missing.
A reprex with the example store, on spatialdataR 0.99.44:
library(spatialdataR)
x <- readSpatialData(system.file("extdata", "blobs.zarr", package = "spatialdataR"))
nrow(shape(x, "blobs_circles"))
#> [1] 5
t <- table(x)[, 1:5]
regions(t) <- "blobs_circles"
instances(t) <- 0:4
table(x, "circles") <- t
nrow(shape(x, "blobs_circles"))
#> [1] 4
With a two-column table and instances(t) <- c(4L, 5L), the element ends up with no rows at all, although shape(x, "blobs_circles")[c(4, 5)] on its own returns two.
The same happens when reading two of the example stores in the BiocSpatialData OSN bucket. In merfish.zarr.zip, cells has 2,389 rows in shapes.parquet and 2,389 columns in the table, but 2,388 rows after readSpatialData(); in visium_associated_xenium_io_aligned.zip the spots go from 4,992 to 4,991. Both number their instances from 0. With tables = FALSE every row is there, and xenium_rep1_io_aligned.zip, whose ids start at 1, keeps all of them.
In these stores the ids sit in a column named after the table's instance key (cell_id, spot_id), which is what .sync_tables_on_crop() already looks for with if (ik %in% names(e)) e[[ik]], so the same lookup would probably fix it here. Something else I noticed along the way: [ on a shape element keeps rows in their stored order, so circles[c(3, 1)] returns rows 1 and 3.
This may fit with #195. Happy to put together a PR with a test if that helps.
- 主要言語
- R
- スター
- 37
- フォーク
- 10
- 平均マージ
- 22時間 46分
- マージ済み PR(30日)
- 20
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
HelenaLC/spatialdataR のほかの issue
-
readPoint() reads only part.0.parquet, so points written from a partitioned dask frame lose rowsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
HelenaLC/spatialdataR#287 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
axes order in image/label show method対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
HelenaLC/spatialdataR#239 · コメント 11 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 半日 初心者へのやさしさ 60/100
HelenaLC/spatialdataR#271 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
HelenaLC/spatialdataR#251 · コメント 6 件 · リアクション 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
HelenaLC/spatialdataR#241 ·
メンテナーはふだん 1 日以内に返信
HelenaLC/spatialdataR の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
philchalmers/mirt#287 ·
-
querySqlToAndromeda(appendToTable = TRUE) errors with "This ResultSet is closed" after appendingオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
OHDSI/DatabaseConnector#346 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100