scDHA.pt | R Documentation |
Inferring pseudo-time data.
scDHA.pt(sc = sc, start.point = 1, ncores = 10L, seed = NULL)
sc |
Embedding object, produced by |
start.point |
Starting point of the trajectory. |
ncores |
Number of processor cores to use. |
seed |
Seed for reproducibility. |
List with the following keys:
pt - Pseudo-time values for each sample.
library(scDHA)
#Load example data (Goolam dataset)
data('Goolam'); data <- t(Goolam$data); label <- as.character(Goolam$label)
#Log transform the data
data <- log2(data + 1)
if(torch::torch_is_installed()) #scDHA need libtorch installed
{
#Generate clustering result, the input matrix has rows as samples and columns as genes
result <- scDHA(data, ncores = 2, seed = 1)
#Cell stage order in Goolam dataset
cell.stages <- c("2cell", "4cell", "8cell", "16cell", "blast")
#Generate pseudo-time for each cell, the input is the output from scDHA function
result <- scDHA.pt(result, start.point = 1, ncores = 2, seed = 1)
#Calculate R-squared value
r2 <- round(cor(result$pt, as.numeric(factor(label, levels = cell.stages)))^2, digits = 2)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.