Closed sayadennis closed 1 year ago
We got the signature genes from "Zeisel et al. Molecular architecture of the mouse nervous system. Cell". Then, the average signature gene expression was calculated for each cell type in single cell RNA-seq. The "sig_ct_exp.RData" is the cell type with average signature gene expression. This matrix could definitely generated by Giotto. You could simply follow the steps in "https://github.com/rdong08/spatialDWLS_dataset/blob/main/codes/Heart_ST_tutorial_spatialDWLS.Rmd". The "Sig_exp" is the matrix for deconvolution. What you need for the input is the single cell gene expression matrix and the cell type annotation for each cell.
The steps in your link worked beautifully! Thank you so much.
I was trying to follow the visualization instructions at the end of the Rmd, and noticed that the code results in an empty plot, perhaps due to the df <- data.frame()
line?
I modified the code a bit and tried the below, which successfully plotted the spots but they are all black. I'm guessing color=NA
might need to be changed but can't seem to find which attribute can be plugged in there. Sorry this is a bit unrelated to the created issue, but I would really appreciate your help.
plot_data <- as.data.frame(visium_brain@spatial_enrichment$DWLS)[-1]
plot_col <- colnames(plot_data)
plot_data$x <- as.numeric(as.character(visium_brain@spatial_locs$sdimx))
plot_data$y <- as.numeric(as.character(visium_brain@spatial_locs$sdimy))
min_x <- min(plot_data$x)
plot_data$radius <- 0.4
df <- plot_data # did this instead of df <- data.frame()
p <- ggplot(df) +
geom_point(aes(x=x, y=y), data=plot_data) + # changed this part a bit too
xlim(min(plot_data$x)-1, max(plot_data$x)+1) +
ylim(min(plot_data$y)-1, max(plot_data$y)+1)
p + geom_scatterpie(aes(x=x, y=y, r=radius), data=plot_data, cols=plot_col, color=NA, alpha=.8) +
geom_scatterpie_legend(plot_data$radius, x=1, y=1) + theme_classic()
You may need to check "plot_data" to see if this data frame is correct. The detailed usage for geom_scatterpie is located at "https://cran.r-project.org/web/packages/scatterpie/vignettes/scatterpie.html".
Thanks! The scatterpie vignette helped a lot with troubleshooting since I could picture what the final product should look like.
It turns out the problem was that radius=0.4
was too small and resulting in an empty-looking plot for me. Probably had to do with the scale of the coordinates.
Anyway, the problem is solved! Thank you so much Rui for your prompt response and help. We can close this issue for now.
Hi @rdong08,
Thank you for sharing the code to run DWLS deconvolution! This is super helpful. I'm working through
Visium_Brain_spatialDWLS.Rmd
and had one question.Could you please let me know how you generated your
spatialDWLS_dataset/datasets/mouse_brain_visium/sig_ct_exp.RData
file?I was wondering if it's something with
makeSignMatrixDWLS()
but I couldn't figure out how to run this. Specifically, I'm not sure what goes in thesign_gene=
andcell_type_vector=
variables in this function. Can we generate these variables from the Giotto existing object?Thank you in advance for your time!