Skip to content

Commit bee5acb

Browse files
committed
doc: add CODEX examples for spatial plots
1 parent bf42ab8 commit bee5acb

44 files changed

Lines changed: 20826 additions & 104 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

R/spatialutils.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,12 @@ NULL
180180
if (ncol(points_args$data) > 0) {
181181
points_args$data <- points_args$data[, colnames(points_args$data)[!is.na(colnames(points_args$data))], drop = FALSE]
182182
}
183-
points_args$data <- cbind(points_args$data, points_data)
183+
points_args$data <- cbind(points_data, points_args$data)
184+
# check if there is duplicated columns
185+
dup_cols <- duplicated(colnames(points_args$data))
186+
if (any(dup_cols)) {
187+
points_args$data <- points_args$data[, !dup_cols, drop = FALSE]
188+
}
184189
# x and y are already handled in points_data, we don't need to handle the swapping here
185190
points_args$data[[points_args$x]] <- points_args$data[[points_args$x]] * scale_factor
186191
points_args$data[[points_args$y]] <- points_args$data[[points_args$y]] * scale_factor
@@ -209,7 +214,6 @@ NULL
209214
}
210215

211216
facet_by <- NULL
212-
213217
if (!is.null(group_by)) {
214218
if (nrow(object@meta.data) == nrow(points_args$data)) {
215219
points_args$data[[group_by]] <- object@meta.data[[group_by]]
@@ -238,7 +242,6 @@ NULL
238242
facet_by <- ".facet_var"
239243
}
240244
}
241-
242245
points_args$legend.position <- legend.position
243246
points_args$legend.direction <- legend.direction
244247
points_args$flip_y <- flip_y

_pkgdown.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ navbar:
3030
href: articles/Seurat_Xenium.html
3131
- text: "Visualizing Nanostring CosMx data prepared with Seurat"
3232
href: articles/Seurat_Nanostring_CosMx.html
33+
- text: "Visualizing Akoya_CODEX data prepared with Seurat"
34+
href: articles/Seurat_Akoya_CODEX.html
3335
- text: "Visualizing Visium data prepared with Giotto"
3436
href: articles/Giotto_Visium.html
3537
- text: "Visualizing VisiumHD data prepared with Giotto"
@@ -42,6 +44,8 @@ navbar:
4244
href: articles/Giotto_Spatial_CITE-Seq.html
4345
- text: "Visualizing Nanostirng CosMx data prepared with Giotto"
4446
href: articles/Giotto_Nanostring_CosMx.html
47+
- text: "Visualizing CODEX data prepared with Giotto"
48+
href: articles/Giotto_CODEX.html
4549

4650
reference:
4751
- title: scRNA-seq

man/SpatDimPlot.Rd

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/SpatFeaturePlot.Rd

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

notebooks/spatial/Giotto.CODEX.ipynb

Lines changed: 747 additions & 0 deletions
Large diffs are not rendered by default.

notebooks/spatial/Giotto.Nanostring_CosMx.ipynb

