Learn R Programming

singleCellHaystack (version 0.3.4)

hclust_haystack_raw: Function for hierarchical clustering of genes according to their distribution on a 2D plot.

Description

Function for hierarchical clustering of genes according to their distribution on a 2D plot.

Usage

hclust_haystack_raw(x, y, detection, genes, method = "ward.D")

Value

An object of class hclust, describing a hierarchical clustering tree.

Arguments

x

x-axis coordinates of cells in a 2D representation (e.g. resulting from PCA or t-SNE)

y

y-axis coordinates of cells in a 2D representation

detection

A logical matrix showing which genes (rows) are detected in which cells (columns)

genes

A set of genes (of the 'detection' data) which will be clustered.

method

The method to use for hierarchical clustering. See '?hclust' for more information. Default: "ward.D".

Examples

Run this code
# using the toy example of the singleCellHaystack package
# define a logical matrix with detection of each gene (rows) in each cell (columns)
dat.detection <- dat.expression > 1

# running haystack in default mode
res <- haystack(dat.tsne, detection=dat.detection, method = "2D")

# get biased genes, store in variable gene.subset
sorted.table <- show_result_haystack(res, p.value.threshold = 1e-5)
gene.subset <- row.names(sorted.table)

# hierarchical clustering, and cutting into 5 clusters
hc <- hclust_haystack(dat.tsne, detection=dat.detection, genes=gene.subset)
hc.clusters <- cutree(hc,k = 5)

Run the code above in your browser using DataLab