convert_sce.R: builds the SingleCellExperiment Bioconductor object and defines some plotting functions used in other scripts.sce_scran.R: determines the 1942 variable genes, computes PCs and saves thesceobject (fileHuman_DLPFC_Visium_processedData_sce_scran.Rdata) used by other scripts. Also explores several things you can do based on https://osca.bioconductor.org/ and thescranvignette.sce_zinbwave.R: uses thesceobject fromsce_scran.Rand runszinbwave.sce_image.R: uses thesceobject fromsce_scran.Rand runs several k-means approaches using theclusteRpackage.
Related files:
/dcs04/lieber/lcolladotor/with10x_LIBD001/HumanPilot/Analysis/Human_DLPFC_Visium_processedData_sce.Rdata/dcs04/lieber/lcolladotor/with10x_LIBD001/HumanPilot/Analysis/geom_spatial.Rdata
Details:
- Builds the
sceobject with image data undermetadata(sce)$imagewhich is a single data.frame. Subsetting doesn't automatically subset the image, so you have to do it yourself when plotting. - Creates some of the functions and the ggplot2
geom_spatial()layer used for plotting later on. Newer and more complex versions are in theglobal.Rfile fromspatialLIBD. In particular, the colors are different between these versions as nowspatialLIBDuses the original colors from the 10X scripts when the number of clusters <= 12 and then relies onPolychrome::palette36.colors()(which would break if more than 36 colors are needed).
Related files:
- pdf_scran
- rda_scran
/dcs04/lieber/lcolladotor/with10x_LIBD001/HumanPilot/Analysis/Human_DLPFC_Visium_processedData_sce_scran.Rdata
Details:
- Defines the
sceandtop.hvgsobjects used in other scripts and inspatialLIBD. As we decide to add more stuff to thesceobject, I'll edit this R code as well. - Builds a SNN graph with 50 nearest neighbors (K=50) that results in 28 clusters across all 12 images.
- Cuts that SNN graph to k = 4 up to 28.
- Mostly follows https://osca.bioconductor.org/.
It's long enough now that I'll continue new analyses in other scripts.
Related files:
Details:
- Runs
zinbwave::zinbwave()and saves the results. Initially, it chose the genes usingzinbwavebut now it uses the same ones fromsce_scran.R. It failed at runningRSEC()either due to memory (when usingkmeans) or because I stopped trying to getClusteR::KMeans_rcppto work withRSEC().
Related files:
Details:
- The name of the script comes from me thinking that we could process it like an image as in https://cran.rstudio.com/web/packages/ClusterR/vignettes/the_clusterR_package.html (the dog example). But then I realized that the image example didn't use X or Y information. Some of this quick exploration code is near the end of the script (just so I wouldn't lose the code forever).
- Ultimately, the likely useful output of this script is the set of k-means clusters from k = 4 up to 28 using
ClusteR. Although I didn't save all the kmeans output (only the cluster labels), so we might need to re-compute it. - This is also the script where I played the most with trying to add the X and Y information as well as a blocking factor (6 levels, one per each subject + slice (position) pair of images).