Methods to get or set dimensionality reduction results in a SpatialCellExperiment object. These are typically used to store and retrieve spatial representations of single-cell datasets. Each row of a spatial dimension result is expected to correspond to a column of the SpatialCellExperiment object.

Getters

In the following examples, x is a SpatialCellExperiment object.

spatialDim(x, withDimnames=TRUE):

Retrieves the matrix (or matrix-like object) containing spatial dimension coordinates for cells (rows) and dimensions (columns). If withDimnames=TRUE, row names of the output matrix are replaced with the column names of x.

spatialDimNames(x):

Returns a character vector containing the colnames the spatial dimensions in x.

Setter

spatialDim(x) <- value will replace the spatial dimension matrix in a SpatialCellExperiment object x.

value is expected to be a matrix or matrix-like object with number of rows equal to ncol(x).

Other setters

In the following examples, x is a SpatialCellExperiment object.

spatialDimNames(x) <- value:

Replaces all colnames for the spatial dimension matrix in x with a character vector value.

Examples

example(SpatialCellExperiment, echo=FALSE) spatialDim(sce)
#> x y z #> [1,] 0.842426318 0.58275512 0.215985685 #> [2,] 0.662802126 0.11728582 0.558187574 #> [3,] 0.152046625 0.06774460 0.277437403 #> [4,] 0.048493722 0.68086527 0.028992177 #> [5,] 0.682347335 0.64706667 0.198295721 #> [6,] 0.925881449 0.74850779 0.117573363 #> [7,] 0.241355592 0.33795577 0.410548806 #> [8,] 0.435603612 0.70893690 0.722143371 #> [9,] 0.390683638 0.85473492 0.377669873 #> [10,] 0.481708329 0.95968890 0.429328693 #> [11,] 0.727568083 0.50132297 0.003294391 #> [12,] 0.623249176 0.56249144 0.025601521 #> [13,] 0.627841906 0.57335715 0.399171034 #> [14,] 0.510349185 0.69336102 0.562381765 #> [15,] 0.500361408 0.49645417 0.577632358 #> [16,] 0.713957632 0.45639243 0.235307508 #> [17,] 0.426225610 0.72427532 0.029415340 #> [18,] 0.192107078 0.60143024 0.475016298 #> [19,] 0.803068254 0.50579568 0.315438893 #> [20,] 0.379098169 0.27171308 0.212369952 #> [21,] 0.724254717 0.59835914 0.637179322 #> [22,] 0.561853933 0.59521041 0.630389520 #> [23,] 0.179462418 0.55338766 0.616817596 #> [24,] 0.515041272 0.86230019 0.135413294 #> [25,] 0.561258634 0.78326646 0.748046237 #> [26,] 0.525735178 0.97456212 0.730435218 #> [27,] 0.361389679 0.35447612 0.301156514 #> [28,] 0.107746050 0.82157473 0.239095532 #> [29,] 0.595565261 0.85414710 0.271501162 #> [30,] 0.658941359 0.21020033 0.375416515 #> [31,] 0.427866837 0.19354019 0.261141001 #> [32,] 0.251162454 0.60117628 0.363196876 #> [33,] 0.119485131 0.59781455 0.241956795 #> [34,] 0.347575902 0.25461422 0.519351151 #> [35,] 0.821663966 0.63883027 0.785314879 #> [36,] 0.302311691 0.94828235 0.846039626 #> [37,] 0.318851877 0.73204993 0.642091949 #> [38,] 0.532128387 0.39043797 0.666818284 #> [39,] 0.980710893 0.82145177 0.922747029 #> [40,] 0.073095564 0.07720700 0.119550479 #> [41,] 0.303431019 0.15181029 0.847718566 #> [42,] 0.205182248 0.16440624 0.415208337 #> [43,] 0.519248727 0.02259186 0.893955684 #> [44,] 0.840434714 0.63522825 0.680633412 #> [45,] 0.288040465 0.26934237 0.462821739 #> [46,] 0.257311997 0.71363657 0.536563235 #> [47,] 0.351910220 0.64751038 0.246695161 #> [48,] 0.516957340 0.67802988 0.181223986 #> [49,] 0.182353481 0.77067376 0.069873029 #> [50,] 0.725675224 0.11130057 0.896724775 #> [51,] 0.733668243 0.04584863 0.295600708 #> [52,] 0.984280272 0.46157619 0.438550818 #> [53,] 0.355181921 0.11952027 0.242123282 #> [54,] 0.766883646 0.77560802 0.807206262 #> [55,] 0.247876421 0.14110658 0.604709326 #> [56,] 0.647175500 0.60831899 0.007100157 #> [57,] 0.113254758 0.08239866 0.928650067 #> [58,] 0.195847700 0.26369968 0.087931880 #> [59,] 0.648316447 0.00185577 0.646575193 #> [60,] 0.578222893 0.14011292 0.552329649 #> [61,] 0.766041070 0.49970940 0.046337554 #> [62,] 0.457308889 0.30902298 0.183484838 #> [63,] 0.473061695 0.82560077 0.237627125 #> [64,] 0.594686400 0.38548869 0.917837668 #> [65,] 0.142328049 0.08221195 0.647325859 #> [66,] 0.642204899 0.93486608 0.311124761 #> [67,] 0.771411414 0.53290077 0.624753453 #> [68,] 0.126972362 0.02988108 0.465695599 #> [69,] 0.269667882 0.50528981 0.680307896 #> [70,] 0.871475709 0.86778539 0.314428412 #> [71,] 0.770938872 0.18369989 0.410418959 #> [72,] 0.951296278 0.10483453 0.479465415 #> [73,] 0.996675884 0.31449857 0.001320580 #> [74,] 0.708539288 0.77179476 0.974009219 #> [75,] 0.383904658 0.34168818 0.534596190 #> [76,] 0.817778984 0.06999387 0.091345080 #> [77,] 0.815761610 0.09853999 0.685850119 #> [78,] 0.498404494 0.54453223 0.439939303 #> [79,] 0.813054514 0.94935585 0.875122362 #> [80,] 0.009383485 0.09655750 0.208490255 #> [81,] 0.300005965 0.01872058 0.335255101 #> [82,] 0.576691659 0.73265841 0.093724235 #> [83,] 0.982222076 0.60660748 0.659640339 #> [84,] 0.436234459 0.44750412 0.416939398 #> [85,] 0.357239620 0.28915487 0.550001662 #> [86,] 0.131855344 0.64609218 0.451379414 #> [87,] 0.795660031 0.42524059 0.115069693 #> [88,] 0.654209857 0.13632875 0.422394387 #> [89,] 0.947722815 0.05934315 0.675851716 #> [90,] 0.092526795 0.83205591 0.090310994 #> [91,] 0.606401214 0.68519627 0.126644492 #> [92,] 0.285871020 0.82844798 0.356737308 #> [93,] 0.532354310 0.57240128 0.739221250 #> [94,] 0.358388754 0.15034079 0.474713747 #> [95,] 0.582315718 0.91750995 0.418939631 #> [96,] 0.220287155 0.22519300 0.521233727 #> [97,] 0.383320117 0.67746271 0.271951747 #> [98,] 0.002771809 0.44687336 0.296055088 #> [99,] 0.084108869 0.13198688 0.004309074 #> [100,] 0.443254097 0.54860844 0.232573488
spatialDimNames(sce)
#> [1] "x" "y" "z"