Attaching a table to a shape element can drop its shapes
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 82/100
Direzione di ricerca
Inizia con .sync_shapes_on_drop() in R/utils.R e confronta la corrispondenza delle istanze con la ricerca descritta in .sync_tables_on_crop(). Riproduci il comportamento delle righe eliminate usando lo store di esempio e una tabella i cui ID di istanza iniziano da 0. Il lavoro è completato quando l’aggiunta della tabella preserva tutte le righe shape corrispondenti; aggiungi un test di regressione per questo caso.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- R
- Stelle
- 37
- Fork
- 10
- Merge medio
- 1g 1h
- PR unite (30g)
- 18
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di HelenaLC/spatialdataR
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
HelenaLC/spatialdataR#284 ·
I maintainer di solito rispondono entro 1 giorno
-
axes order in image/label show methodForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
HelenaLC/spatialdataR#239 · 11 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 3/5 Mezza giornata Idoneità per principianti 60/100
HelenaLC/spatialdataR#271 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
HelenaLC/spatialdataR#251 · 6 commenti · 3 reazioni ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
HelenaLC/spatialdataR#241 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di HelenaLC/spatialdataR
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 71/100
-
Hackathon: Tier 1
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
pharmaverse/logrx#309 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100