Rphenograph: RphenoGraph clustering

View source: R/phenograph.R

RphenographR Documentation

RphenoGraph clustering

Description

R implementation of the PhenoGraph algorithm

Usage

Rphenograph(data, k = 30)

Arguments

data

matrix; input data matrix

k

integer; number of nearest neighbours (default:30)

Details

A simple R implementation of the [PhenoGraph](http://www.cell.com/cell/abstract/S0092-8674(15)00637-6) algorithm, which is a clustering method designed for high-dimensional single-cell data analysis. It works by creating a graph ("network") representing phenotypic similarities between cells by calclating the Jaccard coefficient between nearest-neighbor sets, and then identifying communities using the well known [Louvain method](https://sites.google.com/site/findcommunities/) in this graph.

Author: Chen Hao, 2015 Copied from https://github.com/JinmiaoChenLab/Rphenograph/blob/master/R/phenograph.R for use in briDiscovr on 200611 under the Artistic-2.0 license

Value

a list contains an igraph graph object for graph_from_data_frame and a communities object, the operations of this class contains:

print

returns the communities object itself, invisibly.

length

returns an integer scalar.

sizes

returns a numeric vector.

membership

returns a numeric vector, one number for each vertex in the graph that was the input of the community detection.

modularity

returns a numeric scalar.

algorithm

returns a character scalar.

crossing

returns a logical vector.

is_hierarchical

returns a logical scalar.

merges

returns a two-column numeric matrix.

cut_at

returns a numeric vector, the membership vector of the vertices.

as.dendrogram

returns a dendrogram object.

show_trace

returns a character vector.

code_len

returns a numeric scalar for communities found with the InfoMAP method and NULL for other methods.

plot

for communities objects returns NULL, invisibly.

References

Jacob H. Levine and et.al. Data-Driven Phenotypic Dissection of AML Reveals Progenitor-like Cells that Correlate with Prognosis. Cell, 2015.

Examples

## Not run: 
iris_unique <- unique(iris) # Remove duplicates
data <- as.matrix(iris_unique[,1:4])
Rphenograph_out <- Rphenograph(data, k = 45)
modularity(Rphenograph_out[[2]])
membership(Rphenograph_out[[2]])
iris_unique$phenograph_cluster <- factor(membership(Rphenograph_out[[2]]))
 ggplot(
  iris_unique,
  aes(x=Sepal.Length, y=Sepal.Width, col=Species, shape=phenograph_cluster)
 ) +
 geom_point(size = 3)+theme_bw()

## End(Not run)

BenaroyaResearch/briDiscovr documentation built on June 14, 2024, 12:29 p.m.