scDHA.vis: scDHA visulization

Description Usage Arguments Value Examples

View source: R/Analysis.R

Description

Generating 2D embeded data for visulation.

Usage

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

Examples

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