scDHA.vis: scDHA visulization

View source: R/Analysis.R

scDHA.visR Documentation

scDHA visulization

Description

Generating 2D embeded data for visulation.

Usage

scDHA.vis(sc = sc, method = "UMAP", ncores = 10L, seed = NULL)

Arguments

sc

Embedding object produced by the scDHA function.

method

Visualization method to use. It can be "UMAP" or "scDHA". The default setting is "UMAP".

ncores

Number of processor cores to use.

seed

Seed for reproducibility.

Value

a list with the following keys:

  • pred - A matrix representing the 2D projection of single-cell data, where rows represent samples and columns represent latent components.

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)
  #Generate 2D representation, the input is the output from scDHA function
  result <- scDHA.vis(result, ncores = 2, seed = 1)
  #Plot the representation of the dataset, different colors represent different cell types
  plot(result$pred, col=factor(label), xlab = "scDHA1", ylab = "scDHA2")
}


scDHA documentation built on May 29, 2024, 4:51 a.m.