scDHA: scDHA

View source: R/scDHA.R

scDHAR Documentation

scDHA

Description

The main function to perform dimension deduction and clustering.

Usage

scDHA(
  data = data,
  k = NULL,
  method = "scDHA",
  sparse = FALSE,
  n = 5000,
  ncores = 10L,
  gen_fil = TRUE,
  do.clus = TRUE,
  sample.prob = NULL,
  seed = NULL
)

Arguments

data

Gene expression matrix, with rows represent samples and columns represent genes.

k

Number of clusters, leave as default for auto detection. Has no effect when do.clus = False.

method

Method used for clustering. It can be "scDHA" or "louvain". The default setting is "scDHA".

sparse

Boolen variable indicating whether data is a sparse matrix. The input must be a non negative sparse matrix.

n

Number of genes to keep after feature selection step.

ncores

Number of processor cores to use.

gen_fil

Boolean variable indicating whether to perform scDHA gene filtering before performing dimension deduction and clustering.

do.clus

Boolean variable indicating whether to perform scDHA clustering. If do.clus = False, only dimension deduction is performed.

sample.prob

Probability used for classification application only. Leave this parameter as default, no user input is required.

seed

Seed for reproducibility.

Value

List with the following keys:

  • cluster - A numeric vector containing cluster assignment for each sample. If do.clus = False, this values is always NULL.

  • latent - A matrix representing compressed data from the input data, with rows represent samples and columns represent latent variables.

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)
  #The clustering result can be found here 
  cluster <- result$cluster
}


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