createFromSCE: Creates a 'TreeViz" object from 'SingleCellExperiment'....

Description Usage Arguments Value Examples

View source: R/helper-functions.R

Description

Creates a 'TreeViz“ object from 'SingleCellExperiment'. Generates clusters based on Walktrap algorithm if no default is provided

Usage

1
2
3
4
5
6
7
createFromSCE(
  object,
  check_coldata = FALSE,
  col_regex = NULL,
  columns = NULL,
  reduced_dim = c("TSNE")
)

Arguments

object

'SingleCellExperiment' object to be visualized

check_coldata

whether to colData of 'SingeCellExperiment' object for cluster information or not

col_regex

common regular expression shared across all columns with cluster information

columns

vector containing columns with cluster information

reduced_dim

Vector of Dimensionality reduction information provided in 'SingeCellExperiment' object to be added in 'TreeViz' (if exists)

Value

'TreeViz' Object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
library(SingleCellExperiment)
library(scater)
sce <- mockSCE()
sce <- logNormCounts(sce)
sce <- runTSNE(sce)
sce <- runUMAP(sce)
set.seed(1000)
for (i in  seq_len(5)) {
clust.kmeans <- kmeans(reducedDim(sce, "TSNE"), centers = i)
sce[[paste0("clust", i)]] <- factor(clust.kmeans$cluster)
}
treeviz <-createFromSCE(sce, check_coldata = TRUE, col_regex = "clust", reduced_dim = c("TSNE", "UMAP"))

HCBravoLab/TreeViz documentation built on Sept. 29, 2021, 4:31 a.m.