sc3D
sc3D is a Python library to handle 3D spatial transcriptomic datasets.
To access the 3D viewer for sc3D datasets, you can go to the following link: GuignardLab/napari-sc3D-viewer
You can find it on the Guignard Lab GitHub page: GuignardLab/sc3D. In there you will be able to find jupyter notebooks giving examples about how to use the datasets.
This code was developed in the context of the following study:
Spatial transcriptomic maps of whole mouse embryos. Abhishek Sampath Kumar, Luyi Tian, Adriano Bolondi et al.
The sc3D code is based on the anndata and Scanpy libraries and allows to read, register arrays and compute 3D differential expression.
The dataset necessary to run the tests and look at the results can be downloaded there for the unregistered dataset (and test the provided algorithms) and there for the already registered atlas to browse with our visualiser. You can find the visualiser there.
Description of the GitHub repository
-
data: a folder containing examples for the tissue color and tissue name files
-
src: a folder containing the source code
-
txt: a folder containing the text describing the method (LaTeX, pdf and docx formats are available)
-
README.md: this file
-
notebooks/Test-embryo.ipynb: Basic read and write examples (many different ways of writing)
-
notebooks/Spatial-differential-expression.ipynb: a jupyter notebook with some examples on how to perform the spatial differential expression
-
notebooks/Embryo-registration.ipynb: a jupyter notebook with an example on how to do the array registration
-
setup.py: Setup file to install the library
Installation
We strongly advise to use virtual environments to install this package. For example using conda or miniconda:
conda create -n sc-3D
conda activate sc-3D
If necessary, install pip:
conda install pip
Then, to install the latest stable version:
pip install sc-3D
or to install the latest version from the GitHub repository:
git clone https://github.com/GuignardLab/sc3D.git
cd sc3D
pip install .
Troubleshooting for latest M1 MacOs chips
If working with an M1 chip, it is possible that all the necessary libraries are not yet available from the usual channels.
To overcome this issue we recommand to manually install the latest, GitHub version of sc3D using miniforge instead of anaconda or miniconda.
Once miniforge is installed and working, you can run the following commands:
conda create -n sc-3D
conda activate sc-3D
to create your environment, then:
git clone https://github.com/GuignardLab/sc3D.git
cd sc3D
conda install pip scipy numpy matplotlib pandas seaborn anndata napari
pip install .
If the previous commands are still not working, it is possible that you need to install the pkg-config package. You can find some information on how to do it there: install pkg-config
Basic usage
Once installed, the library can be called the following way:
from sc3D import Embryo
To import some data:
Note: at the time being, the following conventions are expected:
- the x-y coordinates are stored in
data.obsm['X_spatial'] - the array number should be stored in
data.obs['orig.ident']in the format".*_[0-9]*"where the digits after the underscore (_) are the id of the array - the tissue type has to be stored in
data.obs['predicted.id'] - the gene names have to be stored as indices or in
data.var['feature_name']
Since version 0.1.2, one can specify the name of the columns where the different necessary informations are stored using the following parameters:
tissue_idto inform the tissue id columnarray_idto inform the array/puck/slice id columnpos_idto inform the position column (anx, yposition is expected within this given column)gene_name_idto inform the gene name columnpos_reg_idwhen to inform the registered position column (anx, y, zposition is expected within this given column)
# To read the data
embryo = Embryo('path/to/data.h5ad')
# To remove potential spatial outliers
embryo.removing_spatial_outliers(th=outlier_threshold)
# To register the arrays and compute the
# spline interpolations
embryo.reconstruct_intermediate(embryo, th_d=th_d,
genes=genes_of_interest)
# To save the dataset as a registered dataset (to then look at it in the 3D visualizer)
embryo.save_anndata('path/to/out/registered.h5ad')
# To compute the 3D differential expression for selected tissues
tissues_to_process = [5, 10, 12, 18, 21, 24, 30, 31, 33, 34, 39]
th_vol = .025
_ = embryo.get_3D_differential_expression(tissues_to_process, th_vol)
The dataset used for the project this code is from can be downloaded there (under the name mouse_embryo_E8.5_merged_data)
Many other functions are available that can be found used in the two provided jupyter notebooks.
Running the notebooks
Two example notebooks are provided. To run them one wants to first install the jupyter notebook:
conda install jupyter
or
pip install jupyter
The notebooks can the be started from a terminal in the folder containing the .ipynb files with the following command:
jupyter notebook
The notebooks should be self content.
Note that the test dataset is not included in this repository put can be downloaded from there.
Metadata
Release files for sc-3D 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sc_3d-3.0.0.tar.gz | 35.2 kB | Without provenance | Details for sc_3d-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sc_3d-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for sc_3d-3.0.0-py3-none-any.whl |
Total release size: 68.0 kB
Release files / sc_3d-3.0.0.tar.gz
| Download URL | sc_3d-3.0.0.tar.gz |
|---|---|
| Size | 35.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
153c26570856abeccbf32d6bea5f98e1c97e12063eaf8a37ec878fa7b8defb65
|
|
BLAKE2b-256 checksum How to use checksums |
281eb9fe638e2638ebe0d21440290bec0914a9cbb0a443536c30203ca3e67f7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Release files / sc_3d-3.0.0-py3-none-any.whl
| Download URL | sc_3d-3.0.0-py3-none-any.whl |
|---|---|
| Size | 32.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3d9ea4856dfd4f2ea4c7cbd40fec13551c260d1ae7f1e639ad9a00fff8acd7a0
|
|
BLAKE2b-256 checksum How to use checksums |
0b65bbed46c496c598faa1d23887619deef10654ce0d8ce248ae9e143182528d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.5
|
Security for sc-3D 3.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.