DavisLaboratory / standR

Spatial transcriptomics analyses and decoding in R
https://davislaboratory.github.io/standR/
Other
18 stars 4 forks source link

PrepareSpatialDecon error message #33

Closed emiliasiukola closed 2 weeks ago

emiliasiukola commented 6 months ago

When using the code: spd <- prepareSpatialDecon(spe_tmm)

we are getting error message: "NegProbe-WTXmust be included in the dataset. Perhaps specify rmNegProbe=TRUE when using readGeoMx" when using prepareSpatialDecon. We are using WTA so there are several negative probes, however we do not understand what the pool= variable in the command should look like. We have already specified rmNegProbe=TRUE when using readGeoMx.

Regards, Emilia

ningbioinfo commented 6 months ago

Hi @emiliasiukola , the input for the pool argument is a vector with length of the genes, i.e. nrow(spe). It should be something like c("negprob1","negprob1","negprob1","negprob2","negprob2","negprob2"..., "negprobx"), so it tells the function with negative probes is governing which genes.

kimsjune commented 1 month ago

I wonder if the current prepareSpatialDecon function can deal with more than one "NegProbe-WTX". For me, the spe output form readGeoMx with rmNegProbe set to FALSE contains 139 negative probe values with the prefix, NegProbe-WTX_. I'm ignoring normalization for the sake of simplicity. This line in prepareSpatialDecon will return true (shows error) because there is no exact match:

!all("NegProbe-WTX" %in% rownames(spe))
[1] TRUE 

table(grepl("NegProbe-WTX", rownames(spe)))
FALSE TRUE
18676 139

prepareDecon looks similar to derive_GeoMx_background provided by SpatialDecon. I ran the following command instead:

bg <- derive_GeoMx_background(norm = assay(spe, "logcounts"),
probepool = rep(1, nrow(assay(spe, "logcounts"))),
negnames = paste0("NegProbe-WTX_", c(1:139)))

Here, more than one name for negative probes can be set, which I found here. Then I used bg with spatialdecon.

ningbioinfo commented 1 month ago

Hi @kimsjune , yes you're correct, both functions serve the similar purpose. Perhaps I should update it in the next version for automatically do this if multi-probs are detected...