Lines changed: 147 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,32 @@
1414
},
1515
{
1616
"cell_type": "code",
17-
"execution_count": 4,
17+
"execution_count": 1,
1818
"id": "24b4fec1",
1919
"metadata": {
2020
"vscode": {
2121
"languageId": "r"
2222
}
2323
},
2424
"outputs": [
25+
{
26+
"name": "stderr",
27+
"output_type": "stream",
28+
"text": [
29+
"Loading required package: GiottoClass\n",
30+
"\n"
31+
]
32+
},
33+
{
34+
"name": "stderr",
35+
"output_type": "stream",
36+
"text": [
37+
"Newer devel version of GiottoClass on GitHub: 0.4.8\n",
38+
"\n",
39+
"Giotto Suite 4.2.1\n",
40+
"\n"
41+
]
42+
},
2543
{
2644
"name": "stdout",
2745
"output_type": "stream",
@@ -497,8 +515,8 @@
497515
},
498516
{
499517
"cell_type": "code",
500-
"id": "cellid-missed-1",
501518
"execution_count": 108,
519+
"id": "cellid-missed-1",
502520
"metadata": {
503521
"vscode": {
504522
"languageId": "r"
@@ -535,8 +553,8 @@
535553
},
536554
{
537555
"cell_type": "code",
538-
"id": "cellid-missed-2",
539556
"execution_count": 109,
557+
"id": "cellid-missed-2",
540558
"metadata": {
541559
"vscode": {
542560
"languageId": "r"
@@ -1618,8 +1636,8 @@
16181636
},
16191637
{
16201638
"cell_type": "code",
1621-
"id": "cellid-missed-3",
16221639
"execution_count": 129,
1640+
"id": "cellid-missed-3",
16231641
"metadata": {
16241642
"vscode": {
16251643
"languageId": "r"
@@ -1660,8 +1678,8 @@
16601678
},
16611679
{
16621680
"cell_type": "code",
1663-
"id": "cellid-missed-4",
16641681
"execution_count": 130,
1682+
"id": "cellid-missed-4",
16651683
"metadata": {
16661684
"vscode": {
16671685
"languageId": "r"
@@ -1747,51 +1765,143 @@
17471765
},
17481766
{
17491767
"cell_type": "code",
1750-
"execution_count": null,
1751-
"id": "e66b989f",
1768+
"execution_count": 39,
1769+
"id": "sessioninfo",
17521770
"metadata": {
17531771
"vscode": {
17541772
"languageId": "r"
17551773
}
17561774
},
17571775
"outputs": [
17581776
{
1759-
"name": "stderr",
1760-
"output_type": "stream",
1761-
"text": [
1762-
"Meta data updated for assay: rna\n",
1763-
"\n"
1764-
]
1765-
},
1766-
{
1767-
"name": "stderr",
1777+
"name": "stdout",
17681778
"output_type": "stream",
17691779
"text": [
1770-
"Meta features updated for assay: negprobes\n",
1771-
"\n"
1780+
"R version 4.4.3 (2025-02-28)\n",
1781+
"Platform: x86_64-conda-linux-gnu\n",
1782+
"Running under: Red Hat Enterprise Linux 8.10 (Ootpa)\n",
1783+
"\n",
1784+
"Matrix products: default\n",
1785+
"\n",
1786+
"locale:\n",
1787+
" [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C \n",
1788+
" [3] LC_TIME=en_US.UTF-8 LC_COLLATE=C \n",
1789+
" [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 \n",
1790+
" [7] LC_PAPER=en_US.UTF-8 LC_NAME=C \n",
1791+
" [9] LC_ADDRESS=C LC_TELEPHONE=C \n",
1792+
"[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C \n",
1793+
"\n",
1794+
"time zone: America/Chicago\n",
1795+
"tzcode source: system (glibc)\n",
1796+
"\n",
1797+
"attached base packages:\n",
1798+
"[1] stats graphics grDevices utils datasets methods base \n",
1799+
"\n",
1800+
"other attached packages:\n",
1801+
"[1] scplotter_0.4.0 Giotto_4.2.1 GiottoClass_0.4.7\n",
1802+
"\n",
1803+
"loaded via a namespace (and not attached):\n",
1804+
" [1] fs_1.6.6 matrixStats_1.5.0 \n",
1805+
" [3] spatstat.sparse_3.1-0 bitops_1.0-9 \n",
1806+
" [5] devtools_2.4.5 httr_1.4.7 \n",
1807+
" [7] RColorBrewer_1.1-3 repr_1.1.7 \n",
1808+
" [9] profvis_0.4.0 tools_4.4.3 \n",
1809+
" [11] sctransform_0.4.2 backports_1.5.0 \n",
1810+
" [13] R6_2.6.1 uwot_0.2.3 \n",
1811+
" [15] lazyeval_0.2.2 urlchecker_1.0.1 \n",
1812+
" [17] withr_3.0.2 sp_2.2-0 \n",
1813+
" [19] gridExtra_2.3 GiottoUtils_0.2.5 \n",
1814+
" [21] progressr_0.15.1 quantreg_6.00 \n",
1815+
" [23] cli_3.6.5 Biobase_2.62.0 \n",
1816+
" [25] spatstat.explore_3.4-3 fastDummies_1.7.5 \n",
1817+
" [27] iNEXT_3.0.1 Seurat_5.3.0 \n",
1818+
" [29] spatstat.data_3.1-6 ggridges_0.5.6 \n",
1819+
" [31] pbapply_1.7-2 pbdZMQ_0.3-14 \n",
1820+
" [33] stringdist_0.9.15 parallelly_1.45.0 \n",
1821+
" [35] sessioninfo_1.2.3 VGAM_1.1-13 \n",
1822+
" [37] rstudioapi_0.17.1 generics_0.1.4 \n",
1823+
" [39] shape_1.4.6.1 gtools_3.9.5 \n",
1824+
" [41] ica_1.0-3 spatstat.random_3.4-1 \n",
1825+
" [43] dplyr_1.1.4 Matrix_1.7-3 \n",
1826+
" [45] S4Vectors_0.40.2 abind_1.4-5 \n",
1827+
" [47] terra_1.8-42 lifecycle_1.0.4 \n",
1828+
" [49] SummarizedExperiment_1.32.0 SparseArray_1.2.4 \n",
1829+
" [51] Rtsne_0.17 grid_4.4.3 \n",
1830+
" [53] promises_1.3.2 crayon_1.5.3 \n",
1831+
" [55] miniUI_0.1.2 lattice_0.22-7 \n",
1832+
" [57] cowplot_1.1.3 pillar_1.10.2 \n",
1833+
" [59] GenomicRanges_1.54.1 rjson_0.2.23 \n",
1834+
" [61] future.apply_1.20.0 codetools_0.2-20 \n",
1835+
" [63] glue_1.8.0 spatstat.univar_3.1-3 \n",
1836+
" [65] data.table_1.17.4 remotes_2.5.0 \n",
1837+
" [67] vctrs_0.6.5 png_0.1-8 \n",
1838+
" [69] spam_2.11-1 gtable_0.3.6 \n",
1839+
" [71] assertthat_0.2.1 cachem_1.1.0 \n",
1840+
" [73] S4Arrays_1.2.1 mime_0.13 \n",
1841+
" [75] tidygraph_1.3.0 survival_3.8-3 \n",
1842+
" [77] SingleCellExperiment_1.24.0 ellipsis_0.3.2 \n",
1843+
" [79] scRepertoire_2.2.1 fitdistrplus_1.2-2 \n",
1844+
" [81] ROCR_1.0-11 nlme_3.1-168 \n",
1845+
" [83] usethis_3.1.0 RcppAnnoy_0.0.22 \n",
1846+
" [85] evd_2.3-7.1 GenomeInfoDb_1.38.8 \n",
1847+
" [87] rprojroot_2.0.4 irlba_2.3.5.1 \n",
1848+
" [89] KernSmooth_2.23-26 plotthis_0.7.0 \n",
1849+
" [91] colorspace_2.1-1 BiocGenerics_0.48.1 \n",
1850+
" [93] tidyselect_1.2.1 compiler_4.4.3 \n",
1851+
" [95] SparseM_1.84-2 xml2_1.3.8 \n",
1852+
" [97] desc_1.4.3 ggdendro_0.2.0 \n",
1853+
" [99] DelayedArray_0.28.0 plotly_4.10.4 \n",
1854+
"[101] checkmate_2.3.2 scales_1.4.0 \n",
1855+
"[103] lmtest_0.9-40 rappdirs_0.3.3 \n",
1856+
"[105] stringr_1.5.1 digest_0.6.37 \n",
1857+
"[107] goftest_1.2-3 spatstat.utils_3.1-4 \n",
1858+
"[109] XVector_0.42.0 htmltools_0.5.8.1 \n",
1859+
"[111] GiottoVisuals_0.2.12 pkgconfig_2.0.3 \n",
1860+
"[113] base64enc_0.1-3 MatrixGenerics_1.14.0 \n",
1861+
"[115] fastmap_1.2.0 rlang_1.1.6 \n",
1862+
"[117] GlobalOptions_0.1.2 htmlwidgets_1.6.4 \n",
1863+
"[119] shiny_1.10.0 farver_2.1.2 \n",
1864+
"[121] zoo_1.8-14 jsonlite_2.0.0 \n",
1865+
"[123] RCurl_1.98-1.17 magrittr_2.0.3 \n",
1866+
"[125] GenomeInfoDbData_1.2.11 dotCall64_1.2 \n",
1867+
"[127] patchwork_1.3.0 IRkernel_1.3.2 \n",
1868+
"[129] Rcpp_1.0.14 evmix_2.12 \n",
1869+
"[131] ggnewscale_0.5.1 viridis_0.6.5 \n",
1870+
"[133] reticulate_1.42.0 truncdist_1.0-2 \n",
1871+
"[135] stringi_1.8.7 ggalluvial_0.12.5 \n",
1872+
"[137] ggraph_2.2.1 zlibbioc_1.48.2 \n",
1873+
"[139] MASS_7.3-64 plyr_1.8.9 \n",
1874+
"[141] pkgbuild_1.4.8 parallel_4.4.3 \n",
1875+
"[143] listenv_0.9.1 ggrepel_0.9.6 \n",
1876+
"[145] forcats_1.0.0 deldir_2.0-4 \n",
1877+
"[147] graphlayouts_1.2.2 IRdisplay_1.1 \n",
1878+
"[149] splines_4.4.3 gridtext_0.1.5 \n",
1879+
"[151] tensor_1.5 circlize_0.4.16 \n",
1880+
"[153] colorRamp2_0.1.0 igraph_2.0.3 \n",
1881+
"[155] uuid_1.2-1 spatstat.geom_3.4-1 \n",
1882+
"[157] cubature_2.1.4 RcppHNSW_0.6.0 \n",
1883+
"[159] reshape2_1.4.4 stats4_4.4.3 \n",
1884+
"[161] pkgload_1.4.0 evaluate_1.0.3 \n",
1885+
"[163] SeuratObject_5.1.0 tweenr_2.0.3 \n",
1886+
"[165] httpuv_1.6.15 MatrixModels_0.5-4 \n",
1887+
"[167] RANN_2.6.2 tidyr_1.3.1 \n",
1888+
"[169] purrr_1.0.4 polyclip_1.10-7 \n",
1889+
"[171] future_1.58.0 scattermore_1.2 \n",
1890+
"[173] ggplot2_3.5.2 ggforce_0.4.2 \n",
1891+
"[175] xtable_1.8-4 RSpectra_0.16-2 \n",
1892+
"[177] later_1.4.2 viridisLite_0.4.2 \n",
1893+
"[179] gsl_2.1-8 tibble_3.2.1 \n",
1894+
"[181] memoise_2.0.1 IRanges_2.36.0 \n",
1895+
"[183] cluster_2.1.8.1 globals_0.18.0 "
17721896
]
1773-
},
1774-
{
1775-
"data": {
1776-
"text/plain": [
1777-
"An object of class Seurat \n",
1778-
"980 features across 73222 samples within 2 assays \n",
1779-
"Active assay: rna (960 features, 0 variable features)\n",
1780-
" 3 layers present: counts, data, scale.data\n",
1781-
" 1 other assay present: negprobes\n",
1782-
" 4 dimensional reductions calculated: pca, tsne, umap, spatial\n",
1783-
" 56 images present: composite_fov001, composite_fov002, composite_fov003, composite_fov004, composite_fov005, composite_fov006, composite_fov007, composite_fov008, composite_fov009, composite_fov010, composite_fov011, composite_fov012, composite_fov013, composite_fov014, composite_fov015, composite_fov016, composite_fov017, composite_fov018, composite_fov019, composite_fov020, composite_fov021, composite_fov022, composite_fov023, composite_fov024, composite_fov025, composite_fov026, composite_fov027, composite_fov028, overlay_fov001, overlay_fov002, overlay_fov003, overlay_fov004, overlay_fov005, overlay_fov006, overlay_fov007, overlay_fov008, overlay_fov009, overlay_fov010, overlay_fov011, overlay_fov012, overlay_fov013, overlay_fov014, overlay_fov015, overlay_fov016, overlay_fov017, overlay_fov018, overlay_fov019, overlay_fov020, overlay_fov021, overlay_fov022, overlay_fov023, overlay_fov024, overlay_fov025, overlay_fov026, overlay_fov027, overlay_fov028"
1784-
]
1785-
},
1786-
"metadata": {},
1787-
"output_type": "display_data"
17881897
}
17891898
],
17901899
"source": [
1791-
"# Convert to Seurat to test with scplotter working with Seurat v5\n",
1792-
"# seurat_cosmx <- giottoToSeuratV5(cosmx)\n",
1793-
"# saveRDS(seurat_cosmx, file = \"data/Nanostring_CosMx_Subcellular_Lung_Cancer/seurat.rds\")\n",
1794-
"# seurat_cosmx"
1900+
"x <- sessionInfo()\n",
1901+
"x <- capture.output(print(x))\n",
1902+
"# hide the BLAS/LAPACK paths\n",
1903+
"x <- x[!startsWith(x, \"BLAS/LAPACK:\")]\n",
1904+
"cat(paste(x, collapse = \"\\n\"))"
17951905
]
17961906
}
17971907
],

0 commit comments

Comments
 (0)