View source: R/run_scfeatures.R
run_gene_prop_celltype | R Documentation |
This function computes the proportion of expression of a set of genes for each cell type in the input data. The input data can be of three types: 'scrna', 'spatial_p' or 'spatial_t'. If the genes parameter is not provided by the user, the top variable genes will be selected based on the num_top_gene parameter (defaults to 100).
run_gene_prop_celltype(
data,
type = "scrna",
genes = NULL,
num_top_gene = NULL,
ncores = 1
)
data |
A list object containing |
type |
The type of dataset, either "scrna", "spatial_t", or "spatial_p". |
genes |
Optional dataframe with 2 columns: 'marker' and 'celltype'. The 'marker' column should contain the genes of interest (e.g. 'S100A11', 'CCL4'), and the 'celltype' column should contain the celltype that the gene expression is to be computed from (e.g. 'CD8', 'B cells'). If not provided, the top variable genes will be used based on the num_top_gene parameter. |
num_top_gene |
Number of top genes to use when genes is not provided. Defaults to 100. |
ncores |
Number of cores for parallel processing. |
a dataframe of samples x features. The features are in the form of gene 1 celltype a, gene 2 celltype b ... etc, with the number representing proportion of gene expression of the given gene across the cells of the the given celltype.
utils::data("example_scrnaseq" , package = "scFeatures")
data <- example_scrnaseq[, 1:20]
celltype <- data$celltype
sample <- data$sample
data <- data@assays$RNA@data
alldata <- scFeatures:::formatData(data = data, celltype = celltype, sample = sample )
feature_gene_prop_celltype <- run_gene_prop_celltype(
alldata,
type = "scrna", num_top_gene = 100, ncores = 1
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.