concordex can be installed via pip
pip install git+https://github.com/pachterlab/concordex.gitAfter installing, concordex can be run by simply typing concordex on the command line
usage: concordex [-h] <CMD> ...
concordex 0.0.1: Assess clustering
positional arguments:
<CMD>
map
stat
optional arguments:
-h, --help show this help message and exitThe concordex map command generates the cluster x cluster matrix where each entry is the fraction of cluster i's neighbors which are in cluster j (i, j are row, column indices into the matrix). The matrix can be generated by running
concordex map -a assignments.txt -o map.csv mtx_fileThis matrix can be used to visualize the concordex measure (in leiu of producing a non-linear 2-dimensional embedding).
The concordex stat command generates the concordex statistic as described in this manuscript. The stat can be generated by running
concordex stat -a assignments.txt -o map.csv mtx_fileand with python (in a jupyter notebook)
from concordex.concordex_stat import concordex_stat
import anndata
adata = anndata.read_h5ad("adata.h5ad")
mtx = adata.X # or adata.layers["my matrix"], should be scipy sparse matrix
assignments = adata.obs["assignments"].values
trace, random_trace, corrected_trace = concordex_stat(mtx, assignments)