Skip to content

Commit a124511

Browse files
committed
update spatialdata.data loaders
1 parent bb6a897 commit a124511

File tree

1 file changed

+19
-25
lines changed

1 file changed

+19
-25
lines changed

vignettes/SpatialData.plot.Rmd

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ In this example data, we do not have a `label` for the `shape` polygons.
167167
Such labels could be morphological regions annotated by pathologists.
168168

169169
```{r merfish-read}
170-
dir.create(td <- tempfile())
171-
(x <- MouseBrainMERFISH(td))
170+
(x <- MouseBrainMERFISH())
172171
```
173172

174173
There are only `r length(SpatialData::shape(x, "cells"))` cells, but
@@ -203,8 +202,7 @@ plotSpatialData() + plotImage(x) + bb | plotSpatialData() + plotImage(y)
203202
Mouse intestine, 1GB; 4 image resolutions and 3 shapes at 2, 8, and 16 $\mu$m.
204203

205204
```{r visiumhd-read}
206-
dir.create(td <- tempfile())
207-
(x <- MouseIntestineVisHD(td))
205+
(x <- MouseIntestineVisHD())
208206
```
209207

210208
```{r visiumhd-plot}
@@ -219,8 +217,7 @@ plotSpatialData() + plotImage(x) + bb | plotSpatialData() + plotImage(y)
219217
Colorectal carcinoma, 25 MB; no shapes, no points.
220218

221219
```{r mibitof-read}
222-
dir.create(td <- tempfile())
223-
(x <- ColorectalCarcinomaMIBITOF(td))
220+
(x <- ColorectalCarcinomaMIBITOF())
224221
```
225222

226223
```{r mibitof-plot, fig.width=10, fig.height=3}
@@ -236,8 +233,7 @@ wrap_plots(nrow=1, lapply(seq(3), \(.)
236233
Small lung adenocarcinoma, 250 MB; 1 image, 2 labels, 2 tables.
237234

238235
```{r mcmicro-read}
239-
dir.create(td <- tempfile())
240-
x <- LungAdenocarcinomaMCMICRO(td)
236+
x <- LungAdenocarcinomaMCMICRO()
241237
```
242238

243239
Getting channel names for the image:
@@ -260,33 +256,31 @@ plotSpatialData() + plotImage(x,
260256
4 different cancers (SCCHN, BCC, NSCLC, CRC), 820 MB; 14 images, 14 labels, 1 table.
261257

262258
```{r steinbock-read}
263-
dir.create(td <- tempfile())
264-
# x <- MulticancerSteinbock(td)
265-
# TODO: readSpatialData fails here, commenting out below code
259+
x <- MulticancerSteinbock()
266260
```
267261

268262
### channels
269263

270264
```{r steinbock-ch}
271-
# plotSpatialData() + plotImage(x,
272-
# i="Patient3_003_image",
273-
# ch=c(6, 22, 39),
274-
# c=c("blue", "cyan", "yellow"))
265+
plotSpatialData() + plotImage(x,
266+
i="Patient3_003_image",
267+
ch=c(6, 22, 39),
268+
c=c("blue", "cyan", "yellow"))
275269
```
276270

277271
### contrasts
278272

279273
```{r steinbock-cl, fig.width=9, fig.height=3}
280-
# i <- image(x, "Patient3_003_image")
281-
# image(x, "crop") <- i[, 200:400, 200:400]
282-
# lapply(list(c(0.2, 1), c(0, 0.8), c(0, 1.2)), \(.) {
283-
# plotSpatialData() + plotImage(x,
284-
# i="crop",
285-
# ch=c(6, 22, 39),
286-
# cl=list(1, 1, .),
287-
# c=c("blue", "cyan", "yellow")) +
288-
# ggtitle(sprintf("[%s, %s]", .[1], .[2]))
289-
# }) |> wrap_plots(nrow=1) + plot_layout(guides="collect")
274+
i <- image(x, "Patient3_003_image")
275+
image(x, "crop") <- i[, 200:400, 200:400]
276+
lapply(list(c(0.2, 1), c(0, 0.8), c(0, 1.2)), \(.) {
277+
plotSpatialData() + plotImage(x,
278+
i="crop",
279+
ch=c(6, 22, 39),
280+
cl=list(1, 1, .),
281+
c=c("blue", "cyan", "yellow")) +
282+
ggtitle(sprintf("[%s, %s]", .[1], .[2]))
283+
}) |> wrap_plots(nrow=1) + plot_layout(guides="collect")
290284
```
291285

292286
# Masking

0 commit comments

Comments
 (0)