Package: sc-3D
sc3Dsc3Dis 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-viewerYou 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.Thesc3Dcode is based on theanndataandScanpylibraries 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 downloadedtherefor the unregistered dataset (and test the provided algorithms) andtherefor the already registered atlas to browse with our visualiser. You can find the visualiserthere.Description of the GitHub repositorydata: a folder containing examples for the tissue color and tissue name filessrc: a folder containing the source codetxt: a folder containing the text describing the method (LaTeX, pdf and docx formats are available)README.md: this filenotebooks/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 expressionnotebooks/Embryo-registration.ipynb: a jupyter notebook with an example on how to do the array registrationsetup.py: Setup file to install the libraryInstallationWe strongly advise to use virtual environments to install this package. For example using conda or miniconda:condacreate-nsc-3D
condaactivatesc-3DIf necessary, installpip:condainstallpipThen, to install the latest stable version:pipinstallsc-3Dor to install the latest version from the GitHub repository:gitclonehttps://github.com/GuignardLab/sc3D.gitcdsc3D
pipinstall.Troubleshooting for latest M1 MacOs chipsIf 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 ofsc3Dusingminiforgeinstead of anaconda or miniconda.Once miniforge is installed and working, you can run the following commands:condacreate-nsc-3D
condaactivatesc-3Dto create your environment, then:gitclonehttps://github.com/GuignardLab/sc3D.gitcdsc3D
condainstallpipscipynumpymatplotlibpandasseabornanndatanapari
pipinstall.If the previous commands are still not working, it is possible that you need to install thepkg-configpackage. You can find some information on how to do it there:install pkg-configBasic usageOnce installed, the library can be called the following way:fromsc3DimportEmbryoTo import some data:Note: at the time being, the following conventions are expected:the x-y coordinates are stored indata.obsm['X_spatial']the array number should be stored indata.obs['orig.ident']in the format".*_[0-9]*"where the digits after the underscore (_) are the id of the arraythe tissue type has to be stored indata.obs['predicted.id']the gene names have to be stored as indices or indata.var['feature_name']Since version0.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 dataembryo=Embryo('path/to/data.h5ad')# To remove potential spatial outliersembryo.removing_spatial_outliers(th=outlier_threshold)# To register the arrays and compute the# spline interpolationsembryo.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 tissuestissues_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 downloadedthere(under the namemouse_embryo_E8.5_merged_data)Many other functions are available that can be found used in the two provided jupyter notebooks.Running the notebooksTwo example notebooks are provided.
To run them one wants to first install the jupyter notebook:condainstalljupyterorpipinstalljupyterThe notebooks can the be started from a terminal in the folder containing the.ipynbfiles with the following command:jupyternotebookThe notebooks should be self content.Note that the test dataset is not included in this repository put can be downloaded fromthere.