ECLAIR
Robust and scalable inference of cell lineages via consensus clustering. Features novel algorithms for the comparison of weighted graphs and unrooted trees.
Install / Use
/learn @GGiecold-zz/ECLAIRREADME
ECLAIR
Robust and scalable inference of cell lineages from gene expression data.
ECLAIR achieves a higher level of confidence in the estimated lineages through the use of approximation algorithms for consensus clustering and by combining the information from an ensemble of minimum spanning trees so as to come up with an improved, aggregated lineage tree.
In addition, the present package features several customized algorithms for assessing the similarity between weighted graphs or unrooted trees and for estimating the reproducibility of each edge in a given tree.
How ECLAIR graphs and trees are generated
ECLAIR stands for Ensemble Clustering for Lineage Analysis, Inference and Robustness. It proceeds as follow:
-
Choose among affinity propagation, hierarchical or k-means clustering and DBSCAN (cf. our
DBSCAN_multiplexandConcurrent_APpackages for streamlined and scalable implementations of DBSCAN and affinity propagation clustering) for how to group cells from subsamples of your dataset. -
Such a subsample is obtained by density-based downsampling (as implemented in our
Density_Samplingsoftware posted on the Python Package Index), either by aiming for an overall number of datapoints to extract from the dataset or by specifiying a target percentile of the distribution built from local densities around each datapoint. -
ECLAIR then goes about performing several rounds of downsampling and clustering on such subsamples, for as many iterations as specified by the user. After each run of clustering a given subsample, the datapoints that were left over by the downsampling procedure are upsampled by associating them to the closest centroid in high-dimensional feature space.
-
For each such run, build a minimum spanning tree. This minimum spanning tree is obtained from a matrix of L2 pairwise similarities between the centroids associated to each cluster.
-
The next step obtains a consensus clustering from this ensemble of partitions of the whole dataset. Three heuristic methods are considered for this purpose: CSPA, HGPA and MCLA, all of them based on graph or hypergraph partitioning (cf. the documentation of our
Cluster_Ensemblespackage for more information). -
Once a consensus clustering has been reached, we build a graph from the consensus clusters and from the information associated with the ensemble of partitions from which those consensus clusters have just been computed. The edge weights of this graph are calculated as the mean of the following distribution: for each of the 2-uple consisting of one datapoint from consensus cluster
aand another datapoint from consensus clusterb, scan over the ensemble of partitions and keep track of the distance separating those two samples across each partition comprising the cluster ensemble. -
We then obtain a minimum spanning tree from this graph, for convenience of visualization as well as for later comparison with a few other methods that purport to provide estimates of cell lineages (including the popular SPADE method, whose reproducibility issues spurred the development of ECLAIR. A module from the present package is indeed dedicated to illustrating the superior statistical performance of ECLAIR).
Statistical performance of ECLAIR
To compare two lineage trees, one has to take into account their edge connections but also the sample contents of their nodes, since the variation associated to subsampling results in different clusters of samples. Although there are many papers on graph matching and graph comparison, we are not aware of any previously published method that takes into account the node differences. We therefore developed customized statistical tests suitable for comparing lineage trees.
-
The first score we developped aims to compare the overall similarity between two lineage trees,
T_1andT_2. For each tree, we evaluate the path length between every pair of cells in the population, based on the edge connectivity. The correlation between the two sets of path length values is used as a score to compare the overall similarity ofT_1andT_2. For a moderately large dataset of 500,000 samples, this would naively translate into more than 100 billion pairs of distances alongT_1and alongT_2. The details of the much more efficient algorithm we developped for that purpose is available from the docstrings of our package; the gist of this algorithm is to first build a contingency table recording the overlap in the number of samples between pairs ofT_1nodes versus pairs ofT_2nodes. -
Second, we define
D_ijas an edge-specific measures of statistical dispersion to evaluate the robustness of each edge within a given lineage tree , denotedT*. Specifically, for each edgeE_ijconnecting a pair of clustersC_i*andC_j*, we define the dispersionD_ijassociated withE_ijas the standard deviation of the the distribution of path lengthsL^a(x,y), wherexandyare selected fromC_i*andC_j*respectively, andais summed over the partitions and minimum spanning trees from the ensemble out of whichT*was constructed in the first place. This distribution is the same as the distribution of path lengths whose mean was used to assign a weight to edgeE_ijof the graph from which the ECLAIR tree was inferred in the first place. -
The afore-mentioned measure of statistical dispersion is computed solely in terms of the partitions and trees making up an ensemble from which a consensus clustering and an ECLAIR tree are then extracted. We also compare this measure with another measure of statistical dispersion, obtained by independently generating 50 different ECLAIR trees in a procedure reminiscent of the bootstrap. One such tree is singled out as a reference tree. For each edge of this reference tree, we keep track of how spread out are the pairs of cells comprising the two nodes of this reference edge across the rest of the 49 ECLAIR tree.
Our ECLAIR package features a module entirely devoted to computing through befitting data structures and algorithms such statistical measures and a few more tests on pairs of ECLAIR trees.
Installation
ECLAIR is written in Python 2.7. It has been tested on Fedora Linux and on Ubuntu and should be supported by any other member of the UNIX-like family of operating systems.
Install ECLAIR by sending a request to the Python Package Index (PyPI) as follows:
- start a terminal;
- enter
pip install ECLAIR.
Any missing or out-of-date dependency should be automatically resolved. Apart from the Python Standard Library, those include:
Cluster_Ensembles(version 1.16 or later)Concurrent_AP(version 1.3 or later)DBSCAN_multiplex(version 1.5 or ulterior)Density_Sampling(1.1 or subsequent version)igraphmatplotlib(version 1.4.3 at least)munkresnumpy(1.9.0 or ulterior version)-
numpy(1.9.0 or ulterior version)scipy(0.16 or later version)sklearnsetuptoolstables
Please note that as part of the installation of this package, some code written in C that is part of the Cluster_Ensembles package will be automatically compiled, under the hood and according to the specifications of your machine. For this process to go seamlessly, you have however to ensure availability of CMake and GNU make on your operating system. Cluster_Ensembles also requires the 32-bit version of the GNU C library. Please refer to the Cluster_Ensembles documentation for more information on how to meet those few requirements depending on Linux distribution.
Usage
To subject a dataset to an ECLAIR analysis:
- start a terminal;
- enter
python -m ECLAIR.Build_instance [options] [file_name], wherefile_namedenotes the path to the data about to be processed. It is generally recommended to leave theoptionsandfile_namefields empty, which will trigger an interface asking the user to provide the path to the dataset to be processed and some guidance on the choice of parameters for the ECLAIR analysis at hand. Each row of the dataset accessed via the pathfile_namemust correspond to a sample, whose features must be on display in a tab-separated format. A folder will be created in your current working directory, containing information on your ECLAIR tree and the underlying weighted graph (such as its adjacency matrix and confidence coefficients for each edge) along with a PDF figure illustrating a force-directed representation of the inferred lineage tree.
To launch a full-fledged statistical performance analysis of ECLAIR and see how it consistenly performs better than SPADE, a popular method for estimating cell lineages, proceed as follows:
- at the Shell command-line interface or graphical user interface, type in
python -m ECLAIR.Statistical_performance.
The eponymous folder ECLAIR_performance will be created in your current directory, recording on the fly the results of various statistical tests and comparisons of ECLAIR graphs and trees, as well as of SPADE trees.
In the current version, the statistical performance of ECLAIR is only evaluated for a fairly large (by the current standards of computational biology) flow cytometry dataset of half-a-million samples and 8 features, as well as on a qPCR dataset of mouse bone marrow samples. It shouldn't be difficult for anyone competent in Python to quickly peruse through the source code of ECLAIR and bring about a few of the changes required to submit his/her own data to a similar statistical analysis (those changes mostly pertain to domain-specific knowledge and to the format of your dataset). ECLAIR has been designed so as to accommodate arbitrarily large datasets (th
Related Skills
node-connect
349.2kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
109.5kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
349.2kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
349.2kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
