scDHA.pt: scDHA pseudo time inference

View source: R/Analysis.R

scDHA.ptR Documentation

scDHA pseudo time inference

Description

Inferring pseudo-time data.

Usage

scDHA.pt(sc = sc, start.point = 1, ncores = 10L, seed = NULL)

Arguments

sc

Embedding object, produced by scDHA function.

start.point

Starting point of the trajectory.

ncores

Number of processor cores to use.

seed

Seed for reproducibility.

Value

List with the following keys:

  • pt - Pseudo-time values for each sample.

Examples


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)
}


scDHA documentation built on April 4, 2023, 5:11 p.m.