Title: | Granularity-Based Spatially Variable Genes Identifications |
---|---|
Description: | Identifying spatially variable genes is critical in linking molecular cell functions with tissue phenotypes. This package implemented a granularity-based dimension-agnostic tool for the identification of spatially variable genes. The detailed description of this method is available at Wang, J. and Li, J. et al. 2023 (Wang, J. and Li, J. (2023), <doi:10.1038/s41467-023-43256-5>). |
Authors: | Jinpu Li [aut, cre] |
Maintainer: | Jinpu Li <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.0.2 |
Built: | 2024-11-02 03:26:32 UTC |
Source: | https://github.com/cran/GrabSVG |
This function is designed to identify spatially variable genes through a granularity-based approach.
GrabSVG(Coords, ExpMat_Sp, D_1 = 1.0, D_2 = 3.0, Exp_Norm = TRUE, Coords_Norm_Method = c("Sliced", "Overall", "None"))
GrabSVG(Coords, ExpMat_Sp, D_1 = 1.0, D_2 = 3.0, Exp_Norm = TRUE, Coords_Norm_Method = c("Sliced", "Overall", "None"))
Coords |
A M x D matrix representing D-dimensional coordinates for M spots |
ExpMat_Sp |
A sparse, N x M expression matrix in dgCMatrix class with N genes and M spots |
D_1 |
Size of the small patch |
D_2 |
Size of the big patch |
Exp_Norm |
A Boolean value indicating whether the expression matrix should be normalized |
Coords_Norm_Method |
Normalization method for the coordinates matrix, which can be "None", "Sliced", or "Overall". |
This function utilizes a MxD matrix (Coords) representing D-dimensional coordinates with M spots and a sparse, NxM expression matrix (ExpMat_Sp) with N genes and M spots.
A data frame with the name of genes and corresponding p-values.
Coords <- expand.grid(1:100,1:100, 1:3) RandFunc <- function(n) floor(10 * stats::rbeta(n, 1, 5)) Raw_Exp <- Matrix::rsparsematrix(nrow = 10^4, ncol = 3*10^4, density = 0.0001, rand.x = RandFunc) Filtered_ExpMat <- SpFilter(Raw_Exp) rownames(Filtered_ExpMat) <- paste0("Gene_", 1:nrow(Filtered_ExpMat)) P_values <- GrabSVG(Coords, Filtered_ExpMat)
Coords <- expand.grid(1:100,1:100, 1:3) RandFunc <- function(n) floor(10 * stats::rbeta(n, 1, 5)) Raw_Exp <- Matrix::rsparsematrix(nrow = 10^4, ncol = 3*10^4, density = 0.0001, rand.x = RandFunc) Filtered_ExpMat <- SpFilter(Raw_Exp) rownames(Filtered_ExpMat) <- paste0("Gene_", 1:nrow(Filtered_ExpMat)) P_values <- GrabSVG(Coords, Filtered_ExpMat)
A function to load and filter data from a Seurat object or a data frame.
LoadSpatial(InputData, Dimension = 2)
LoadSpatial(InputData, Dimension = 2)
InputData |
A Seurat spatial object or a M x (D + N) data matrix representing the D-dimensional coordinates and expressions of N genes on M spots. The coordinates should be placed at the first D columns |
Dimension |
The dimension of coordinates |
A list of two data frame:
Coords |
A M x D matrix representing D-dimensional coordinates for M spots |
ExpMatrix |
A sparse, N x M expression matrix in dgCMatrix class with N genes and M spots |
A function for filtering low expressed genes
SpFilter(ExpMat_Sp, Threshold = 5)
SpFilter(ExpMat_Sp, Threshold = 5)
ExpMat_Sp |
A sparse, N x M expression matrix in dgCMatrix class with N genes and M spots |
Threshold |
A threshold set to filter out genes with a total read count below this specified value |
A sparse expression matrix in dgCMatrix class
# create a sparse expression matrix Raw_ExpMat <- Matrix::rsparsematrix(nrow = 10000, ncol = 2000, density = 0.01, rand.x = function(n) rpois(n, 15)) Filtered_ExpMat <- SpFilter(Raw_ExpMat)
# create a sparse expression matrix Raw_ExpMat <- Matrix::rsparsematrix(nrow = 10000, ncol = 2000, density = 0.01, rand.x = function(n) rpois(n, 15)) Filtered_ExpMat <- SpFilter(Raw_ExpMat)