-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
error with SpatialEnhance #129
Comments
Sorry for the delayed response. Can you post the output of traceback()? Did you load the data using BayesSpace or another package such as SpatialExperiment? |
Dear Edward,
Thank you for your reply.
Below you can find my script but I followed the vignette from https://www.ezstatconsulting.com/BayesSpace/articles/BayesSpace.html
library(SingleCellExperiment)
library(ggplot2)
library(BayesSpace)
sce <- SingleCellExperiment(assays=list(counts=as(counts, "dgCMatrix")),
colData=coord_x_y)
############################### PREPROCESSING DATA ################################
set.seed(102)
se_filtered<- spatialPreprocess(sce, platform="Visium",
n.PCs=15, n.HVGs=2000) ## allow for log-normalization, findvariable feature and runPCA
se_filtered <- qTune(se_filtered, q=seq(2, 15), platform="Visium", d=15, burn.in = 100, nrep = 1000)
qPlot(se_filtered)
############################### CLUSTERING DATA WITH BAYES SPACE ################################
set.seed(149)
se_filtered <- spatialCluster(se_filtered, q=5, # choose q function of the qplot
platform="Visium", d=7,# nb of PC to use
init.method="mclust", model="t",
gamma=3, #gamma = 2 if platform = ST or 3 if = Visium
nrep=1000, #suggest running with at least 10,000 iterations
burn.in=100,
save.chain=TRUE) # model = 'normal' or 't' but t better performance
head(colData(se_filtered))
clusterPlot(se_filtered)
--> This is working well.
############################### ENHANCE RESOLUTION ################################
se_filtered.enhanced <- spatialEnhance(se_filtered, q=8, d=7, platform="Visium",
model="t", gamma=3,
jitter_prior=0.3, jitter_scale=3.5,
nrep=1000, #suggest running with at least 10,000 iterations
burn.in=100,
save.chain=TRUE)
head(colData(se_filtered.enhanced))
clusterPlot(se_filtered.enhanced)
--> This does not work and I have the error message : Error: subscript contains invalid names
traceback()
12: stop(wmsg(...), call. = FALSE)
11: .subscript_error("subscript contains invalid ", what)
10: NSBS(i, x, exact = exact, strict.upper.bound = !allow.append,
allow.NAs = allow.NAs)
9: NSBS(i, x, exact = exact, strict.upper.bound = !allow.append,
allow.NAs = allow.NAs)
8: normalizeSingleBracketSubscript(i, xstub)
7: extractCOLS(x, j)
6: extractCOLS(x, j)
5: colData(sce)[position.cols]
4: colData(sce)[position.cols]
3: as.matrix(colData(sce)[position.cols])
2: .prepare_inputs(sce, use.dimred = use.dimred, d = d, positions = NULL,
position.cols = position.cols, xdist = xdist, ydist = ydist)
1: spatialEnhance(se_filtered, q = 8, d = 7, platform = "Visium",
model = "t", gamma = 3, jitter_prior = 0.3, jitter_scale = 3.5,
nrep = 1000, burn.in = 100, save.chain = TRUE)
However, when I replace platform = "ST" instead of Visium, it works.
se_filtered.enhanced <- spatialEnhance(se_filtered, q=5, d=7, platform="ST",
model="t", gamma=2,
jitter_prior=0.3, jitter_scale=3.5,
nrep=1000, #suggest running with at least 10,000 iterations
burn.in=100,
save.chain=TRUE)
Calculating labels using iterations 100 through 1000.
traceback()
12: stop(wmsg(...), call. = FALSE)
11: .subscript_error("subscript contains invalid ", what)
10: NSBS(i, x, exact = exact, strict.upper.bound = !allow.append,
allow.NAs = allow.NAs)
9: NSBS(i, x, exact = exact, strict.upper.bound = !allow.append,
allow.NAs = allow.NAs)
8: normalizeSingleBracketSubscript(i, xstub)
7: extractCOLS(x, j)
6: extractCOLS(x, j)
5: colData(sce)[position.cols]
4: colData(sce)[position.cols]
3: as.matrix(colData(sce)[position.cols])
2: .prepare_inputs(sce, use.dimred = use.dimred, d = d, positions = NULL,
position.cols = position.cols, xdist = xdist, ydist = ydist)
1: spatialEnhance(se_filtered, q = 5, d = 7, platform = "Visium",
model = "t", gamma = 2, jitter_prior = 0.3, jitter_scale = 3.5,
nrep = 1000, burn.in = 100, save.chain = TRUE)
I remain at your disposal for any additional information you could need.
Thanks again for your help,
Best regards,
Laetitia Collet,
MD, PhD student
Institut Jules Bordet
Medical Oncology Department,
Breast Cancer Translational Research Laboratory (BCTL)
Université Libre de Bruxelles (ULB)
Rue Meylemeersch 90, 1070 Anderlecht
Brussels
Belgium
***@***.***<https://hubruxelles.be>
Lien vers Disclaimer<https://www.hubruxelles.be/sites/default/files/email-disclaimer.html>
…________________________________
De : Edward Zhao ***@***.***>
Envoyé : jeudi 8 août 2024 08:44:55
À : edward130603/BayesSpace
Cc : COLLET, Laetitia; Author
Objet : Re: [edward130603/BayesSpace] error with SpatialEnhance (Issue #129)
Ce message provient de l'extérieur. Soyez attentif lors de l'ouverture de pièces jointes ou de liens provenant d'expéditeurs que vous ne connaissez pas.
Deze e-mail komt van een externe afzender. Open geen bijlagen en klik niet op de links, tenzij u de afzender kent.
Sorry for the delayed response. Can you post the output of traceback()? Did you load the data using BayesSpace or another package such as SpatialExperiment?
—
Reply to this email directly, view it on GitHub<#129 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A4KVCTCF5NALCRRYM674BLTZQMHWPAVCNFSM6AAAAABL33LW6OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENZVGA3DSMJYG4>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Ok, I think this is happening because your colData doesn't have the full spatial set of spatial coordinate info. Your colData should have columns from tissue_positions.csv. Depending on the version of software you are using it would be either 1) the columns If you used BayesSpace or SpatialExperiment to load in your data, you should have these columns by default. If you used some other tool, you may need to modify your data object to add these columns. Neighborhood detection for spatialCluster only uses row/col but for spatialEnhance uses both sets of coordinates. |
Dear Edward,
I am trying to run bayes space version ‘1.8.2’ with visium ST data (from Cytassist). When I run
spatialCluster(se_filtered, q=8, platform="Visium", d=7, nit.method="mclust", model="t", gamma=3, nrep=1000, burn.in=100, save.chain=TRUE) it is working.
However with spatialEnhance I have an error message :
se_filtered.enhanced <- spatialEnhance(se_filtered, q=8, d=7, platform="Visium",
Error: subscript contains invalid names
However when I run the same command with platform = "ST" it does work.
Have you already encounter this specific problem ?
Thank you in advance for your reply.
Best regards,
The text was updated successfully, but these errors were encountered: