Documentation: https://nsforest.readthedocs.io/en/latest/
Citation: Liu A, Peng B, Pankajam A, Duong TE, Pryhuber G, Scheuermann RH, Zhang Y. (2024) Discovery of optimal cell type classification marker genes from single cell RNA sequencing data. BMC Methods. https://doi.org/10.1186/s44330-024-00015-2
To contribute, please open an issue on this Github repository.
In terminal:
git clone https://github.com/NLM-DIR/NSForest.git
cd NSForest
conda env create -f environment.yml
conda activate nsforest
pip install .
Please find tutorials in the documentation.
- This package is written and tested in python 3.11+, scanpy 1.9.6+.
- Other required libraries: numpy, pandas, sklearn, plotly, time, tqdm.
NS-Forest is an algorithm designed to identify minimum combinations of necessary and sufficient marker genes for a cell type cluster identified in a single cell or single nucleus RNA sequencing experiment that optimizes classification accuracy. NS-Forest proceeds through the following steps (default setting):
-
Data input: An AnnData object (e.g., .h5ad file) with cell type cluster labels.
-
Binary score calculation: Each gene is assigned a binary score for every cluster. Binary score is a measurement of the binary expression pattern of a gene. A higher binary score means a gene is expressed in one cluster and not others. A lower binary score means a gene is expressed in many clusters and would not be an ideal candidate for a cell type-specific marker gene.
-
Binary scoring criterion: NS-Forest then filters for genes with high binary scores. Candidate genes are selected if their binary scores are 2 standard deviations above the mean of all genes expressed in the cluster.
-
Random forest: Pre-selected gene candidates based on binary scoring are used as input into a random forest classifier, which ranks the genes by Gini Impurity, while producing a classification model for each cluster.
-
Decision tree evaluation: The top 6 ranked random forest genes are used as input into decision trees where all combinations of input genes are evaluated and the combination with the highest F-beta score is selected.
-
Output: The NS-Forest algorithm outputs 1-6 marker genes per cluster along with the classification metrics (F-beta, precision, recall) and the On-Target Fraction expression metric.
The final module in the NS-Forest workflow can also be used to assess the performance of any collection of marker genes identified using any approach. The marker gene evaluation module includes the following steps (default setting):
-
Data input: 1) An AnnData object (e.g., .h5ad file) with cell type cluster labels. 2) A dictionary of marker genes for every cluster to be evaluated.
-
Decision tree evaluation: One-vs-all decision trees are created for each gene in the marker combination. If there are more than one gene in the marker combination, an AND logic is used when calculating the true positives from multiple decision trees for one cell type cluster.
-
Output: The marker gene evaluation module outputs the classification metrics (F-beta, precision, recall) and On-Target Fraction for evaluated markers of every cluster.
Earlier versions are managed in Releases.
Version 4.0:
Liu A, Peng B, Pankajam A, Duong TE, Pryhuber G, Scheuermann RH, Zhang Y. (2024) Discovery of optimal cell type classification marker genes from single cell RNA sequencing data. BMC Methods. https://doi.org/10.1186/s44330-024-00015-2
Version 2.0:
Aevermann BD, Zhang Y, Novotny M, Keshk M, Bakken TE, Miller JA, Hodge RD, Lelieveldt B, Lein ES, Scheuermann RH. (2021) A machine learning method for the discovery of minimum marker gene combinations for cell-type identification from single-cell RNA sequencing. Genome Res. https://pubmed.ncbi.nlm.nih.gov/34088715/
Version 1.3/1.0:
Aevermann BD, Novotny M, Bakken T, Miller JA, Diehl AD, Osumi-Sutherland D, Lasken RS, Lein ES, Scheuermann RH. (2018) Cell type discovery using single-cell transcriptomics: implications for ontological representation. Hum Mol Genet. https://pubmed.ncbi.nlm.nih.gov/29590361/
- Angela Liu (aliu@jcvi.org)
- Beverly Peng (bpeng@jcvi.org)
- Brian Aevermann (baevermann@chanzuckerberg.com)
- Richard Scheuermann (richard.scheuermann@nih.gov)
- Yun (Renee) Zhang (yun.zhang@nih.gov)
- Division of Intramural Research, National Library of Medicine
Our collaborators:
- Allen Institute of Brain Science
- Brain Initiative Cell Census Network
- Chan Zuckerberg Initiative
- California Institute for Regenerative Medicine
- J. Craig Venter Institute


