API to facilitate the use of the CZ CELLxGENE Discover Census. For more information about the API and the project visit https://github.com/chanzuckerberg/cellxgene-census/
Project description
CZ CELLxGENE Discover Census
The cellxgene_census
package provides an API to facilitate the use of the CZ CELLxGENE Discover Census. For more information about the API and the project visit the chanzuckerberg/cellxgene-census GitHub repo.
For More Help
For more help, please file a issue on the repo, or contact us at soma@chanzuckerberg.com.
If you believe you have found a security issue, we would appreciate notification. Please send email to security@chanzuckerberg.com.
Development Environment Setup
- Create a virtual environment using
venv
orconda
cd
to the root of this repositorypip install -e api/python/cellxgene_census
- To install dependencies needed to work on the experimental portion of the API:
pip install -e 'api/python/cellxgene_census[experimental]'
. pip install jupyterlab
- Test it! Either open up a new
jupyter
notebook or thepython
interpreter and run this code:
import cellxgene_census
with cellxgene_census.open_soma() as census:
# Reads SOMADataFrame as a slice
cell_metadata = census["census_data"]["homo_sapiens"].obs.read(
value_filter = "sex == 'female' and cell_type in ['microglial cell', 'neuron']",
column_names = ["assay", "cell_type", "tissue", "tissue_general", "suspension_type", "disease"]
)
# Concatenates results to pyarrow.Table
cell_metadata = cell_metadata.concat()
# Converts to pandas.DataFrame
cell_metadata = cell_metadata.to_pandas()
print(cell_metadata)
The output is a pandas.DataFrame
with over 600K cells meeting our query criteria and the selected columns:
The "stable" release is currently 2023-12-15. Specify 'census_version="2023-12-15"' in future calls to open_soma() to ensure data consistency.
assay cell_type tissue tissue_general suspension_type disease sex
0 Smart-seq v4 microglial cell middle temporal gyrus brain nucleus normal female
1 Smart-seq v4 microglial cell middle temporal gyrus brain nucleus normal female
2 Smart-seq v4 microglial cell middle temporal gyrus brain nucleus normal female
3 Smart-seq v4 microglial cell middle temporal gyrus brain nucleus normal female
4 Smart-seq v4 microglial cell middle temporal gyrus brain nucleus normal female
... ... ... ... ... ... ... ...
607636 microwell-seq neuron adrenal gland adrenal gland cell normal female
607637 microwell-seq neuron adrenal gland adrenal gland cell normal female
607638 microwell-seq neuron adrenal gland adrenal gland cell normal female
607639 microwell-seq neuron adrenal gland adrenal gland cell normal female
607640 microwell-seq neuron adrenal gland adrenal gland cell normal female
[607641 rows x 7 columns]
- Learn more about the Census API by going through the tutorials in the notebooks
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file cellxgene_census-1.14.0.tar.gz
.
File metadata
- Download URL: cellxgene_census-1.14.0.tar.gz
- Upload date:
- Size: 77.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a751406cb8c51aee616aeffb777b9d8c20e81bc6891fab8334f52b2a0e4ea553 |
|
MD5 | 602fca973e3343e169983df2a318561f |
|
BLAKE2b-256 | 55e0fd5e4a0259a61aa6f68a2e31df0b40a1d225e094da76145cc44fd06c43f9 |
File details
Details for the file cellxgene_census-1.14.0-py3-none-any.whl
.
File metadata
- Download URL: cellxgene_census-1.14.0-py3-none-any.whl
- Upload date:
- Size: 47.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.11.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2046741aaf20b928a2172e1a52bd88f0d991fb8e9612e7225108c21b7e2a06e6 |
|
MD5 | f9686002a0e91942d358c6d55becde43 |
|
BLAKE2b-256 | 1f7ddac71ab49e95a028d4b9212c4cecaa9ca1b39a5661fb29e30f1336db6adb |