scDHA.pt: scDHA pseudo time inference

Description Usage Arguments Value Examples

View source: R/Analysis.R

Description

Inferring pseudo-time data.

Usage

1
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:

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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 Sept. 16, 2021, 1:07 a.m.