BayesSpace
BayesSpace copied to clipboard
imagerow imagecol names in colData
For doing clustering with spatialCluster()
, the vignette makes it clear that colData()
must have columns named "row" and "col" (#34, #40). When calling spatialEnhance()
with visium, it now expects the columns to be "imagerow" and "imagecol":
function (sce, q, platform = c("Visium", "ST"), use.dimred = "PCA",
d = 15, init = NULL, init.method = c("spatialCluster", "mclust",
"kmeans"), model = c("t", "normal"), nrep = 2e+05, gamma = NULL,
mu0 = NULL, lambda0 = NULL, alpha = 1, beta = 0.01, save.chain = FALSE,
chain.fname = NULL, burn.in = 10000, jitter_scale = 5, jitter_prior = 0.3,
verbose = FALSE)
{
assert_that(nrep >= 100)
assert_that(burn.in >= 0)
if (burn.in >= nrep)
stop("Please specify a burn-in period shorter than the total number of iterations.")
thin <- 100
if (length(platform) > 1) {
platform <- .bsData(sce, "platform", match.arg(platform))
}
else {
platform <- match.arg(platform)
}
if (platform == "Visium") {
position.cols <- c("imagecol", "imagerow")
xdist <- ydist <- NULL
}
else if (platform == "ST") {
position.cols <- c("col", "row")
xdist <- ydist <- 1
}
This wasn't clear to me and the error (same as issues referenced above) isn't informative about what the specific issue is. Adding these columns to colData()
manually fixes the problem.
Adding error message:
Error: subscript contains invalid names
Sorry for the delayed response. With Visium data, we use the image coordinates to calculate distance instead of the array coordinates. These should be a part of the SpaceRanger output in the tissue_positions_list.csv, though they might be under another name if you used another package to load in the data. I'll try to clarify this in our next verison.
@edward130603 is spatialEnhance
expecting imagecol
to be the image pixel column? I'm having the same issue described here and it's not clear to me what is needed for this function since .compute_interspot_distances
is looking for all of the following "row", "col", "imagerow", "imagecol"
in colnames(colData(sce)
Currently SpaceRanger tissue_positions.csv defines array_col
, array_row
and pxl_row_in_fullres
, pxl_col_in_fullres
. Further complicating things, the pixel x,y coordinates are no longer stored in the SpatialExperiment colData
slot, but are instead saved in int_colData$spatialCoords
.
Yes, 10x has renamed those columns since we wrote the code. BayesSpace doesn't directly support the SpatialExperiment format yet, aside from the SingleCellExperiment functionality that it inherits..