Single cell type annotation guided by cell atlases, with freedom to be queer.
Project description
northstar
Single cell type annotation guided by cell atlases, with freedom to be queer.
Brief description
northstar
is a Python package to identify cell types within single cell transcriptomics datasets.
northstar's superpower is that it learns from cell atlases but still allows queer cells to make their own cluster if they want to.
Also, northstar was heavily developed during Pride Month.
Atlas resources
Curated averages and subsamples from several atlases: https://northstaratlas.github.io/atlas_landmarks/
If you want us to add you cell atlas, open an issue on: https://github.com/northstaratlas/atlas_landmarks/issues
Documentation
https://northstar.readthedocs.io
Installation
pip install northstar
To automatically download and use our online atlas collection at https://northstaratlas.github.io/atlas_averages/, you will need to call:
pip install 'northstar[atlas-fetcher]'
Dependencies
numpy
scipy
pandas
scikit-learn
anndata
python-igraph>=0.8.0
leidenalg>=0.8.0
It is recommended that you install python-igraph and leidenalg using pip
. However, any installation (e.g. conda) that includes recent enough versions of both packages should work.
Optional deps to use our online atlases:
requests
loompy
scanpy
pynndescent
(only useful if you usescanpy
as well)
If you have scanpy
installed, northstar
will use it to speed up a few operations (PCA, graph construction). You can turn this off in two ways:
- Uninstall
scanpy
is you don't need it for anything else, or - Set the environment variable
NORTHSTAR_SKIP_SCANPY
to anything except empty string, e.g. in a notebook:
import os
os.environ['NORTHSTAR_SKIP_SCANPY'] = 'yes'
import northstar as ns
(rest of the notebook/script)
Hot-swapping between the two modes (w or w/o scanpy
) is not currently supported.
Usage
See the paper below or the documentation for detailed instructions and examples. The simplest way to use northstar
is to classify a new single cell dataset using one of the available atlases, e.g. Darmanis_2015
on brain cells:
import northstar
# Choose an atlas
atlas_name = 'Darmanis_2015'
# Get a gene expression matrix of the new dataset (here a
# random matrix for simplicity)
N = 200
L = 50
new_dataset = pd.DataFrame(
data=np.random.rand(L, N).astype(np.float32),
index=<gene_list>,
columns=['cell_'+str(i+1) for i in range(N)],
)
# Initialize northstar classes
model = northstar.Averages(
atlas='Darmanis_2015',
n_neighbors=5,
n_pcs=10,
)
# Run the classifier
model.fit(new_dataset)
# Get the cluster memberships for the new cells
membership = model.membership
Citation
If you use this software please cite the following paper:
Fabio Zanini*, Bojk A. Berghuis*, Robert C. Jones, Benedetta Nicolis di Robilant, Rachel Yuan Nong, Jeffrey Norton, Michael F. Clarke, Stephen R. Quake. Northstar enables automatic classification of known and novel cell types from tumor samples. Scientific Reports 10, Article number: 15251 (2020), DOI: https://doi.org/10.1038/s41598-020-71805-1
License
northstar
is released under the MIT license.
NOTE: The module leidenalg to perform graph-based clstering is released under the GLP3 license. You agree with those licensing terms if you use leidenalg within northstar.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file northstar-0.6.0.tar.gz
.
File metadata
- Download URL: northstar-0.6.0.tar.gz
- Upload date:
- Size: 28.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e200bdd48fd3c0a99aa09a2af9fba5476f8212f2eeb2ed4666a5d03e91b89f2 |
|
MD5 | eb9ea0799fa86940a861b31816fb7d9a |
|
BLAKE2b-256 | fb385d69a09d447561f1d81323fe04e9c34a239fd7c793edd379aaf34dfb1643 |