├── .readthedocs.yaml
├── LICENSE.md
├── Makefile
├── README.md
├── SOAPy_st
├── __init__.py
├── __pycache__
│ ├── __init__.cpython-39.pyc
│ └── utils.cpython-39.pyc
├── _compat.py
├── _docs.py
├── _metadata.py
├── _settings.py
├── pl
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── __init__.cpython-39.pyc
│ │ ├── _ccc.cpython-39.pyc
│ │ ├── _chord.cpython-39.pyc
│ │ ├── _color.cpython-39.pyc
│ │ ├── _heatmap.cpython-39.pyc
│ │ ├── _neighborhood.cpython-39.pyc
│ │ ├── _niche.cpython-39.pyc
│ │ ├── _show.cpython-39.pyc
│ │ ├── _tendency.cpython-39.pyc
│ │ ├── _tensor.cpython-39.pyc
│ │ └── utils.cpython-39.pyc
│ ├── _ccc.py
│ ├── _chord.py
│ ├── _color.py
│ ├── _heatmap.py
│ ├── _neighborhood.py
│ ├── _niche.py
│ ├── _show.py
│ ├── _tendency.py
│ ├── _tensor.py
│ └── utils.py
├── pp
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── __init__.cpython-39.pyc
│ │ ├── all2adata.cpython-39.pyc
│ │ ├── build_network.cpython-39.pyc
│ │ └── utils.cpython-39.pyc
│ ├── all2adata.py
│ ├── build_network.py
│ └── utils.py
├── tl
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── __init__.cpython-39.pyc
│ │ ├── _ccc.cpython-39.pyc
│ │ ├── _distance.cpython-39.pyc
│ │ ├── _domain.cpython-39.pyc
│ │ ├── _interaction.cpython-39.pyc
│ │ ├── _mask.cpython-39.pyc
│ │ ├── _tendency.cpython-39.pyc
│ │ ├── _tensor.cpython-39.pyc
│ │ ├── _var_genes.cpython-39.pyc
│ │ └── utils.cpython-39.pyc
│ ├── _ccc.py
│ ├── _domain.py
│ ├── _interaction.py
│ ├── _mask.py
│ ├── _tendency.py
│ ├── _tensor.py
│ ├── _var_genes.py
│ ├── datasets
│ │ └── cci
│ │ │ ├── human
│ │ │ └── Human-2020-Jin-LR-pairs.csv
│ │ │ └── mouse
│ │ │ └── Mouse-2020-Jin-LR-pairs.csv
│ ├── other_package_without_pip
│ │ ├── GraphST
│ │ │ ├── GraphST.py
│ │ │ ├── README.txt
│ │ │ ├── __init__.py
│ │ │ ├── __pycache__
│ │ │ │ ├── GraphST.cpython-39.pyc
│ │ │ │ ├── __init__.cpython-39.pyc
│ │ │ │ ├── model.cpython-39.pyc
│ │ │ │ ├── preprocess.cpython-39.pyc
│ │ │ │ └── utils.cpython-39.pyc
│ │ │ ├── model.py
│ │ │ ├── preprocess.py
│ │ │ └── utils.py
│ │ ├── STAGATE_pyG
│ │ │ ├── STAGATE.py
│ │ │ ├── Train_STAGATE.py
│ │ │ ├── __init__.py
│ │ │ ├── gat_conv.py
│ │ │ └── utils.py
│ │ ├── readme.txt
│ │ └── scanit
│ │ │ ├── __init__.py
│ │ │ ├── __pycache__
│ │ │ └── __init__.cpython-39.pyc
│ │ │ ├── _utils
│ │ │ ├── __init__.py
│ │ │ ├── __pycache__
│ │ │ │ ├── __init__.cpython-39.pyc
│ │ │ │ ├── _alpha.cpython-39.pyc
│ │ │ │ ├── _dgi.cpython-39.pyc
│ │ │ │ ├── _gae.cpython-39.pyc
│ │ │ │ ├── _knn.cpython-39.pyc
│ │ │ │ └── _scale_estimation.cpython-39.pyc
│ │ │ ├── _alpha.py
│ │ │ ├── _dgi.py
│ │ │ ├── _gae.py
│ │ │ ├── _knn.py
│ │ │ └── _scale_estimation.py
│ │ │ └── tools
│ │ │ ├── __init__.py
│ │ │ ├── __pycache__
│ │ │ ├── __init__.cpython-39.pyc
│ │ │ └── _scanit_representation.cpython-39.pyc
│ │ │ └── _scanit_representation.py
│ └── utils.py
└── utils.py
├── build
├── Api
│ ├── SOAPy_st.pl.show_box_plot.html
│ ├── SOAPy_st.pl.show_ccc_dotplot.html
│ ├── SOAPy_st.pl.show_ccc_embedding.html
│ ├── SOAPy_st.pl.show_ccc_netplot.html
│ ├── SOAPy_st.pl.show_celltype_niche_heatmap.html
│ ├── SOAPy_st.pl.show_celltype_sample_heatmap.html
│ ├── SOAPy_st.pl.show_curves_cluster.html
│ ├── SOAPy_st.pl.show_factor_matrix_in_CP_tensor.html
│ ├── SOAPy_st.pl.show_factor_matrix_in_tucker_tensor.html
│ ├── SOAPy_st.pl.show_infiltration_analysis.html
│ ├── SOAPy_st.pl.show_moran_scatterplot.html
│ ├── SOAPy_st.pl.show_neighborhood_analysis.html
│ ├── SOAPy_st.pl.show_network.html
│ ├── SOAPy_st.pl.show_niche_environment.html
│ ├── SOAPy_st.pl.show_niche_sample_heatmap.html
│ ├── SOAPy_st.pl.show_proportion_in_CP.html
│ ├── SOAPy_st.pl.show_proportion_in_tucker.html
│ ├── SOAPy_st.pl.show_tendency.html
│ ├── SOAPy_st.pl.show_voronoi.html
│ ├── SOAPy_st.pp.make_network.html
│ ├── SOAPy_st.pp.read_csv2adata.html
│ ├── SOAPy_st.pp.read_dsp2adata.html
│ ├── SOAPy_st.pp.read_mult_image2adata.html
│ ├── SOAPy_st.pp.read_visium2adata.html
│ ├── SOAPy_st.pp.st_Seurat2Anndata.html
│ ├── SOAPy_st.tl.ANOVA.html
│ ├── SOAPy_st.tl.TensorDecomposition.html
│ ├── SOAPy_st.tl.adata_from_mask.html
│ ├── SOAPy_st.tl.cal_aucell.html
│ ├── SOAPy_st.tl.cal_spark.html
│ ├── SOAPy_st.tl.cal_sparkX.html
│ ├── SOAPy_st.tl.cal_spatialDE.html
│ ├── SOAPy_st.tl.cell_level_communications.html
│ ├── SOAPy_st.tl.cell_type_level_communication.html
│ ├── SOAPy_st.tl.domain_from_STAGATE.html
│ ├── SOAPy_st.tl.domain_from_local_moran.html
│ ├── SOAPy_st.tl.gene_cluster.html
│ ├── SOAPy_st.tl.get_c_niche.html
│ ├── SOAPy_st.tl.get_mask_from_domain.html
│ ├── SOAPy_st.tl.global_moran.html
│ ├── SOAPy_st.tl.infiltration_analysis.html
│ ├── SOAPy_st.tl.lr_pairs.html
│ ├── SOAPy_st.tl.neighborhood_analysis.html
│ ├── SOAPy_st.tl.spatial_tendency.html
│ ├── SOAPy_st.tl.spearman_correlation.html
│ ├── SOAPy_st.tl.wilcoxon_test.html
│ ├── index.html
│ ├── plot.html
│ ├── preprocessing.html
│ └── tool.html
├── Installation.html
├── References.html
├── Release_notes.html
├── Tutorials
│ ├── Cell type proximity.html
│ ├── Cell type proximity.ipynb
│ ├── Niche composition.html
│ ├── Niche composition.ipynb
│ ├── Read_spatial_omics.html
│ ├── Read_spatial_omics.ipynb
│ ├── Spatial communication - cell level.html
│ ├── Spatial communication - cell level.ipynb
│ ├── Spatial communications.html
│ ├── Spatial communications.ipynb
│ ├── Spatial domain.html
│ ├── Spatial domain.ipynb
│ ├── Spatial tendency.html
│ ├── Spatial tendency.ipynb
│ ├── Spatiotemporal pattern.html
│ ├── Spatiotemporal pattern.ipynb
│ ├── Transfer Seurat object into Anndata object.html
│ ├── Transfer Seurat object into Anndata object.ipynb
│ ├── Visualization of Nanostring DSP subtissues.html
│ ├── Visualization of Nanostring DSP subtissues.ipynb
│ └── index.html
├── _images
│ ├── Overview.png
│ ├── T_cell_proximal.png
│ ├── T_communication.png
│ ├── T_domain.png
│ ├── T_niche.png
│ ├── T_read.png
│ ├── T_tendency.png
│ ├── T_tensor.png
│ ├── Tutorials_Cell_type_proximity_14_0.png
│ ├── Tutorials_Cell_type_proximity_16_0.png
│ ├── Tutorials_Cell_type_proximity_21_0.png
│ ├── Tutorials_Cell_type_proximity_23_0.png
│ ├── Tutorials_Cell_type_proximity_24_0.png
│ ├── Tutorials_Cell_type_proximity_9_0.png
│ ├── Tutorials_Niche_composition_13_0.png
│ ├── Tutorials_Niche_composition_15_0.png
│ ├── Tutorials_Niche_composition_17_0.png
│ ├── Tutorials_Niche_composition_19_0.png
│ ├── Tutorials_Niche_composition_26_0.png
│ ├── Tutorials_Niche_composition_28_0.png
│ ├── Tutorials_Niche_composition_29_0.png
│ ├── Tutorials_Read_spatial_omics_20_0.png
│ ├── Tutorials_Read_spatial_omics_21_0.png
│ ├── Tutorials_Spatial_communication_-_cell_level_9_0.png
│ ├── Tutorials_Spatial_communications_12_0.png
│ ├── Tutorials_Spatial_communications_13_0.png
│ ├── Tutorials_Spatial_communications_14_0.png
│ ├── Tutorials_Spatial_communications_15_0.png
│ ├── Tutorials_Spatial_communications_17_2.png
│ ├── Tutorials_Spatial_communications_18_1.png
│ ├── Tutorials_Spatial_communications_20_1.png
│ ├── Tutorials_Spatial_communications_21_0.png
│ ├── Tutorials_Spatial_communications_7_0.png
│ ├── Tutorials_Spatial_domain_15_0.png
│ ├── Tutorials_Spatial_domain_17_0.png
│ ├── Tutorials_Spatial_domain_8_0.png
│ ├── Tutorials_Spatial_tendency_20_0.png
│ ├── Tutorials_Spatial_tendency_22_0.png
│ ├── Tutorials_Spatial_tendency_25_0.png
│ ├── Tutorials_Spatial_tendency_5_0.png
│ ├── Tutorials_Spatial_tendency_8_2.png
│ ├── Tutorials_Spatiotemporal_pattern_15_1.png
│ ├── Tutorials_Spatiotemporal_pattern_16_1.png
│ ├── Tutorials_Transfer_Seurat_object_into_Anndata_object_10_0.png
│ ├── Tutorials_Transfer_Seurat_object_into_Anndata_object_15_0.png
│ ├── Tutorials_Transfer_Seurat_object_into_Anndata_object_5_0.png
│ └── Tutorials_Visualization_of_Nanostring_DSP_subtissues_16_1.png
├── _sources
│ ├── Api
│ │ ├── SOAPy_st.pl.show_box_plot.rst.txt
│ │ ├── SOAPy_st.pl.show_ccc_dotplot.rst.txt
│ │ ├── SOAPy_st.pl.show_ccc_embedding.rst.txt
│ │ ├── SOAPy_st.pl.show_ccc_netplot.rst.txt
│ │ ├── SOAPy_st.pl.show_celltype_niche_heatmap.rst.txt
│ │ ├── SOAPy_st.pl.show_celltype_sample_heatmap.rst.txt
│ │ ├── SOAPy_st.pl.show_curves_cluster.rst.txt
│ │ ├── SOAPy_st.pl.show_factor_matrix_in_CP_tensor.rst.txt
│ │ ├── SOAPy_st.pl.show_factor_matrix_in_tucker_tensor.rst.txt
│ │ ├── SOAPy_st.pl.show_infiltration_analysis.rst.txt
│ │ ├── SOAPy_st.pl.show_moran_scatterplot.rst.txt
│ │ ├── SOAPy_st.pl.show_neighborhood_analysis.rst.txt
│ │ ├── SOAPy_st.pl.show_network.rst.txt
│ │ ├── SOAPy_st.pl.show_niche_environment.rst.txt
│ │ ├── SOAPy_st.pl.show_niche_sample_heatmap.rst.txt
│ │ ├── SOAPy_st.pl.show_proportion_in_CP.rst.txt
│ │ ├── SOAPy_st.pl.show_proportion_in_tucker.rst.txt
│ │ ├── SOAPy_st.pl.show_tendency.rst.txt
│ │ ├── SOAPy_st.pl.show_voronoi.rst.txt
│ │ ├── SOAPy_st.pp.make_network.rst.txt
│ │ ├── SOAPy_st.pp.read_csv2adata.rst.txt
│ │ ├── SOAPy_st.pp.read_dsp2adata.rst.txt
│ │ ├── SOAPy_st.pp.read_mult_image2adata.rst.txt
│ │ ├── SOAPy_st.pp.read_visium2adata.rst.txt
│ │ ├── SOAPy_st.pp.st_Seurat2Anndata.rst.txt
│ │ ├── SOAPy_st.tl.ANOVA.rst.txt
│ │ ├── SOAPy_st.tl.TensorDecomposition.rst.txt
│ │ ├── SOAPy_st.tl.adata_from_mask.rst.txt
│ │ ├── SOAPy_st.tl.cal_aucell.rst.txt
│ │ ├── SOAPy_st.tl.cal_spark.rst.txt
│ │ ├── SOAPy_st.tl.cal_sparkX.rst.txt
│ │ ├── SOAPy_st.tl.cal_spatialDE.rst.txt
│ │ ├── SOAPy_st.tl.cell_level_communications.rst.txt
│ │ ├── SOAPy_st.tl.cell_type_level_communication.rst.txt
│ │ ├── SOAPy_st.tl.domain_from_STAGATE.rst.txt
│ │ ├── SOAPy_st.tl.domain_from_local_moran.rst.txt
│ │ ├── SOAPy_st.tl.gene_cluster.rst.txt
│ │ ├── SOAPy_st.tl.get_c_niche.rst.txt
│ │ ├── SOAPy_st.tl.get_mask_from_domain.rst.txt
│ │ ├── SOAPy_st.tl.global_moran.rst.txt
│ │ ├── SOAPy_st.tl.infiltration_analysis.rst.txt
│ │ ├── SOAPy_st.tl.lr_pairs.rst.txt
│ │ ├── SOAPy_st.tl.neighborhood_analysis.rst.txt
│ │ ├── SOAPy_st.tl.spatial_tendency.rst.txt
│ │ ├── SOAPy_st.tl.spearman_correlation.rst.txt
│ │ ├── SOAPy_st.tl.wilcoxon_test.rst.txt
│ │ ├── index.rst.txt
│ │ ├── plot.rst.txt
│ │ ├── preprocessing.rst.txt
│ │ └── tool.rst.txt
│ ├── Installation.rst.txt
│ ├── References.rst.txt
│ ├── Release_notes.rst.txt
│ ├── Tutorials
│ │ ├── Cell type proximity.ipynb.txt
│ │ ├── Niche composition.ipynb.txt
│ │ ├── Read_spatial_omics.ipynb.txt
│ │ ├── Spatial communication - cell level.ipynb.txt
│ │ ├── Spatial communications.ipynb.txt
│ │ ├── Spatial domain.ipynb.txt
│ │ ├── Spatial tendency.ipynb.txt
│ │ ├── Spatiotemporal pattern.ipynb.txt
│ │ ├── Transfer Seurat object into Anndata object.ipynb.txt
│ │ ├── Visualization of Nanostring DSP subtissues.ipynb.txt
│ │ └── index.rst.txt
│ └── index.rst.txt
├── _static
│ ├── Overview.png
│ ├── T_DSP.png
│ ├── T_cell_proximal.png
│ ├── T_communication.png
│ ├── T_domain.png
│ ├── T_niche.png
│ ├── T_read.png
│ ├── T_tendency.png
│ ├── T_tensor.png
│ ├── _sphinx_javascript_frameworks_compat.js
│ ├── basic.css
│ ├── css
│ │ ├── badge_only.css
│ │ ├── fonts
│ │ │ ├── Roboto-Slab-Bold.woff
│ │ │ ├── Roboto-Slab-Bold.woff2
│ │ │ ├── Roboto-Slab-Regular.woff
│ │ │ ├── Roboto-Slab-Regular.woff2
│ │ │ ├── fontawesome-webfont.eot
│ │ │ ├── fontawesome-webfont.svg
│ │ │ ├── fontawesome-webfont.ttf
│ │ │ ├── fontawesome-webfont.woff
│ │ │ ├── fontawesome-webfont.woff2
│ │ │ ├── lato-bold-italic.woff
│ │ │ ├── lato-bold-italic.woff2
│ │ │ ├── lato-bold.woff
│ │ │ ├── lato-bold.woff2
│ │ │ ├── lato-normal-italic.woff
│ │ │ ├── lato-normal-italic.woff2
│ │ │ ├── lato-normal.woff
│ │ │ └── lato-normal.woff2
│ │ └── theme.css
│ ├── doctools.js
│ ├── documentation_options.js
│ ├── file.png
│ ├── jquery.js
│ ├── js
│ │ ├── badge_only.js
│ │ ├── html5shiv-printshiv.min.js
│ │ ├── html5shiv.min.js
│ │ └── theme.js
│ ├── language_data.js
│ ├── logo_soapy.png
│ ├── minus.png
│ ├── nbsphinx-broken-thumbnail.svg
│ ├── nbsphinx-code-cells.css
│ ├── nbsphinx-gallery.css
│ ├── nbsphinx-no-thumbnail.svg
│ ├── plus.png
│ ├── pygments.css
│ ├── searchtools.js
│ └── sphinx_highlight.js
├── genindex.html
├── index.html
├── lib
│ └── SOAPy_st
│ │ ├── __init__.py
│ │ ├── _compat.py
│ │ ├── _docs.py
│ │ ├── _metadata.py
│ │ ├── _settings.py
│ │ ├── pl
│ │ ├── __init__.py
│ │ ├── _ccc.py
│ │ ├── _chord.py
│ │ ├── _color.py
│ │ ├── _heatmap.py
│ │ ├── _neighborhood.py
│ │ ├── _niche.py
│ │ ├── _show.py
│ │ ├── _tendency.py
│ │ ├── _tensor.py
│ │ └── utils.py
│ │ ├── pp
│ │ ├── __init__.py
│ │ ├── all2adata.py
│ │ ├── build_network.py
│ │ └── utils.py
│ │ ├── tl
│ │ ├── __init__.py
│ │ ├── _ccc.py
│ │ ├── _distance.py
│ │ ├── _domain.py
│ │ ├── _interaction.py
│ │ ├── _mask.py
│ │ ├── _stagate.py
│ │ ├── _tendency.py
│ │ ├── _tensor.py
│ │ ├── _var_genes.py
│ │ └── utils.py
│ │ └── utils.py
├── objects.inv
├── py-modindex.html
├── search.html
└── searchindex.js
├── logo_soapy.png
├── make.bat
├── pipeline.png
├── requirements.txt
├── setup.cfg
├── setup.py
└── source
├── Api
├── SOAPy_st.pl.show_box_plot.rst
├── SOAPy_st.pl.show_ccc_chordplot.rst
├── SOAPy_st.pl.show_ccc_dotplot.rst
├── SOAPy_st.pl.show_ccc_embedding.rst
├── SOAPy_st.pl.show_ccc_netplot.rst
├── SOAPy_st.pl.show_celltype_niche_heatmap.rst
├── SOAPy_st.pl.show_celltype_sample_heatmap.rst
├── SOAPy_st.pl.show_curves_cluster.rst
├── SOAPy_st.pl.show_factor_matrix_in_CP_tensor.rst
├── SOAPy_st.pl.show_factor_matrix_in_tucker_tensor.rst
├── SOAPy_st.pl.show_infiltration_analysis.rst
├── SOAPy_st.pl.show_moran_scatterplot.rst
├── SOAPy_st.pl.show_neighborhood_analysis.rst
├── SOAPy_st.pl.show_network.rst
├── SOAPy_st.pl.show_niche_environment.rst
├── SOAPy_st.pl.show_niche_sample_heatmap.rst
├── SOAPy_st.pl.show_proportion_in_CP.rst
├── SOAPy_st.pl.show_proportion_in_tucker.rst
├── SOAPy_st.pl.show_tendency.rst
├── SOAPy_st.pl.show_voronoi.rst
├── SOAPy_st.pp.make_network.rst
├── SOAPy_st.pp.read_csv2adata.rst
├── SOAPy_st.pp.read_dsp2adata.rst
├── SOAPy_st.pp.read_mult_image2adata.rst
├── SOAPy_st.pp.read_visium2adata.rst
├── SOAPy_st.pp.st_Seurat2Anndata.rst
├── SOAPy_st.tl.ANOVA.rst
├── SOAPy_st.tl.TensorDecomposition.rst
├── SOAPy_st.tl.adata_from_mask.rst
├── SOAPy_st.tl.cal_aucell.rst
├── SOAPy_st.tl.cal_spark.rst
├── SOAPy_st.tl.cal_sparkX.rst
├── SOAPy_st.tl.cal_spatialDE.rst
├── SOAPy_st.tl.cell_level_communications.rst
├── SOAPy_st.tl.cell_type_level_communication.rst
├── SOAPy_st.tl.domain_from_local_moran.rst
├── SOAPy_st.tl.domain_from_unsupervised.rst
├── SOAPy_st.tl.gene_cluster.rst
├── SOAPy_st.tl.get_c_niche.rst
├── SOAPy_st.tl.get_mask_from_domain.rst
├── SOAPy_st.tl.global_moran.rst
├── SOAPy_st.tl.infiltration_analysis.rst
├── SOAPy_st.tl.lr_pairs.rst
├── SOAPy_st.tl.neighborhood_analysis.rst
├── SOAPy_st.tl.spatial_tendency.rst
├── SOAPy_st.tl.spearman_correlation.rst
├── SOAPy_st.tl.wilcoxon_test.rst
├── index.rst
├── plot.rst
├── preprocessing.rst
└── tool.rst
├── Installation.rst
├── References.rst
├── Release_notes.rst
├── SOAPy_st
├── __init__.py
├── __pycache__
│ ├── __init__.cpython-39.pyc
│ └── utils.cpython-39.pyc
├── _compat.py
├── _docs.py
├── _metadata.py
├── _settings.py
├── datasets
│ └── cci
│ │ ├── human
│ │ └── Human-2020-Jin-LR-pairs.csv
│ │ └── mouse
│ │ └── Mouse-2020-Jin-LR-pairs.csv
├── pl
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── __init__.cpython-39.pyc
│ │ ├── _ccc.cpython-39.pyc
│ │ ├── _chord.cpython-39.pyc
│ │ ├── _color.cpython-39.pyc
│ │ ├── _heatmap.cpython-39.pyc
│ │ ├── _neighborhood.cpython-39.pyc
│ │ ├── _niche.cpython-39.pyc
│ │ ├── _show.cpython-39.pyc
│ │ ├── _tendency.cpython-39.pyc
│ │ ├── _tensor.cpython-39.pyc
│ │ └── utils.cpython-39.pyc
│ ├── _ccc.py
│ ├── _chord.py
│ ├── _color.py
│ ├── _heatmap.py
│ ├── _neighborhood.py
│ ├── _niche.py
│ ├── _show.py
│ ├── _tendency.py
│ ├── _tensor.py
│ └── utils.py
├── pp
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── __init__.cpython-39.pyc
│ │ ├── all2adata.cpython-39.pyc
│ │ ├── build_network.cpython-39.pyc
│ │ └── utils.cpython-39.pyc
│ ├── all2adata.py
│ ├── build_network.py
│ └── utils.py
├── tl
│ ├── __init__.py
│ ├── __pycache__
│ │ ├── __init__.cpython-39.pyc
│ │ ├── _ccc.cpython-39.pyc
│ │ ├── _distance.cpython-39.pyc
│ │ ├── _domain.cpython-39.pyc
│ │ ├── _interaction.cpython-39.pyc
│ │ ├── _mask.cpython-39.pyc
│ │ ├── _stagate.cpython-39.pyc
│ │ ├── _tendency.cpython-39.pyc
│ │ ├── _tensor.cpython-39.pyc
│ │ ├── _var_genes.cpython-39.pyc
│ │ └── utils.cpython-39.pyc
│ ├── _ccc.py
│ ├── _distance.py
│ ├── _domain.py
│ ├── _interaction.py
│ ├── _mask.py
│ ├── _tendency.py
│ ├── _tensor.py
│ ├── _var_genes.py
│ ├── datasets
│ │ └── cci
│ │ │ ├── human
│ │ │ └── Human-2020-Jin-LR-pairs.csv
│ │ │ └── mouse
│ │ │ └── Mouse-2020-Jin-LR-pairs.csv
│ ├── other_package_without_pip
│ │ ├── GraphST
│ │ │ ├── GraphST.py
│ │ │ ├── README.txt
│ │ │ ├── __init__.py
│ │ │ ├── __pycache__
│ │ │ │ ├── GraphST.cpython-39.pyc
│ │ │ │ ├── __init__.cpython-39.pyc
│ │ │ │ ├── model.cpython-39.pyc
│ │ │ │ ├── preprocess.cpython-39.pyc
│ │ │ │ └── utils.cpython-39.pyc
│ │ │ ├── model.py
│ │ │ ├── preprocess.py
│ │ │ └── utils.py
│ │ ├── STAGATE_pyG
│ │ │ ├── STAGATE.py
│ │ │ ├── Train_STAGATE.py
│ │ │ ├── __init__.py
│ │ │ ├── gat_conv.py
│ │ │ └── utils.py
│ │ ├── readme.txt
│ │ └── scanit
│ │ │ ├── __init__.py
│ │ │ ├── __pycache__
│ │ │ └── __init__.cpython-39.pyc
│ │ │ ├── _utils
│ │ │ ├── __init__.py
│ │ │ ├── __pycache__
│ │ │ │ ├── __init__.cpython-39.pyc
│ │ │ │ ├── _alpha.cpython-39.pyc
│ │ │ │ ├── _dgi.cpython-39.pyc
│ │ │ │ ├── _gae.cpython-39.pyc
│ │ │ │ ├── _knn.cpython-39.pyc
│ │ │ │ └── _scale_estimation.cpython-39.pyc
│ │ │ ├── _alpha.py
│ │ │ ├── _dgi.py
│ │ │ ├── _gae.py
│ │ │ ├── _knn.py
│ │ │ └── _scale_estimation.py
│ │ │ └── tools
│ │ │ ├── __init__.py
│ │ │ ├── __pycache__
│ │ │ ├── __init__.cpython-39.pyc
│ │ │ └── _scanit_representation.cpython-39.pyc
│ │ │ └── _scanit_representation.py
│ └── utils.py
└── utils.py
├── Tutorials
├── Cell type proximity.ipynb
├── Niche composition.ipynb
├── Read_spatial_omics.ipynb
├── Spatial communication - cell level.ipynb
├── Spatial communications.ipynb
├── Spatial domain.ipynb
├── Spatial tendency.ipynb
├── Spatiotemporal pattern.ipynb
├── Transfer Seurat object into Anndata object.ipynb
├── Visualization of Nanostring DSP subtissues.ipynb
└── index.rst
├── _static
├── Overview.png
├── T_DSP.png
├── T_cell_proximal.png
├── T_communication.png
├── T_domain.png
├── T_niche.png
├── T_read.png
├── T_tendency.png
├── T_tensor.png
└── logo_soapy.png
├── conf.py
├── index.rst
└── requirements.txt
/.readthedocs.yaml:
--------------------------------------------------------------------------------
1 | # Required
2 | version: 2
3 |
4 | # 设置构建环境
5 | build:
6 | os: ubuntu-22.04
7 | tools:
8 | python: "3.9"
9 |
10 | # 设置 Sphinx 配置
11 | sphinx:
12 | builder: html
13 | configuration: source/conf.py
14 | fail_on_warning: false
15 |
16 | # 安装 Python 和其他依赖
17 | python:
18 | install:
19 | - method: pip
20 | path: .
21 | - requirements: source/requirements.txt
22 |
23 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line, and also
5 | # from the environment for the first two.
6 | SPHINXOPTS ?=
7 | SPHINXBUILD ?= sphinx-build
8 | SOURCEDIR = source
9 | BUILDDIR = build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
21 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
7 |
8 |
9 |
10 |
11 |
12 | # SOAPy: A package for **S**patial-**O**mics **A**nalysis in **Py**thon
13 |
14 |

15 |
16 | ## Brief Introduction
17 | **SOAPy** is an integrated toolkit that focuses on addressing spatial heterogeneity. SOAPy contains four data
18 | preprocessing modules (“Data Import”, “spatial network”, and “Spatial Domain”), three modules for analyzing spatial
19 | expression patterns of genes (“Spatial Variation”, “Spatial Tendency”, and “Spatiotemporal Pattern”), two modules
20 | for analyzing the spatial architecture of cells (“Spatial Proximity”, “Spatial Composition”), and two module for
21 | analyzing Spatial Communication.
22 |
23 | ## Tutorial
24 |
25 | https://soapy-st.readthedocs.io/en/latest/
26 |
27 | ## Pipeline
28 |
29 | 
30 |
31 | ## Installation
32 | pip:
33 | ```
34 | pip install SOAPy-st
35 | ```
36 | github:
37 | ```
38 | cd SOAPy-st
39 | python setup.py build
40 | python setup.py install
41 | ```
42 |
--------------------------------------------------------------------------------
/SOAPy_st/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding:utf-8 -*-
3 | from . import pp
4 | from . import tl
5 | from . import pl
6 |
7 | __version__ = "v1.0.1"
8 |
9 | """
10 | # Author: Lihong lab
11 | # File Name:SOAPy
12 | # github:https://github.com/LiHongCSBLab/SOAPy
13 | # Description:
14 | """
15 |
16 | __author__ = "Cancer system biology lab"
17 | __email__ = [
18 | "wangheqi2021@sinh.ac.cn"
19 | "lijiarong2020@sinh.ac.cn"
20 | "lihong01@sibs.ac.cn"
21 | ]
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/SOAPy_st/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/__pycache__/utils.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/__pycache__/utils.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/_compat.py:
--------------------------------------------------------------------------------
1 | try:
2 | from typing import Literal
3 | except ImportError:
4 | try:
5 | from typing_extensions import Literal
6 | except ImportError:
7 |
8 | class LiteralMeta(type):
9 | def __getitem__(cls, values):
10 | if not isinstance(values, tuple):
11 | values = (values,)
12 | return type("Literal_", (Literal,), dict(__args__=values))
13 |
14 | class Literal(metaclass=LiteralMeta):
15 | pass
--------------------------------------------------------------------------------
/SOAPy_st/_docs.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/_docs.py
--------------------------------------------------------------------------------
/SOAPy_st/_metadata.py:
--------------------------------------------------------------------------------
1 | import traceback
2 | from pathlib import Path
3 |
4 | here = Path(__file__).parent
5 |
6 |
7 | def refresh_entry_points():
8 | """\
9 | Under some circumstances, (e.g. when installing a PEP 517 package via pip),
10 | pkg_resources.working_set.entries is stale. This tries to fix that.
11 | See https://github.com/pypa/setuptools_scm/issues/513
12 | """
13 | try:
14 | import sys
15 | import pkg_resources
16 |
17 | ws: pkg_resources.WorkingSet = pkg_resources.working_set
18 | for entry in sys.path:
19 | ws.add_entry(entry)
20 | except Exception:
21 | pass
22 |
23 |
24 | try:
25 | from setuptools_scm import get_version
26 |
27 | refresh_entry_points()
28 | __version__ = get_version(root='..', relative_to=__file__)
29 | except (ImportError, LookupError, FileNotFoundError):
30 | from ._compat import pkg_metadata
31 |
32 | metadata = pkg_metadata(here.name)
33 | __version__ = metadata['Version']
34 |
35 |
36 | def within_flit():
37 | """\
38 | Checks if we are being imported by flit.
39 | This is necessary so flit can import __version__ without all depedencies installed.
40 | There are a few options to make this hack unnecessary, see:
41 | https://github.com/takluyver/flit/issues/253#issuecomment-737870438
42 | """
43 | for frame in traceback.extract_stack():
44 | if frame.name == 'get_docstring_and_version_via_import':
45 | return True
46 | return False
--------------------------------------------------------------------------------
/SOAPy_st/pl/__init__.py:
--------------------------------------------------------------------------------
1 | from ._show import show_moran_scatterplot, show_network, show_voronoi
2 | from ._tendency import show_tendency, show_curves_cluster, show_box_plot
3 | from ._neighborhood import show_neighborhood_analysis, show_infiltration_analysis
4 | from ._ccc import show_ccc_netplot, show_ccc_chordplot, show_ccc_dotplot, show_ccc_embedding
5 | from ._niche import show_niche_environment, show_niche_sample_heatmap, show_celltype_niche_heatmap, \
6 | show_celltype_sample_heatmap
7 | from ._tensor import show_factor_matrix_in_CP_tensor, show_factor_matrix_in_tucker_tensor, show_proportion_in_tucker, \
8 | show_proportion_in_CP
9 |
--------------------------------------------------------------------------------
/SOAPy_st/pl/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pl/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pl/__pycache__/_ccc.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pl/__pycache__/_ccc.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pl/__pycache__/_chord.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pl/__pycache__/_chord.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pl/__pycache__/_color.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pl/__pycache__/_color.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pl/__pycache__/_heatmap.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pl/__pycache__/_heatmap.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pl/__pycache__/_neighborhood.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pl/__pycache__/_neighborhood.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pl/__pycache__/_niche.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pl/__pycache__/_niche.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pl/__pycache__/_show.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pl/__pycache__/_show.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pl/__pycache__/_tendency.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pl/__pycache__/_tendency.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pl/__pycache__/_tensor.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pl/__pycache__/_tensor.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pl/__pycache__/utils.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pl/__pycache__/utils.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pl/_color.py:
--------------------------------------------------------------------------------
1 | # define color list in SOAPy
2 | from typing import Sequence, Union
3 | from matplotlib.colors import ListedColormap
4 |
5 | # default palette
6 | # 10 color
7 | color_list_10 = [
8 | "#765005", "#0780cf", "#fa6d1d", "#0e2c82", "#b6b51f",
9 | "#da1f18", "#701866", "#f47a75", "#009db2", "#024b51"
10 | ]
11 |
12 | # 50 color
13 | color_list_50 = [
14 | '#5050FFFF', '#CE3D32FF', '#749B58FF', '#F0E685FF', '#466983FF', '#BA6338FF', '#5DB1DDFF',
15 | '#802268FF', '#6BD76BFF', '#D595A7FF', '#924822FF', '#837B8DFF', '#C75127FF', '#D58F5CFF',
16 | '#7A65A5FF', '#E4AF69FF', '#3B1B53FF', '#CDDEB7FF', '#612A79FF', '#AE1F63FF', '#E7C76FFF',
17 | '#5A655EFF', '#CC9900FF', '#99CC00FF', '#A9A9A9FF', '#CC9900FF', '#99CC00FF', '#00D68FFF',
18 | '#14FFB1FF', '#00CC99FF', '#0099CCFF', '#0A47FFFF', '#4775FFFF', '#FFC20AFF', '#FFD147FF',
19 | '#990033FF', '#991A00FF', '#996600FF', '#809900FF', '#339900FF', '#00991AFF', '#009966FF',
20 | '#008099FF', '#003399FF', '#1A0099FF', '#660099FF', '#990080FF', '#D60047FF', '#FF1463FF',
21 | '#00D68FFF'
22 | ]
23 |
24 | # default colorbar
25 | cmap_default = 'parula'
26 |
27 |
28 | def _get_palette(categorical, sort_order: bool = True, palette: Union[Sequence, ListedColormap] = None) -> dict:
29 | are_all_str = all(map(lambda x: isinstance(x, str), categorical))
30 | if not are_all_str:
31 | categorical = str(categorical)
32 |
33 | if sort_order:
34 | categorical = sorted(categorical)
35 |
36 | if palette is None:
37 | if len(categorical) <= 10:
38 | palette = color_list_10
39 | else:
40 | palette = color_list_50
41 |
42 | if isinstance(palette, ListedColormap):
43 | palette = palette.colors
44 |
45 | palette = palette[0: len(categorical)]
46 | palette = dict(zip(categorical, palette))
47 | return palette
--------------------------------------------------------------------------------
/SOAPy_st/pp/__init__.py:
--------------------------------------------------------------------------------
1 | from .all2adata import read_csv2adata, read_mult_image2adata, read_visium2adata, read_dsp2adata, st_Seurat2Anndata
2 | from .build_network import make_network
3 |
--------------------------------------------------------------------------------
/SOAPy_st/pp/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pp/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pp/__pycache__/all2adata.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pp/__pycache__/all2adata.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pp/__pycache__/build_network.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pp/__pycache__/build_network.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pp/__pycache__/utils.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/pp/__pycache__/utils.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/pp/utils.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import numba as nb
3 | import pandas as pd
4 | from anndata import AnnData
5 | from typing import Union, Optional, Tuple
6 |
7 |
8 | @nb.jit
9 | def _filter_of_graph(obs: pd.DataFrame,
10 | indices: np.ndarray,
11 | distances: np.ndarray,
12 | cluster_label: str,
13 | exclude: Union[str, dict]) -> Tuple[np.ndarray, np.ndarray]:
14 | """
15 | Select the edges as 'exclude'
16 |
17 | Returns
18 | -------
19 | anndata.Anndata object.
20 |
21 | """
22 | if type(exclude) == str:
23 | assert exclude in ['same', 'different']
24 | if type(exclude) == dict:
25 | exclude = [(i, j) for i, j in zip(exclude.keys(), exclude.values())] + \
26 | [(j, i) for i, j in zip(exclude.keys(), exclude.values())]
27 |
28 | for i, neigh in enumerate(indices):
29 | point_1 = neigh[0]
30 | index_point1 = obs.index[point_1]
31 | for j, point_2 in enumerate(neigh):
32 | if j == 0:
33 | continue
34 | index_point2 = obs.index[point_2]
35 | if exclude == 'same' and \
36 | obs.loc[index_point1, cluster_label] == obs.loc[index_point2, cluster_label]:
37 | distances[i][j] = -1
38 | indices[i][j] = -1
39 | continue
40 | if exclude == 'different' and \
41 | obs.loc[index_point1, cluster_label] != obs.loc[index_point2, cluster_label]:
42 | distances[i][j] = -1
43 | indices[i][j] = -1
44 | continue
45 | if type(exclude) == dict and \
46 | (obs.loc[index_point1, cluster_label], obs.loc[index_point2, cluster_label]) in exclude:
47 | distances[i][j] = -1
48 | indices[i][j] = -1
49 | distances[i] = distances[i][distances[i] >= 0]
50 | indices[i] = indices[i][indices[i] >= 0]
51 |
52 | return indices, distances
53 |
54 |
55 | def _preprocessing_of_graph(clu_value: np.ndarray,
56 | indices: np.ndarray,
57 | distances: np.ndarray,
58 | ) -> pd.DataFrame:
59 | """
60 | get information of edges
61 | """
62 | edges = []
63 |
64 | for index, neigh in enumerate(indices):
65 | if len(neigh) == 0:
66 | continue
67 | for index_2, point_2 in enumerate(neigh):
68 | if point_2 == index | point_2 == -1:
69 | continue
70 | elif point_2 < index:
71 | edge = [point_2, index,
72 | clu_value[point_2],
73 | clu_value[index],
74 | distances[index][index_2]]
75 | edges.append(edge)
76 |
77 | elif point_2 > index:
78 | edge = [index, point_2,
79 | clu_value[index],
80 | clu_value[point_2],
81 | distances[index][index_2]]
82 | edges.append(edge)
83 |
84 | df_edge = pd.DataFrame(data=np.array(edges), columns=['point_1', 'point_2',
85 | 'cluster_1', 'cluster_2', 'distance'])
86 |
87 | df_edge.drop_duplicates(subset=['point_1', 'point_2'], inplace=True)
88 | return df_edge
89 |
--------------------------------------------------------------------------------
/SOAPy_st/tl/__init__.py:
--------------------------------------------------------------------------------
1 | from ._mask import get_mask_from_domain
2 | from ._domain import domain_from_unsupervised, global_moran, cal_aucell, domain_from_local_moran
3 | from ._var_genes import cal_spatialDE, cal_sparkX, cal_spark
4 | from ._tendency import adata_from_mask, wilcoxon_test, spearman_correlation, ANOVA, spatial_tendency, gene_cluster
5 | from ._interaction import neighborhood_analysis, infiltration_analysis, get_c_niche
6 | from ._ccc import cell_level_communications, cell_type_level_communication, lr_pairs
7 | from ._tensor import TensorDecomposition
8 |
--------------------------------------------------------------------------------
/SOAPy_st/tl/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/__pycache__/_ccc.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/__pycache__/_ccc.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/__pycache__/_distance.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/__pycache__/_distance.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/__pycache__/_domain.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/__pycache__/_domain.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/__pycache__/_interaction.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/__pycache__/_interaction.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/__pycache__/_mask.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/__pycache__/_mask.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/__pycache__/_tendency.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/__pycache__/_tendency.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/__pycache__/_tensor.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/__pycache__/_tensor.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/__pycache__/_var_genes.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/__pycache__/_var_genes.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/__pycache__/utils.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/__pycache__/utils.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/GraphST/README.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/GraphST/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """
3 | # Author: Yahui Long
4 | # File Name: __init__.py
5 | # Description:
6 | """
7 |
8 | __author__ = "Yahui Long"
9 | __email__ = "long_yahui@immunol.a-star.edu.sg"
10 |
11 | from .utils import clustering, project_cell_to_spot
12 | from .preprocess import preprocess_adj, preprocess, construct_interaction, add_contrastive_label, get_feature, permutation, fix_seed
13 |
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/GraphST.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/GraphST.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/model.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/model.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/preprocess.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/preprocess.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/utils.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/utils.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/STAGATE_pyG/STAGATE.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 |
3 | import torch
4 | import torch.nn as nn
5 | import torch.backends.cudnn as cudnn
6 | cudnn.deterministic = True
7 | cudnn.benchmark = True
8 | import torch.nn.functional as F
9 | from .gat_conv import GATConv
10 |
11 | class STAGATE(torch.nn.Module):
12 | def __init__(self, hidden_dims):
13 | super(STAGATE, self).__init__()
14 |
15 | [in_dim, num_hidden, out_dim] = hidden_dims
16 | self.conv1 = GATConv(in_dim, num_hidden, heads=1, concat=False,
17 | dropout=0, add_self_loops=False, bias=False)
18 | self.conv2 = GATConv(num_hidden, out_dim, heads=1, concat=False,
19 | dropout=0, add_self_loops=False, bias=False)
20 | self.conv3 = GATConv(out_dim, num_hidden, heads=1, concat=False,
21 | dropout=0, add_self_loops=False, bias=False)
22 | self.conv4 = GATConv(num_hidden, in_dim, heads=1, concat=False,
23 | dropout=0, add_self_loops=False, bias=False)
24 |
25 | def forward(self, features, edge_index):
26 |
27 | h1 = F.elu(self.conv1(features, edge_index))
28 | h2 = self.conv2(h1, edge_index, attention=False)
29 | self.conv3.lin_src.data = self.conv2.lin_src.transpose(0, 1)
30 | self.conv3.lin_dst.data = self.conv2.lin_dst.transpose(0, 1)
31 | self.conv4.lin_src.data = self.conv1.lin_src.transpose(0, 1)
32 | self.conv4.lin_dst.data = self.conv1.lin_dst.transpose(0, 1)
33 | h3 = F.elu(self.conv3(h2, edge_index, attention=True,
34 | tied_attention=self.conv1.attentions))
35 | h4 = self.conv4(h3, edge_index, attention=False)
36 |
37 | return h2, h4 # F.log_softmax(x, dim=-1)
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/STAGATE_pyG/Train_STAGATE.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import pandas as pd
3 | from tqdm import tqdm
4 | import scipy.sparse as sp
5 |
6 | from .STAGATE import STAGATE
7 | from .utils import Transfer_pytorch_Data
8 |
9 | import torch
10 | import torch.backends.cudnn as cudnn
11 | cudnn.deterministic = True
12 | cudnn.benchmark = True
13 | import torch.nn.functional as F
14 |
15 |
16 | def train_STAGATE(adata, hidden_dims=[512, 30], n_epochs=1000, lr=0.001, key_added='STAGATE',
17 | gradient_clipping=5., weight_decay=0.0001, verbose=True,
18 | random_seed=0, save_loss=False, save_reconstrction=False,
19 | device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')):
20 | """\
21 | Training graph attention auto-encoder.
22 |
23 | Parameters
24 | ----------
25 | adata
26 | AnnData object of scanpy package.
27 | hidden_dims
28 | The dimension of the encoder.
29 | n_epochs
30 | Number of total epochs in training.
31 | lr
32 | Learning rate for AdamOptimizer.
33 | key_added
34 | The latent embeddings are saved in adata.obsm[key_added].
35 | gradient_clipping
36 | Gradient Clipping.
37 | weight_decay
38 | Weight decay for AdamOptimizer.
39 | save_loss
40 | If True, the training loss is saved in adata.uns['STAGATE_loss'].
41 | save_reconstrction
42 | If True, the reconstructed expression profiles are saved in adata.layers['STAGATE_ReX'].
43 | device
44 | See torch.device.
45 |
46 | Returns
47 | -------
48 | AnnData
49 | """
50 |
51 | # seed_everything()
52 | seed=random_seed
53 | import random
54 | random.seed(seed)
55 | torch.manual_seed(seed)
56 | torch.cuda.manual_seed_all(seed)
57 | np.random.seed(seed)
58 |
59 | adata.X = sp.csr_matrix(adata.X)
60 |
61 | if 'highly_variable' in adata.var.columns:
62 | adata_Vars = adata[:, adata.var['highly_variable']]
63 | else:
64 | adata_Vars = adata
65 |
66 | if verbose:
67 | print('Size of Input: ', adata_Vars.shape)
68 | if 'Spatial_Net' not in adata.uns.keys():
69 | raise ValueError("Spatial_Net is not existed! Run Cal_Spatial_Net first!")
70 |
71 | data = Transfer_pytorch_Data(adata_Vars)
72 |
73 | model = STAGATE(hidden_dims = [data.x.shape[1]] + hidden_dims).to(device)
74 | data = data.to(device)
75 |
76 | optimizer = torch.optim.Adam(model.parameters(), lr=lr, weight_decay=weight_decay)
77 |
78 | #loss_list = []
79 | for epoch in tqdm(range(1, n_epochs+1)):
80 | model.train()
81 | optimizer.zero_grad()
82 | z, out = model(data.x, data.edge_index)
83 | loss = F.mse_loss(data.x, out) #F.nll_loss(out[data.train_mask], data.y[data.train_mask])
84 | #loss_list.append(loss)
85 | loss.backward()
86 | torch.nn.utils.clip_grad_norm_(model.parameters(), gradient_clipping)
87 | optimizer.step()
88 |
89 | model.eval()
90 | z, out = model(data.x, data.edge_index)
91 |
92 | STAGATE_rep = z.to('cpu').detach().numpy()
93 | adata.obsm[key_added] = STAGATE_rep
94 |
95 | if save_loss:
96 | adata.uns['STAGATE_loss'] = loss
97 | if save_reconstrction:
98 | ReX = out.to('cpu').detach().numpy()
99 | ReX[ReX<0] = 0
100 | adata.layers['STAGATE_ReX'] = ReX
101 |
102 | return adata
103 |
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/STAGATE_pyG/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """
3 | # Author: Kangning Dong
4 | # File Name: __init__.py
5 | # Description:
6 | """
7 |
8 | __author__ = "Kangning Dong"
9 | __email__ = "dongkangning16@mails.ucas.ac.cn"
10 |
11 | from .STAGATE import STAGATE
12 | from .Train_STAGATE import train_STAGATE
13 | from .utils import Transfer_pytorch_Data, Cal_Spatial_Net, Stats_Spatial_Net, mclust_R, Cal_Spatial_Net_3D, Batch_Data
14 |
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/readme.txt:
--------------------------------------------------------------------------------
1 | The tools in this folder are only for SOAPy to invoke, if you use the relevant tools, please refer to the relevant text.
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/__init__.py:
--------------------------------------------------------------------------------
1 | # __init__ file
2 | import warnings
3 | warnings.filterwarnings('ignore')
4 |
5 | from . import tools as tl
6 |
7 | import sys
8 | sys.modules.update({f'{__name__}.{m}': globals()[m] for m in ['tl']})
9 |
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/scanit/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__init__.py:
--------------------------------------------------------------------------------
1 | # __init__ file
2 | from ._alpha import graph_alpha
3 | from ._knn import graph_knn
4 | from ._scale_estimation import estimate_cutoff_knn
5 | from ._dgi import rep_dgi
6 | from ._gae import rep_gae
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_alpha.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_alpha.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_dgi.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_dgi.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_gae.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_gae.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_knn.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_knn.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_scale_estimation.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_scale_estimation.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/_utils/_alpha.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import gudhi
3 | import networkx as nx
4 | from sklearn.neighbors import kneighbors_graph
5 | import matplotlib.pyplot as plt
6 |
7 | def graph_alpha(pts, n_layer = 1, cut = np.inf, draw = False):
8 |
9 | # Get a graph from alpha shape
10 | pts_list = pts.tolist()
11 | n_node = len(pts_list)
12 | alpha_complex = gudhi.AlphaComplex(points=pts_list)
13 | simplex_tree = alpha_complex.create_simplex_tree(max_alpha_square=cut**2)
14 | skeleton = simplex_tree.get_skeleton(1)
15 | initial_graph = nx.Graph()
16 | initial_graph.add_nodes_from([i for i in range(n_node)])
17 | for s in skeleton:
18 | if len(s[0]) == 2:
19 | initial_graph.add_edge(s[0][0], s[0][1])
20 | # Extend the graph for the specified layers
21 | extended_graph = nx.Graph()
22 | extended_graph.add_nodes_from(initial_graph)
23 | extended_graph.add_edges_from(initial_graph.edges)
24 | if n_layer == 2:
25 | for i in range(n_node):
26 | for j in initial_graph.neighbors(i):
27 | for k in initial_graph.neighbors(j):
28 | extended_graph.add_edge(i,k)
29 | elif n_layer == 3:
30 | for i in range(n_node):
31 | for j in initial_graph.neighbors(i):
32 | for k in initial_graph.neighbors(j):
33 | for l in initial_graph.neighbors(k):
34 | extended_graph.add_edge(i,l)
35 | if n_layer >= 4:
36 | print("Setting n_layer to greater than 3 may results in too large neighborhoods")
37 |
38 | # Remove self edges
39 | for i in range(n_node):
40 | try:
41 | extended_graph.remove_edge(i,i)
42 | except:
43 | pass
44 |
45 | # Draw the graph
46 | if draw:
47 | pos_dict = {i:pts_list[i] for i in range(n_node)}
48 | nx.draw_networkx(extended_graph, pos=pos_dict, with_labels=False, node_size=1, node_color='dimgrey', edge_color='darkgrey')
49 | plt.axis('equal'); plt.axis('off'); plt.show()
50 |
51 | # Get the sparse adjacency matrix
52 | A = nx.to_scipy_sparse_matrix(extended_graph, format='csr')
53 |
54 | return A
55 |
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/_utils/_dgi.py:
--------------------------------------------------------------------------------
1 | import random
2 | import torch
3 | import torch.nn as nn
4 | from torch_geometric.nn import GCNConv, DeepGraphInfomax
5 |
6 | import numpy as np
7 | from scipy import sparse
8 | import pickle
9 |
10 |
11 | def sparse_mx_to_torch_edge_list(sparse_mx):
12 | sparse_mx = sparse_mx.tocoo().astype(np.float32)
13 | edge_list = torch.from_numpy(
14 | np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64))
15 | return edge_list
16 |
17 | def rep_dgi(
18 | n_h,
19 | X,
20 | A,
21 | n_epoch=1000,
22 | lr=0.001,
23 | print_step=500,
24 | torch_seed=None,
25 | python_seed=None,
26 | numpy_seed=None,
27 | device=None
28 | ):
29 | # torch.set_deterministic(True)
30 | if not torch_seed is None:
31 | torch.manual_seed(torch_seed)
32 | if not python_seed is None:
33 | random.seed(python_seed)
34 | if not numpy_seed is None:
35 | np.random.seed(numpy_seed)
36 |
37 |
38 | n_f = X.shape[1]
39 |
40 | class Encoder(nn.Module):
41 | def __init__(self, in_channels, hidden_channels):
42 | super(Encoder, self).__init__()
43 | self.conv = GCNConv(in_channels, hidden_channels, cached=False)
44 | self.prelu = nn.PReLU(hidden_channels)
45 | self.conv2 = GCNConv(hidden_channels, hidden_channels, cached=False)
46 | self.prelu2 = nn.PReLU(hidden_channels)
47 |
48 | def forward(self, x, edge_index):
49 | x = self.conv(x, edge_index)
50 | x = self.prelu(x)
51 | x = self.conv2(x, edge_index)
52 | x = self.prelu2(x)
53 | return x
54 |
55 | def corruption(x, edge_index):
56 | return x[torch.randperm(x.size(0))], edge_index
57 | if device is None:
58 | device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
59 | else:
60 | device = torch.device(device)
61 | model = DeepGraphInfomax(
62 | hidden_channels = n_h, encoder = Encoder(n_f, n_h),
63 | summary = lambda z, *args, **kwargs: torch.sigmoid(z.mean(dim=0)),
64 | corruption = corruption).to(device)
65 |
66 | X = torch.FloatTensor(X)
67 | X = X.to(device)
68 | edge_list = sparse_mx_to_torch_edge_list(A)
69 | edge_list = edge_list.to(device)
70 |
71 | optimiser = torch.optim.Adam(model.parameters(), lr=lr)
72 |
73 | def train():
74 | model.train()
75 | optimiser.zero_grad()
76 | pos_z, neg_z, summary = model(X, edge_list)
77 | loss = model.loss(pos_z, neg_z, summary)
78 | loss.backward()
79 | optimiser.step()
80 | return loss.item()
81 |
82 | for epoch in range(n_epoch):
83 | loss = train()
84 | if epoch % print_step == 0 or epoch+1 == n_epoch:
85 | print('Epoch: {:03d}, Loss: {:.4f}'.format(epoch, loss))
86 |
87 | z,_,_ = model(X, edge_list)
88 | return z.cpu().detach().numpy()
89 |
90 | def main():
91 | f = open("./X.pkl", 'rb')
92 | X = pickle.load(f)
93 | X = X.toarray()
94 | f = open("./A.pkl", 'rb')
95 | A = pickle.load(f)
96 | z = rep_dgi(32, X, A)
97 | print(z.shape)
98 |
99 | if __name__=="__main__":
100 | main()
101 |
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/_utils/_gae.py:
--------------------------------------------------------------------------------
1 | import os.path as osp
2 |
3 | import argparse
4 | import torch
5 | import torch.nn.functional as F
6 | from torch_geometric.datasets import Planetoid
7 | import torch_geometric.transforms as T
8 | from torch_geometric.nn import GCNConv, GAE, VGAE
9 |
10 | import pickle
11 | import numpy as np
12 |
13 | def sparse_mx_to_torch_edge_list(sparse_mx):
14 | sparse_mx = sparse_mx.tocoo().astype(np.float32)
15 | edge_list = torch.from_numpy(
16 | np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64))
17 | return edge_list
18 |
19 | def rep_gae(n_h, X, A, mdl_type="VGAE"):
20 |
21 | n_nd, n_f = X.shape
22 |
23 | class Encoder(torch.nn.Module):
24 | def __init__(self, in_channels, out_channels):
25 | super(Encoder, self).__init__()
26 | self.conv1 = GCNConv(in_channels, 2 * out_channels, cached=True)
27 | if mdl_type == 'GAE':
28 | self.conv2 = GCNConv(2 * out_channels, out_channels, cached=True)
29 | elif mdl_type == 'VGAE':
30 | self.conv_mu = GCNConv(2 * out_channels, out_channels, cached=True)
31 | self.conv_logvar = GCNConv(
32 | 2 * out_channels, out_channels, cached=True)
33 |
34 | def forward(self, x, edge_index):
35 | x = F.relu(self.conv1(x, edge_index))
36 | if mdl_type == 'GAE':
37 | return self.conv2(x, edge_index)
38 | elif mdl_type == 'VGAE':
39 | return self.conv_mu(x, edge_index), self.conv_logvar(x, edge_index)
40 |
41 | channels = n_h
42 | device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
43 | if mdl_type == 'GAE':
44 | model = GAE(Encoder(n_f, channels)).to(device)
45 | elif mdl_type == 'VGAE':
46 | model = VGAE(Encoder(n_f, channels)).to(device)
47 | optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
48 | X = torch.FloatTensor(X)
49 | X = X.to(device)
50 | edge_list = sparse_mx_to_torch_edge_list(A)
51 | edge_list = edge_list.to(device)
52 |
53 | def train():
54 | model.train()
55 | optimizer.zero_grad()
56 | z = model.encode(X, edge_list)
57 | loss = model.recon_loss(z, edge_list)
58 | if mdl_type == 'VGAE':
59 | loss = loss + (1 / n_nd) * model.kl_loss()
60 | loss.backward()
61 | optimizer.step()
62 | return loss.item()
63 |
64 | for epoch in range(1000):
65 | loss = train()
66 | print('Epoch: {:03d}, Loss: {:.4f}'.format(epoch, loss))
67 |
68 | z,_,_ = model(X, edge_list)
69 | return z.cpu().detach().numpy()
70 |
71 | def main():
72 | f = open("./X.pkl", 'rb')
73 | X = pickle.load(f)
74 | X = X.todense()
75 | f = open("./A.pkl", 'rb')
76 | A = pickle.load(f)
77 | rep_gae(100, X, A, mdl_type='VGAE')
78 |
79 | if __name__=="__main__":
80 | main()
81 |
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/_utils/_knn.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | from scipy import sparse
3 | from sklearn.neighbors import kneighbors_graph, radius_neighbors_graph
4 | import networkx as nx
5 | import matplotlib.pyplot as plt
6 |
7 | def graph_knn(pts, k = 10, cut = np.inf, draw = False):
8 | # Assymetric knn graph
9 | A_knn = kneighbors_graph(pts, n_neighbors=k, mode='connectivity')
10 | # Make it symetric
11 | A_knn_sym = ((A_knn + A_knn.T).astype(bool)).astype(int)
12 | # Apply the cutoff
13 | if not np.isinf(cut):
14 | A_rn = radius_neighbors_graph(pts, radius=cut, mode='connectivity')
15 | A_knn_sym = A_knn_sym.multiply(A_rn)
16 | # Plot the graph
17 | if draw:
18 | G = nx.from_scipy_sparse_matrix(A_knn_sym)
19 | pts_list = list(pts)
20 | n_node = len(pts_list)
21 | pos_dict = {i:pts_list[i] for i in range(n_node)}
22 | nx.draw_networkx(G, pos=pos_dict, with_labels=False, node_size=10, node_color='dimgrey', edge_color='darkgrey')
23 | plt.axis('equal'); plt.axis('off'); plt.show()
24 |
25 | return A_knn_sym
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/_utils/_scale_estimation.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | from scipy import sparse
3 | from sklearn.neighbors import kneighbors_graph
4 |
5 | def estimate_cutoff_knn(pts, k=10):
6 | A_knn = kneighbors_graph(pts, n_neighbors=k, mode='distance')
7 | est_cut = A_knn.sum() / float(A_knn.count_nonzero())
8 | return est_cut
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/tools/__init__.py:
--------------------------------------------------------------------------------
1 | from ._scanit_representation import spatial_graph
2 | from ._scanit_representation import spatial_representation
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/tools/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/scanit/tools/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/tools/__pycache__/_scanit_representation.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/SOAPy_st/tl/other_package_without_pip/scanit/tools/__pycache__/_scanit_representation.cpython-39.pyc
--------------------------------------------------------------------------------
/SOAPy_st/tl/other_package_without_pip/scanit/tools/_scanit_representation.py:
--------------------------------------------------------------------------------
1 | import umap
2 | import anndata
3 | import numpy as np
4 | from scipy.spatial import distance_matrix
5 | from sklearn.manifold import MDS, smacof
6 |
7 | from .._utils import graph_alpha
8 | from .._utils import graph_knn
9 | from .._utils import estimate_cutoff_knn
10 | from .._utils import rep_dgi
11 | from .._utils import rep_gae
12 |
13 | def spatial_graph(
14 | adata: anndata.AnnData,
15 | method="alpha shape",
16 | alpha_n_layer=1,
17 | cut=None,
18 | estimate_cut=True,
19 | knn_n_neighbors=10,
20 | draw = False
21 | ):
22 | pts = adata.obsm['spatial']
23 | if estimate_cut:
24 | cut = estimate_cutoff_knn(pts, k=knn_n_neighbors)
25 | else:
26 | cut = np.inf
27 | if method == "alpha shape":
28 | A = graph_alpha(pts, cut=cut, n_layer=alpha_n_layer, draw=draw)
29 | elif method == "knn":
30 | A = graph_knn(pts, cut=cut, k=knn_n_neighbors, draw=draw)
31 |
32 | adata.obsp['scanit-graph'] = A
33 |
34 | # def spatial_deconvolution(
35 | # adata: anndata.AnnData,
36 | # method='laplacian'
37 | # ):
38 |
39 |
40 | def spatial_representation(
41 | adata: anndata.AnnData,
42 | n_h = 32,
43 | model = 'dgi',
44 | n_epoch = 1000,
45 | lr = 0.001,
46 | print_step = 500,
47 | torch_seed = None,
48 | python_seed = None,
49 | numpy_seed = None,
50 | device=None,
51 | data_slot = None,
52 | n_consensus = 1,
53 | projection = 'mds',
54 | n_comps_proj = 15,
55 | n_nb_proj = 15,
56 | extra_embeddings = None,
57 | extra_embedding_weights = None
58 | ):
59 | A = adata.obsp['scanit-graph']
60 | if not data_slot is None:
61 | X_processed = np.array( adata.obsm[data_slot] )
62 | else:
63 | X_processed = np.array( adata.X )
64 |
65 | if model == "dgi":
66 | if n_consensus == 1 and extra_embeddings is None:
67 | X_embed = rep_dgi(n_h, X_processed, A,
68 | n_epoch=n_epoch, lr=lr, print_step=print_step,
69 | torch_seed=torch_seed, python_seed=python_seed,
70 | numpy_seed=numpy_seed, device=device)
71 | else:
72 | X_embeds = []
73 |
74 | np.random.seed(torch_seed)
75 | torch_seeds = np.random.choice(10000, size=n_consensus, replace=False)
76 | np.random.seed(python_seed)
77 | python_seeds = np.random.choice(10000, size=n_consensus, replace=False)
78 | np.random.seed(numpy_seed)
79 | numpy_seeds = np.random.choice(10000, size=n_consensus, replace=False)
80 |
81 | for i in range(n_consensus):
82 | X_embed = rep_dgi(n_h, X_processed, A,
83 | n_epoch=n_epoch, lr=lr, print_step=print_step,
84 | torch_seed=torch_seeds[i], python_seed=python_seeds[i],
85 | numpy_seed=numpy_seeds[i], device=device)
86 | X_embeds.append(X_embed)
87 | if not extra_embeddings is None:
88 | for extra_embedding in extra_embeddings:
89 | X_embeds.append(extra_embedding)
90 |
91 | if extra_embedding_weights is None:
92 | embeds_weights = np.ones(len(X_embeds)) / float(len(X_embeds))
93 | else:
94 | embeds_weights = []
95 | for i in range(n_consensus):
96 | embeds_weights.append( (1-np.sum(extra_embedding_weights))/float(n_consensus) )
97 | embeds_weights.extend(extra_embedding_weights)
98 | embeds_weights = np.array(embeds_weights, float)
99 | elif model == "gae":
100 | X_embed = rep_gae(n_h, X_processed, A, n_epoch=n_epoch)
101 |
102 | if n_consensus > 1 or not extra_embeddings is None:
103 | n_spot = X_embed.shape[0]
104 | W_consensus = np.zeros([n_spot, n_spot])
105 | for i in range(len(X_embeds)):
106 | W = distance_matrix(X_embeds[i], X_embeds[i])
107 | W_consensus += W * embeds_weights[i]
108 | if projection == 'mds':
109 | # X_embed,_ = smacof(W_consensus, n_components=n_comps_proj, n_jobs=-1)
110 | model = MDS(n_components=n_comps_proj, dissimilarity='precomputed', n_jobs=-1, random_state=python_seed)
111 | X_embed = model.fit_transform(W_consensus)
112 | elif projection == 'umap':
113 | model = umap.UMAP(n_components=n_comps_proj, metric='precomputed', n_neighbors=n_nb_proj)
114 | X_embed = model.fit_transform(W_consensus)
115 |
116 | adata.obsm['X_scanit'] = X_embed
117 | if n_consensus > 1:
118 | adata.obsp['D_scanit'] = W_consensus
--------------------------------------------------------------------------------
/build/_images/Overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Overview.png
--------------------------------------------------------------------------------
/build/_images/T_cell_proximal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/T_cell_proximal.png
--------------------------------------------------------------------------------
/build/_images/T_communication.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/T_communication.png
--------------------------------------------------------------------------------
/build/_images/T_domain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/T_domain.png
--------------------------------------------------------------------------------
/build/_images/T_niche.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/T_niche.png
--------------------------------------------------------------------------------
/build/_images/T_read.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/T_read.png
--------------------------------------------------------------------------------
/build/_images/T_tendency.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/T_tendency.png
--------------------------------------------------------------------------------
/build/_images/T_tensor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/T_tensor.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Cell_type_proximity_14_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Cell_type_proximity_14_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Cell_type_proximity_16_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Cell_type_proximity_16_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Cell_type_proximity_21_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Cell_type_proximity_21_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Cell_type_proximity_23_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Cell_type_proximity_23_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Cell_type_proximity_24_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Cell_type_proximity_24_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Cell_type_proximity_9_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Cell_type_proximity_9_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Niche_composition_13_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Niche_composition_13_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Niche_composition_15_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Niche_composition_15_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Niche_composition_17_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Niche_composition_17_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Niche_composition_19_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Niche_composition_19_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Niche_composition_26_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Niche_composition_26_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Niche_composition_28_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Niche_composition_28_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Niche_composition_29_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Niche_composition_29_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Read_spatial_omics_20_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Read_spatial_omics_20_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Read_spatial_omics_21_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Read_spatial_omics_21_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_communication_-_cell_level_9_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_communication_-_cell_level_9_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_communications_12_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_communications_12_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_communications_13_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_communications_13_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_communications_14_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_communications_14_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_communications_15_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_communications_15_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_communications_17_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_communications_17_2.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_communications_18_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_communications_18_1.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_communications_20_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_communications_20_1.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_communications_21_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_communications_21_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_communications_7_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_communications_7_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_domain_15_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_domain_15_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_domain_17_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_domain_17_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_domain_8_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_domain_8_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_tendency_20_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_tendency_20_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_tendency_22_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_tendency_22_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_tendency_25_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_tendency_25_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_tendency_5_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_tendency_5_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatial_tendency_8_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatial_tendency_8_2.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatiotemporal_pattern_15_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatiotemporal_pattern_15_1.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Spatiotemporal_pattern_16_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Spatiotemporal_pattern_16_1.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Transfer_Seurat_object_into_Anndata_object_10_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Transfer_Seurat_object_into_Anndata_object_10_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Transfer_Seurat_object_into_Anndata_object_15_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Transfer_Seurat_object_into_Anndata_object_15_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Transfer_Seurat_object_into_Anndata_object_5_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Transfer_Seurat_object_into_Anndata_object_5_0.png
--------------------------------------------------------------------------------
/build/_images/Tutorials_Visualization_of_Nanostring_DSP_subtissues_16_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_images/Tutorials_Visualization_of_Nanostring_DSP_subtissues_16_1.png
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_box_plot.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_box\_plot
2 | ============================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_box_plot
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_ccc_dotplot.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_ccc\_dotplot
2 | ===============================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_ccc_dotplot
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_ccc_embedding.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_ccc\_embedding
2 | =================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_ccc_embedding
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_ccc_netplot.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_ccc\_netplot
2 | ===============================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_ccc_netplot
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_celltype_niche_heatmap.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_celltype\_niche\_heatmap
2 | ===========================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_celltype_niche_heatmap
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_celltype_sample_heatmap.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_celltype\_sample\_heatmap
2 | ============================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_celltype_sample_heatmap
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_curves_cluster.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_curves\_cluster
2 | ==================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_curves_cluster
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_factor_matrix_in_CP_tensor.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_factor\_matrix\_in\_CP\_tensor
2 | =================================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_factor_matrix_in_CP_tensor
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_factor_matrix_in_tucker_tensor.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_factor\_matrix\_in\_tucker\_tensor
2 | =====================================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_factor_matrix_in_tucker_tensor
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_infiltration_analysis.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_infiltration\_analysis
2 | =========================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_infiltration_analysis
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_moran_scatterplot.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_moran\_scatterplot
2 | =====================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_moran_scatterplot
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_neighborhood_analysis.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_neighborhood\_analysis
2 | =========================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_neighborhood_analysis
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_network.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_network
2 | ==========================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_network
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_niche_environment.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_niche\_environment
2 | =====================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_niche_environment
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_niche_sample_heatmap.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_niche\_sample\_heatmap
2 | =========================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_niche_sample_heatmap
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_proportion_in_CP.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_proportion\_in\_CP
2 | =====================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_proportion_in_CP
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_proportion_in_tucker.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_proportion\_in\_tucker
2 | =========================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_proportion_in_tucker
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_tendency.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_tendency
2 | ===========================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_tendency
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pl.show_voronoi.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_voronoi
2 | ==========================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_voronoi
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pp.make_network.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pp.make\_network
2 | ==========================
3 |
4 | .. currentmodule:: SOAPy_st.pp
5 |
6 | .. autofunction:: make_network
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pp.read_csv2adata.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pp.read\_csv2adata
2 | ============================
3 |
4 | .. currentmodule:: SOAPy_st.pp
5 |
6 | .. autofunction:: read_csv2adata
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pp.read_dsp2adata.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pp.read\_dsp2adata
2 | ============================
3 |
4 | .. currentmodule:: SOAPy_st.pp
5 |
6 | .. autofunction:: read_dsp2adata
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pp.read_mult_image2adata.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pp.read\_mult\_image2adata
2 | ====================================
3 |
4 | .. currentmodule:: SOAPy_st.pp
5 |
6 | .. autofunction:: read_mult_image2adata
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pp.read_visium2adata.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pp.read\_visium2adata
2 | ===============================
3 |
4 | .. currentmodule:: SOAPy_st.pp
5 |
6 | .. autofunction:: read_visium2adata
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.pp.st_Seurat2Anndata.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pp.st\_Seurat2Anndata
2 | ===============================
3 |
4 | .. currentmodule:: SOAPy_st.pp
5 |
6 | .. autofunction:: st_Seurat2Anndata
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.ANOVA.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.ANOVA
2 | ==================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: ANOVA
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.TensorDecomposition.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.TensorDecomposition
2 | ================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autoclass:: TensorDecomposition
7 |
8 |
9 | .. automethod:: __init__
10 |
11 |
12 | .. rubric:: Methods
13 |
14 | .. autosummary::
15 |
16 | ~TensorDecomposition.CP_decomposition
17 | ~TensorDecomposition.__init__
18 | ~TensorDecomposition.highly_variable
19 | ~TensorDecomposition.input_tensor
20 | ~TensorDecomposition.normalization
21 | ~TensorDecomposition.tensor_with_gene
22 | ~TensorDecomposition.tensor_with_obs
23 | ~TensorDecomposition.tucker_decomposition
24 |
25 |
26 |
27 |
28 |
29 | .. rubric:: Attributes
30 |
31 | .. autosummary::
32 |
33 | ~TensorDecomposition.get_tensor
34 |
35 |
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.adata_from_mask.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.adata\_from\_mask
2 | ==============================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: adata_from_mask
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.cal_aucell.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.cal\_aucell
2 | ========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: cal_aucell
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.cal_spark.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.cal\_spark
2 | =======================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: cal_spark
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.cal_sparkX.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.cal\_sparkX
2 | ========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: cal_sparkX
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.cal_spatialDE.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.cal\_spatialDE
2 | ===========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: cal_spatialDE
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.cell_level_communications.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.cell\_level\_communications
2 | ========================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: cell_level_communications
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.cell_type_level_communication.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.cell\_type\_level\_communication
2 | =============================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: cell_type_level_communication
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.domain_from_STAGATE.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.domain\_from\_STAGATE
2 | ==================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: domain_from_STAGATE
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.domain_from_local_moran.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.domain\_from\_local\_moran
2 | =======================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: domain_from_local_moran
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.gene_cluster.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.gene\_cluster
2 | ==========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: gene_cluster
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.get_c_niche.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.get\_c\_niche
2 | ==========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: get_c_niche
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.get_mask_from_domain.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.get\_mask\_from\_domain
2 | ====================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: get_mask_from_domain
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.global_moran.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.global\_moran
2 | ==========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: global_moran
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.infiltration_analysis.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.infiltration\_analysis
2 | ===================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: infiltration_analysis
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.lr_pairs.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.lr\_pairs
2 | ======================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autoclass:: lr_pairs
7 |
8 |
9 | .. automethod:: __init__
10 |
11 |
12 | .. rubric:: Methods
13 |
14 | .. autosummary::
15 |
16 | ~lr_pairs.__init__
17 | ~lr_pairs.get_complexes
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.neighborhood_analysis.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.neighborhood\_analysis
2 | ===================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: neighborhood_analysis
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.spatial_tendency.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.spatial\_tendency
2 | ==============================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: spatial_tendency
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.spearman_correlation.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.spearman\_correlation
2 | ==================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: spearman_correlation
--------------------------------------------------------------------------------
/build/_sources/Api/SOAPy_st.tl.wilcoxon_test.rst.txt:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.wilcoxon\_test
2 | ===========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: wilcoxon_test
--------------------------------------------------------------------------------
/build/_sources/Api/index.rst.txt:
--------------------------------------------------------------------------------
1 |
2 | API
3 | ===
4 |
5 | Import SOAPy :
6 |
7 | import SOAPy_st as sp
8 |
9 | .. toctree::
10 | :maxdepth: 1
11 |
12 | preprocessing
13 |
14 | This module includes data reading and network construction.
15 |
16 |
17 | .. toctree::
18 | :maxdepth: 1
19 |
20 | tool
21 |
22 | The main analysis function module.
23 |
24 |
25 | .. toctree::
26 | :maxdepth: 1
27 |
28 | plot
29 |
30 | Visualization module.
31 |
--------------------------------------------------------------------------------
/build/_sources/Api/plot.rst.txt:
--------------------------------------------------------------------------------
1 | .. module:: SOAPy_st
2 | .. automodule:: SOAPy_st
3 | :noindex:
4 |
5 | pl
6 | ============================
7 |
8 | Spatial network
9 | ------------------------------
10 |
11 | .. module:: SOAPy_st.pl
12 | .. currentmodule:: SOAPy_st
13 |
14 | .. autosummary::
15 | :toctree: .
16 |
17 | pl.show_network
18 | pl.show_voronoi
19 |
20 | Spatial domain
21 | -------------------
22 |
23 | .. module:: SOAPy_st.pl
24 | .. currentmodule:: SOAPy_st
25 |
26 | .. autosummary::
27 | :toctree: .
28 |
29 | pl.show_moran_scatterplot
30 |
31 |
32 | Spatial tendency
33 | -------------------
34 |
35 | .. module:: SOAPy_st.pl
36 | .. currentmodule:: SOAPy_st
37 |
38 | .. autosummary::
39 | :toctree: .
40 |
41 | pl.show_tendency
42 | pl.show_curves_cluster
43 | pl.show_box_plot
44 |
45 |
46 | Cell type proximity
47 | -------------------
48 |
49 | .. module:: SOAPy_st.pl
50 | .. currentmodule:: SOAPy_st
51 |
52 | .. autosummary::
53 | :toctree: .
54 |
55 | pl.show_neighborhood_analysis
56 | pl.show_infiltration_analysis
57 |
58 |
59 | Niche composition
60 | -----------------
61 |
62 | .. module:: SOAPy_st.pl
63 | .. currentmodule:: SOAPy_st
64 |
65 | .. autosummary::
66 | :toctree: .
67 |
68 | pl.show_niche_environment
69 | pl.show_niche_sample_heatmap
70 | pl.show_celltype_niche_heatmap
71 | pl.show_celltype_sample_heatmap
72 |
73 |
74 | Spatial communication
75 | ---------------------
76 |
77 | .. module:: SOAPy_st.pl
78 | .. currentmodule:: SOAPy_st
79 |
80 | .. autosummary::
81 | :toctree: .
82 |
83 | pl.show_ccc_netplot
84 | pl.show_ccc_dotplot
85 | pl.show_ccc_embedding
86 |
87 |
88 | Tensor decomposition
89 | ---------------------
90 |
91 | .. module:: SOAPy_st.pl
92 | .. currentmodule:: SOAPy_st
93 |
94 | .. autosummary::
95 | :toctree: .
96 |
97 | pl.show_factor_matrix_in_CP_tensor
98 | pl.show_factor_matrix_in_tucker_tensor
99 | pl.show_proportion_in_tucker
100 | pl.show_proportion_in_CP
--------------------------------------------------------------------------------
/build/_sources/Api/preprocessing.rst.txt:
--------------------------------------------------------------------------------
1 | .. module:: SOAPy_st
2 | .. automodule:: SOAPy_st
3 | :noindex:
4 |
5 | pp
6 | ============================
7 |
8 | Read
9 | -----
10 |
11 | .. module:: SOAPy_st.pp
12 | .. currentmodule:: SOAPy_st
13 |
14 | .. autosummary::
15 | :toctree: .
16 |
17 | pp.read_csv2adata
18 | pp.read_mult_image2adata
19 | pp.read_visium2adata
20 | pp.read_dsp2adata
21 |
22 |
23 | Seurat to Anndata
24 | -----------------
25 |
26 | .. module:: SOAPy_st.pp
27 | .. currentmodule:: SOAPy_st
28 |
29 | .. autosummary::
30 | :toctree: .
31 |
32 | pp.st_Seurat2Anndata
33 |
34 |
35 | Spatial network
36 | ---------------
37 |
38 | .. module:: SOAPy_st.pp
39 | .. currentmodule:: SOAPy_st
40 |
41 | .. autosummary::
42 | :toctree: .
43 |
44 | pp.make_network
--------------------------------------------------------------------------------
/build/_sources/Api/tool.rst.txt:
--------------------------------------------------------------------------------
1 | .. module:: SOAPy_st
2 | .. automodule:: SOAPy_st
3 | :noindex:
4 |
5 | tl
6 | ============================
7 |
8 | Spatial domain
9 | -------------------
10 |
11 | .. module:: SOAPy_st.tl
12 | .. currentmodule:: SOAPy_st
13 |
14 | .. autosummary::
15 | :toctree: .
16 |
17 | tl.domain_from_STAGATE
18 | tl.cal_aucell
19 | tl.domain_from_local_moran
20 | tl.global_moran
21 |
22 | Mask
23 | -------------------
24 |
25 | .. module:: SOAPy_st.tl
26 | .. currentmodule:: SOAPy_st
27 |
28 | .. autosummary::
29 | :toctree: .
30 |
31 | tl.adata_from_mask
32 | tl.get_mask_from_domain
33 |
34 | Spatial tendency
35 | -------------------
36 |
37 | .. module:: SOAPy_st.tl
38 | .. currentmodule:: SOAPy_st
39 |
40 | .. autosummary::
41 | :toctree: .
42 |
43 | tl.ANOVA
44 | tl.wilcoxon_test
45 | tl.spearman_correlation
46 | tl.spatial_tendency
47 | tl.gene_cluster
48 | tl.cal_spatialDE
49 | tl.cal_sparkX
50 | tl.cal_spark
51 |
52 | Cell type proximity
53 | -------------------
54 |
55 | .. module:: SOAPy_st.tl
56 | .. currentmodule:: SOAPy_st
57 |
58 | .. autosummary::
59 | :toctree: .
60 |
61 | tl.neighborhood_analysis
62 | tl.infiltration_analysis
63 |
64 | Niche composition
65 | -----------------
66 |
67 | .. module:: SOAPy_st.tl
68 | .. currentmodule:: SOAPy_st
69 |
70 | .. autosummary::
71 | :toctree: .
72 |
73 | tl.get_c_niche
74 |
75 | Spatial communication
76 | ---------------------
77 |
78 | .. module:: SOAPy_st.tl
79 | .. currentmodule:: SOAPy_st
80 |
81 | .. autosummary::
82 | :toctree: .
83 |
84 | tl.lr_pairs
85 | tl.cell_level_communications
86 | tl.cell_type_level_communication
87 |
88 | Tensor decomposition
89 | ---------------------
90 |
91 | .. module:: SOAPy_st.tl
92 | .. currentmodule:: SOAPy_st
93 |
94 | .. autosummary::
95 | :toctree: .
96 |
97 | tl.TensorDecomposition
98 |
--------------------------------------------------------------------------------
/build/_sources/Installation.rst.txt:
--------------------------------------------------------------------------------
1 | .. highlight:: shell
2 |
3 | ============
4 | Installation
5 | ============
6 |
7 |
8 | Install by PyPi
9 | ---------------
10 |
11 | **Step 1:**
12 |
13 | Prepare conda environment for SOAPy
14 | ::
15 |
16 | conda create -n SOAPy_st python=3.9
17 | conda activate SOAPy_st
18 |
19 | **Step 2:**
20 |
21 | Install SOAPy using `pip`
22 | ::
23 |
24 | pip install SOAPy_st
25 |
26 |
27 | Install by github
28 | -----------------
29 |
30 | download the file from github
31 | ::
32 |
33 | cd SOAPy_st
34 | python setup.py build
35 | python setup.py install
36 |
37 |
38 | Install STAGATE
39 | ---------------
40 |
41 | See https://stagate.readthedocs.io/en/latest/Installation.html.
42 |
--------------------------------------------------------------------------------
/build/_sources/References.rst.txt:
--------------------------------------------------------------------------------
1 | References
2 | ----------
3 | .. [Wolf18] Wolf *et al.* (2018),
4 | *Scanpy: large-scale single-cell gene expression data analysis*,
5 | `Genome Biology `__.
6 |
7 | .. [Dong21] Dong *et al.* (2021),
8 | *Deciphering spatial domains from spatially resolved transcriptomics with an adaptive graph attention auto-encoder*,
9 | `Nature Communications `__.
10 |
11 | .. [Pham23] Pham *et al.* (2023),
12 | *Robust mapping of spatiotemporal trajectories and cell–cell interactions in healthy and diseased tissues*,
13 | `Nature Communications `__.
14 |
15 | .. [Jin21] Jin *et al.* (2021),
16 | *Inference and analysis of cell-cell communication using CellChat*,
17 | `Nature Communications `__.
18 |
19 | .. [Svensson18] Svensson *et al.* (2018),
20 | *SpatialDE: identification of spatially variable genes*,
21 | `Nature Methods `__.
22 |
23 | .. [Sun20] Sun *et al.* (2020),
24 | *Statistical analysis of spatial expression patterns for spatially resolved transcriptomic studies*,
25 | `Nature Communications `__.
26 |
27 | .. [Sun21] Sun *et al.* (2021),
28 | *SPARK-X: non-parametric modeling enables scalable and robust detection of spatial expression patterns for large spatial transcriptomic studies*,
29 | `Nature Communications `__.
30 |
31 | .. [Kolda09] Kolda *et al.* (2009),
32 | *Tensor Decompositions and Applications*,
33 | `SIAM Rev. `__.
34 |
35 | .. [Keren18] Keren *et al.* (2018),
36 | *A Structured Tumor-Immune Microenvironment in Triple Negative Breast Cancer Revealed by Multiplexed Ion Beam Imaging*,
37 | `Cell. `__.
38 |
39 | .. [Pedregosa11] Pedregosa *et al.* (2011),
40 | *Scikit-learn: Machine Learning in Python*,
41 | `JMLR `__.
42 |
43 |
--------------------------------------------------------------------------------
/build/_sources/Release_notes.rst.txt:
--------------------------------------------------------------------------------
1 | Release notes
2 | ======================================
3 |
4 | Version 0.1.0
5 | -------------
6 |
7 | Initial version
8 |
9 | Version 0.1.0
10 | -------------
11 |
12 | Add pp.st_Seurat2Anndata
--------------------------------------------------------------------------------
/build/_sources/Tutorials/index.rst.txt:
--------------------------------------------------------------------------------
1 | .. module:: SOAPy_st
2 | .. automodule:: SOAPy_st
3 | :noindex:
4 |
5 | Tutorials
6 | ======================================
7 |
8 | Examples data
9 | -------------
10 |
11 | Some of the processed h5ad data will be uploaded to the https://zenodo.org/records/10450764 for direct use by the user,
12 | and other non-uploaded data can be downloaded through the links given in the tutorial.
13 |
14 | Major tutorials
15 | ---------------
16 |
17 | .. toctree::
18 | :maxdepth: 1
19 |
20 | Read_spatial_omics
21 |
22 | .. image:: ../_static/T_read.png
23 | :height: 100px
24 | :target: Read_spatial_omics
25 |
26 | .. toctree::
27 | :maxdepth: 1
28 |
29 | Spatial domain
30 |
31 | .. image:: ../_static/T_domain.png
32 | :height: 100px
33 |
34 | .. toctree::
35 | :maxdepth: 1
36 |
37 | Spatial tendency
38 |
39 | .. image:: ../_static/T_tendency.png
40 | :height: 100px
41 |
42 | .. toctree::
43 | :maxdepth: 1
44 |
45 | Cell type proximity
46 |
47 | .. image:: ../_static/T_cell_proximal.png
48 | :height: 100px
49 |
50 | .. toctree::
51 | :maxdepth: 1
52 |
53 | Niche composition
54 |
55 | .. image:: ../_static/T_niche.png
56 | :height: 100px
57 |
58 | .. toctree::
59 | :maxdepth: 1
60 |
61 | Spatial communications
62 |
63 | .. image:: ../_static/T_communication.png
64 | :height: 100px
65 |
66 | .. toctree::
67 | :maxdepth: 1
68 |
69 | Spatiotemporal pattern
70 |
71 | .. image:: ../_static/T_tensor.png
72 | :height: 100px
73 |
74 |
75 | Other tutorials
76 | ---------------
77 |
78 | .. toctree::
79 | :maxdepth: 1
80 |
81 | Transfer Seurat object into Anndata object
82 | Visualization of Nanostring DSP subtissues
83 | Spatial communication - cell level
84 |
--------------------------------------------------------------------------------
/build/_sources/index.rst.txt:
--------------------------------------------------------------------------------
1 | .. soapy documentation master file, created by
2 | sphinx-quickstart on Sun Dec 3 22:27:33 2023.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 |
7 | SOAPy - Spatial Omics Analysis in Python
8 | ====================================================
9 |
10 | |PyPI| |PyPIDownloads| |Docs|
11 |
12 | .. |PyPI| image:: https://img.shields.io/pypi/v/SOAPy_st?logo=PyPI
13 | :target: https://pypi.org/project/SOAPy_st
14 | .. |PyPIDownloads| image:: https://pepy.tech/badge/SOAPy_st
15 | :target: https://pepy.tech/project/SOAPy_st
16 |
17 |
18 |
19 | **SOAPy** is an integrated toolkit that focuses on addressing spatial heterogeneity. SOAPy contains four data
20 | preprocessing modules (“Data Import”, “spatial network”, and “Spatial Domain”), three modules for analyzing spatial
21 | expression patterns of genes (“Spatial Variation”, “Spatial Tendency”, and “Spatiotemporal Pattern”), two modules
22 | for analyzing the spatial architecture of cells (“Spatial Proximity”, “Spatial Composition”), and two module for
23 | analyzing Spatial Communication.
24 |
25 |
26 | .. image:: ./_static/Overview.png
27 | :alt: Title figure
28 | :width: 700px
29 | :align: center
30 |
31 | .. toctree::
32 | :maxdepth: 2
33 | :caption: Contents:
34 |
35 | Installation
36 | Tutorials/index
37 | Api/index
38 | Release_notes
39 | References
40 |
41 |
42 | Indices and tables
43 | ==================
44 |
45 | * :ref:`genindex`
46 | * :ref:`modindex`
47 | * :ref:`search`
48 |
--------------------------------------------------------------------------------
/build/_static/Overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/Overview.png
--------------------------------------------------------------------------------
/build/_static/T_DSP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/T_DSP.png
--------------------------------------------------------------------------------
/build/_static/T_cell_proximal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/T_cell_proximal.png
--------------------------------------------------------------------------------
/build/_static/T_communication.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/T_communication.png
--------------------------------------------------------------------------------
/build/_static/T_domain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/T_domain.png
--------------------------------------------------------------------------------
/build/_static/T_niche.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/T_niche.png
--------------------------------------------------------------------------------
/build/_static/T_read.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/T_read.png
--------------------------------------------------------------------------------
/build/_static/T_tendency.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/T_tendency.png
--------------------------------------------------------------------------------
/build/_static/T_tensor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/T_tensor.png
--------------------------------------------------------------------------------
/build/_static/css/badge_only.css:
--------------------------------------------------------------------------------
1 | .clearfix{*zoom:1}.clearfix:after,.clearfix:before{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-style:normal;font-weight:400;src:url(fonts/fontawesome-webfont.eot?674f50d287a8c48dc19ba404d20fe713?#iefix) format("embedded-opentype"),url(fonts/fontawesome-webfont.woff2?af7ae505a9eed503f8b8e6982036873e) format("woff2"),url(fonts/fontawesome-webfont.woff?fee66e712a8a08eef5805a46892932ad) format("woff"),url(fonts/fontawesome-webfont.ttf?b06871f281fee6b241d60582ae9369b9) format("truetype"),url(fonts/fontawesome-webfont.svg?912ec66d7572ff821749319396470bde#FontAwesome) format("svg")}.fa:before{font-family:FontAwesome;font-style:normal;font-weight:400;line-height:1}.fa:before,a .fa{text-decoration:inherit}.fa:before,a .fa,li .fa{display:inline-block}li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-.8em}ul.fas li .fa{width:.8em}ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before,.icon-book:before{content:"\f02d"}.fa-caret-down:before,.icon-caret-down:before{content:"\f0d7"}.fa-caret-up:before,.icon-caret-up:before{content:"\f0d8"}.fa-caret-left:before,.icon-caret-left:before{content:"\f0d9"}.fa-caret-right:before,.icon-caret-right:before{content:"\f0da"}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;font-family:Lato,proxima-nova,Helvetica Neue,Arial,sans-serif;z-index:400}.rst-versions a{color:#2980b9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27ae60}.rst-versions .rst-current-version:after{clear:both;content:"";display:block}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book,.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#e74c3c;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#f1c40f;color:#000}.rst-versions.shift-up{height:auto;max-height:100%;overflow-y:scroll}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:grey;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:1px solid #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px;max-height:90%}.rst-versions.rst-badge .fa-book,.rst-versions.rst-badge .icon-book{float:none;line-height:30px}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book,.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge>.rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width:768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}}
--------------------------------------------------------------------------------
/build/_static/css/fonts/Roboto-Slab-Bold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/Roboto-Slab-Bold.woff
--------------------------------------------------------------------------------
/build/_static/css/fonts/Roboto-Slab-Bold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/Roboto-Slab-Bold.woff2
--------------------------------------------------------------------------------
/build/_static/css/fonts/Roboto-Slab-Regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/Roboto-Slab-Regular.woff
--------------------------------------------------------------------------------
/build/_static/css/fonts/Roboto-Slab-Regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/Roboto-Slab-Regular.woff2
--------------------------------------------------------------------------------
/build/_static/css/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/build/_static/css/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/build/_static/css/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/build/_static/css/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/build/_static/css/fonts/lato-bold-italic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/lato-bold-italic.woff
--------------------------------------------------------------------------------
/build/_static/css/fonts/lato-bold-italic.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/lato-bold-italic.woff2
--------------------------------------------------------------------------------
/build/_static/css/fonts/lato-bold.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/lato-bold.woff
--------------------------------------------------------------------------------
/build/_static/css/fonts/lato-bold.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/lato-bold.woff2
--------------------------------------------------------------------------------
/build/_static/css/fonts/lato-normal-italic.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/lato-normal-italic.woff
--------------------------------------------------------------------------------
/build/_static/css/fonts/lato-normal-italic.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/lato-normal-italic.woff2
--------------------------------------------------------------------------------
/build/_static/css/fonts/lato-normal.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/lato-normal.woff
--------------------------------------------------------------------------------
/build/_static/css/fonts/lato-normal.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/css/fonts/lato-normal.woff2
--------------------------------------------------------------------------------
/build/_static/documentation_options.js:
--------------------------------------------------------------------------------
1 | const DOCUMENTATION_OPTIONS = {
2 | VERSION: '0.1.4',
3 | LANGUAGE: 'en',
4 | COLLAPSE_INDEX: false,
5 | BUILDER: 'html',
6 | FILE_SUFFIX: '.html',
7 | LINK_SUFFIX: '.html',
8 | HAS_SOURCE: true,
9 | SOURCELINK_SUFFIX: '.txt',
10 | NAVIGATION_WITH_KEYS: false,
11 | SHOW_SEARCH_SUMMARY: true,
12 | ENABLE_SEARCH_SHORTCUTS: true,
13 | };
--------------------------------------------------------------------------------
/build/_static/file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/file.png
--------------------------------------------------------------------------------
/build/_static/js/badge_only.js:
--------------------------------------------------------------------------------
1 | !function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=4)}({4:function(e,t,r){}});
--------------------------------------------------------------------------------
/build/_static/js/html5shiv-printshiv.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @preserve HTML5 Shiv 3.7.3-pre | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
3 | */
4 | !function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=y.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=y.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),y.elements=c+" "+a,j(b)}function f(a){var b=x[a[v]];return b||(b={},w++,a[v]=w,x[w]=b),b}function g(a,c,d){if(c||(c=b),q)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():u.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||t.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),q)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return y.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(y,b.frag)}function j(a){a||(a=b);var d=f(a);return!y.shivCSS||p||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),q||i(a,d),a}function k(a){for(var b,c=a.getElementsByTagName("*"),e=c.length,f=RegExp("^(?:"+d().join("|")+")$","i"),g=[];e--;)b=c[e],f.test(b.nodeName)&&g.push(b.applyElement(l(b)));return g}function l(a){for(var b,c=a.attributes,d=c.length,e=a.ownerDocument.createElement(A+":"+a.nodeName);d--;)b=c[d],b.specified&&e.setAttribute(b.nodeName,b.nodeValue);return e.style.cssText=a.style.cssText,e}function m(a){for(var b,c=a.split("{"),e=c.length,f=RegExp("(^|[\\s,>+~])("+d().join("|")+")(?=[[\\s,>+~#.:]|$)","gi"),g="$1"+A+"\\:$2";e--;)b=c[e]=c[e].split("}"),b[b.length-1]=b[b.length-1].replace(f,g),c[e]=b.join("}");return c.join("{")}function n(a){for(var b=a.length;b--;)a[b].removeNode()}function o(a){function b(){clearTimeout(g._removeSheetTimer),d&&d.removeNode(!0),d=null}var d,e,g=f(a),h=a.namespaces,i=a.parentWindow;return!B||a.printShived?a:("undefined"==typeof h[A]&&h.add(A),i.attachEvent("onbeforeprint",function(){b();for(var f,g,h,i=a.styleSheets,j=[],l=i.length,n=Array(l);l--;)n[l]=i[l];for(;h=n.pop();)if(!h.disabled&&z.test(h.media)){try{f=h.imports,g=f.length}catch(o){g=0}for(l=0;g>l;l++)n.push(f[l]);try{j.push(h.cssText)}catch(o){}}j=m(j.reverse().join("")),e=k(a),d=c(a,j)}),i.attachEvent("onafterprint",function(){n(e),clearTimeout(g._removeSheetTimer),g._removeSheetTimer=setTimeout(b,500)}),a.printShived=!0,a)}var p,q,r="3.7.3",s=a.html5||{},t=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,u=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,v="_html5shiv",w=0,x={};!function(){try{var a=b.createElement("a");a.innerHTML="",p="hidden"in a,q=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){p=!0,q=!0}}();var y={elements:s.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:r,shivCSS:s.shivCSS!==!1,supportsUnknownElements:q,shivMethods:s.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=y,j(b);var z=/^$|\b(?:all|print)\b/,A="html5shiv",B=!q&&function(){var c=b.documentElement;return!("undefined"==typeof b.namespaces||"undefined"==typeof b.parentWindow||"undefined"==typeof c.applyElement||"undefined"==typeof c.removeNode||"undefined"==typeof a.attachEvent)}();y.type+=" print",y.shivPrint=o,o(b),"object"==typeof module&&module.exports&&(module.exports=y)}("undefined"!=typeof window?window:this,document);
--------------------------------------------------------------------------------
/build/_static/js/html5shiv.min.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @preserve HTML5 Shiv 3.7.3 | @afarkas @jdalton @jon_neal @rem | MIT/GPL2 Licensed
3 | */
4 | !function(a,b){function c(a,b){var c=a.createElement("p"),d=a.getElementsByTagName("head")[0]||a.documentElement;return c.innerHTML="x",d.insertBefore(c.lastChild,d.firstChild)}function d(){var a=t.elements;return"string"==typeof a?a.split(" "):a}function e(a,b){var c=t.elements;"string"!=typeof c&&(c=c.join(" ")),"string"!=typeof a&&(a=a.join(" ")),t.elements=c+" "+a,j(b)}function f(a){var b=s[a[q]];return b||(b={},r++,a[q]=r,s[r]=b),b}function g(a,c,d){if(c||(c=b),l)return c.createElement(a);d||(d=f(c));var e;return e=d.cache[a]?d.cache[a].cloneNode():p.test(a)?(d.cache[a]=d.createElem(a)).cloneNode():d.createElem(a),!e.canHaveChildren||o.test(a)||e.tagUrn?e:d.frag.appendChild(e)}function h(a,c){if(a||(a=b),l)return a.createDocumentFragment();c=c||f(a);for(var e=c.frag.cloneNode(),g=0,h=d(),i=h.length;i>g;g++)e.createElement(h[g]);return e}function i(a,b){b.cache||(b.cache={},b.createElem=a.createElement,b.createFrag=a.createDocumentFragment,b.frag=b.createFrag()),a.createElement=function(c){return t.shivMethods?g(c,a,b):b.createElem(c)},a.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+d().join().replace(/[\w\-:]+/g,function(a){return b.createElem(a),b.frag.createElement(a),'c("'+a+'")'})+");return n}")(t,b.frag)}function j(a){a||(a=b);var d=f(a);return!t.shivCSS||k||d.hasCSS||(d.hasCSS=!!c(a,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{display:block}mark{background:#FF0;color:#000}template{display:none}")),l||i(a,d),a}var k,l,m="3.7.3-pre",n=a.html5||{},o=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,q="_html5shiv",r=0,s={};!function(){try{var a=b.createElement("a");a.innerHTML="",k="hidden"in a,l=1==a.childNodes.length||function(){b.createElement("a");var a=b.createDocumentFragment();return"undefined"==typeof a.cloneNode||"undefined"==typeof a.createDocumentFragment||"undefined"==typeof a.createElement}()}catch(c){k=!0,l=!0}}();var t={elements:n.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output picture progress section summary template time video",version:m,shivCSS:n.shivCSS!==!1,supportsUnknownElements:l,shivMethods:n.shivMethods!==!1,type:"default",shivDocument:j,createElement:g,createDocumentFragment:h,addElements:e};a.html5=t,j(b),"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:this,document);
--------------------------------------------------------------------------------
/build/_static/logo_soapy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/logo_soapy.png
--------------------------------------------------------------------------------
/build/_static/minus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/minus.png
--------------------------------------------------------------------------------
/build/_static/nbsphinx-broken-thumbnail.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/build/_static/nbsphinx-gallery.css:
--------------------------------------------------------------------------------
1 | .nbsphinx-gallery {
2 | display: grid;
3 | grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
4 | gap: 5px;
5 | margin-top: 1em;
6 | margin-bottom: 1em;
7 | }
8 |
9 | .nbsphinx-gallery > a {
10 | padding: 5px;
11 | border: 1px dotted currentColor;
12 | border-radius: 2px;
13 | text-align: center;
14 | }
15 |
16 | .nbsphinx-gallery > a:hover {
17 | border-style: solid;
18 | }
19 |
20 | .nbsphinx-gallery img {
21 | max-width: 100%;
22 | max-height: 100%;
23 | }
24 |
25 | .nbsphinx-gallery > a > div:first-child {
26 | display: flex;
27 | align-items: start;
28 | justify-content: center;
29 | height: 120px;
30 | margin-bottom: 5px;
31 | }
32 |
--------------------------------------------------------------------------------
/build/_static/nbsphinx-no-thumbnail.svg:
--------------------------------------------------------------------------------
1 |
10 |
--------------------------------------------------------------------------------
/build/_static/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/_static/plus.png
--------------------------------------------------------------------------------
/build/lib/SOAPy_st/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding:utf-8 -*-
3 | from . import pp
4 | from . import tl
5 | from . import pl
6 |
7 | __version__ = "v0.1.0"
8 |
9 | """
10 | # Author: Lihong lab
11 | # File Name:SOAPy-st
12 | # github:https://github.com/LiHongCSBLab/SOAPy
13 | # Description:
14 | """
15 |
16 | __author__ = "Cancer system biology lab"
17 | __email__ = [
18 | "wangheqi2021@sinh.ac.cn"
19 | "lijiarong2020@sinh.ac.cn"
20 | "lihong01@sibs.ac.cn"
21 | ]
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/build/lib/SOAPy_st/_compat.py:
--------------------------------------------------------------------------------
1 | try:
2 | from typing import Literal
3 | except ImportError:
4 | try:
5 | from typing_extensions import Literal
6 | except ImportError:
7 |
8 | class LiteralMeta(type):
9 | def __getitem__(cls, values):
10 | if not isinstance(values, tuple):
11 | values = (values,)
12 | return type("Literal_", (Literal,), dict(__args__=values))
13 |
14 | class Literal(metaclass=LiteralMeta):
15 | pass
--------------------------------------------------------------------------------
/build/lib/SOAPy_st/_docs.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/lib/SOAPy_st/_docs.py
--------------------------------------------------------------------------------
/build/lib/SOAPy_st/_metadata.py:
--------------------------------------------------------------------------------
1 | import traceback
2 | from pathlib import Path
3 |
4 | here = Path(__file__).parent
5 |
6 |
7 | def refresh_entry_points():
8 | """\
9 | Under some circumstances, (e.g. when installing a PEP 517 package via pip),
10 | pkg_resources.working_set.entries is stale. This tries to fix that.
11 | See https://github.com/pypa/setuptools_scm/issues/513
12 | """
13 | try:
14 | import sys
15 | import pkg_resources
16 |
17 | ws: pkg_resources.WorkingSet = pkg_resources.working_set
18 | for entry in sys.path:
19 | ws.add_entry(entry)
20 | except Exception:
21 | pass
22 |
23 |
24 | try:
25 | from setuptools_scm import get_version
26 |
27 | refresh_entry_points()
28 | __version__ = get_version(root='..', relative_to=__file__)
29 | except (ImportError, LookupError, FileNotFoundError):
30 | from ._compat import pkg_metadata
31 |
32 | metadata = pkg_metadata(here.name)
33 | __version__ = metadata['Version']
34 |
35 |
36 | def within_flit():
37 | """\
38 | Checks if we are being imported by flit.
39 | This is necessary so flit can import __version__ without all depedencies installed.
40 | There are a few options to make this hack unnecessary, see:
41 | https://github.com/takluyver/flit/issues/253#issuecomment-737870438
42 | """
43 | for frame in traceback.extract_stack():
44 | if frame.name == 'get_docstring_and_version_via_import':
45 | return True
46 | return False
--------------------------------------------------------------------------------
/build/lib/SOAPy_st/pl/__init__.py:
--------------------------------------------------------------------------------
1 | from ._show import show_moran_scatterplot, show_network, show_voronoi
2 | from ._tendency import show_tendency, show_curves_cluster, show_box_plot
3 | from ._neighborhood import show_neighborhood_analysis, show_infiltration_analysis
4 | from ._ccc import show_ccc_netplot, show_ccc_chordplot, show_ccc_dotplot, show_ccc_embedding
5 | from ._niche import show_niche_environment, show_niche_sample_heatmap, show_celltype_niche_heatmap, \
6 | show_celltype_sample_heatmap
7 | from ._tensor import show_factor_matrix_in_CP_tensor, show_factor_matrix_in_tucker_tensor, show_proportion_in_tucker, \
8 | show_proportion_in_CP
9 |
--------------------------------------------------------------------------------
/build/lib/SOAPy_st/pl/_color.py:
--------------------------------------------------------------------------------
1 | # define color list in SOAPy
2 | from typing import Sequence, Union
3 | from matplotlib.colors import ListedColormap
4 |
5 | # default palette
6 | # 10 color
7 | color_list_10 = [
8 | "#765005", "#0780cf", "#fa6d1d", "#0e2c82", "#b6b51f",
9 | "#da1f18", "#701866", "#f47a75", "#009db2", "#024b51"
10 | ]
11 |
12 | # 50 color
13 | color_list_50 = [
14 | '#5050FFFF', '#CE3D32FF', '#749B58FF', '#F0E685FF', '#466983FF', '#BA6338FF', '#5DB1DDFF',
15 | '#802268FF', '#6BD76BFF', '#D595A7FF', '#924822FF', '#837B8DFF', '#C75127FF', '#D58F5CFF',
16 | '#7A65A5FF', '#E4AF69FF', '#3B1B53FF', '#CDDEB7FF', '#612A79FF', '#AE1F63FF', '#E7C76FFF',
17 | '#5A655EFF', '#CC9900FF', '#99CC00FF', '#A9A9A9FF', '#CC9900FF', '#99CC00FF', '#00D68FFF',
18 | '#14FFB1FF', '#00CC99FF', '#0099CCFF', '#0A47FFFF', '#4775FFFF', '#FFC20AFF', '#FFD147FF',
19 | '#990033FF', '#991A00FF', '#996600FF', '#809900FF', '#339900FF', '#00991AFF', '#009966FF',
20 | '#008099FF', '#003399FF', '#1A0099FF', '#660099FF', '#990080FF', '#D60047FF', '#FF1463FF',
21 | '#00D68FFF'
22 | ]
23 |
24 | # default colorbar
25 | cmap_default = 'parula'
26 |
27 |
28 | def _get_palette(categorical, sort_order: bool = True, palette: Union[Sequence, ListedColormap] = None) -> dict:
29 | are_all_str = all(map(lambda x: isinstance(x, str), categorical))
30 | if not are_all_str:
31 | categorical = str(categorical)
32 |
33 | if sort_order:
34 | categorical = sorted(categorical)
35 |
36 | if palette is None:
37 | if len(categorical) <= 10:
38 | palette = color_list_10
39 | else:
40 | palette = color_list_50
41 |
42 | if isinstance(palette, ListedColormap):
43 | palette = palette.colors
44 |
45 | palette = palette[0: len(categorical)]
46 | palette = dict(zip(categorical, palette))
47 | return palette
--------------------------------------------------------------------------------
/build/lib/SOAPy_st/pp/__init__.py:
--------------------------------------------------------------------------------
1 | from .all2adata import read_csv2adata, read_mult_image2adata, read_visium2adata, read_dsp2adata, st_Seurat2Anndata
2 | from .build_network import make_network
3 |
--------------------------------------------------------------------------------
/build/lib/SOAPy_st/pp/utils.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import numba as nb
3 | import pandas as pd
4 | from anndata import AnnData
5 | from typing import Union, Optional, Tuple
6 |
7 |
8 | @nb.jit
9 | def _filter_of_graph(obs: pd.DataFrame,
10 | indices: np.ndarray,
11 | distances: np.ndarray,
12 | cluster_label: str,
13 | exclude: Union[str, dict]) -> Tuple[np.ndarray, np.ndarray]:
14 | """
15 | Select the edges as 'exclude'
16 |
17 | Returns
18 | -------
19 | anndata.Anndata object.
20 |
21 | """
22 | if type(exclude) == str:
23 | assert exclude in ['same', 'different']
24 | if type(exclude) == dict:
25 | exclude = [(i, j) for i, j in zip(exclude.keys(), exclude.values())] + \
26 | [(j, i) for i, j in zip(exclude.keys(), exclude.values())]
27 |
28 | for i, neigh in enumerate(indices):
29 | point_1 = neigh[0]
30 | index_point1 = obs.index[point_1]
31 | for j, point_2 in enumerate(neigh):
32 | if j == 0:
33 | continue
34 | index_point2 = obs.index[point_2]
35 | if exclude == 'same' and \
36 | obs.loc[index_point1, cluster_label] == obs.loc[index_point2, cluster_label]:
37 | distances[i][j] = -1
38 | indices[i][j] = -1
39 | continue
40 | if exclude == 'different' and \
41 | obs.loc[index_point1, cluster_label] != obs.loc[index_point2, cluster_label]:
42 | distances[i][j] = -1
43 | indices[i][j] = -1
44 | continue
45 | if type(exclude) == dict and \
46 | (obs.loc[index_point1, cluster_label], obs.loc[index_point2, cluster_label]) in exclude:
47 | distances[i][j] = -1
48 | indices[i][j] = -1
49 | distances[i] = distances[i][distances[i] >= 0]
50 | indices[i] = indices[i][indices[i] >= 0]
51 |
52 | return indices, distances
53 |
54 |
55 | def _preprocessing_of_graph(clu_value: np.ndarray,
56 | indices: np.ndarray,
57 | distances: np.ndarray,
58 | ) -> pd.DataFrame:
59 | """
60 | get information of edges
61 | """
62 | edges = []
63 |
64 | for index, neigh in enumerate(indices):
65 | if len(neigh) == 0:
66 | continue
67 | for index_2, point_2 in enumerate(neigh):
68 | if point_2 == index | point_2 == -1:
69 | continue
70 | elif point_2 < index:
71 | edge = [point_2, index,
72 | clu_value[point_2],
73 | clu_value[index],
74 | distances[index][index_2]]
75 | edges.append(edge)
76 |
77 | elif point_2 > index:
78 | edge = [index, point_2,
79 | clu_value[index],
80 | clu_value[point_2],
81 | distances[index][index_2]]
82 | edges.append(edge)
83 |
84 | df_edge = pd.DataFrame(data=np.array(edges), columns=['point_1', 'point_2',
85 | 'cluster_1', 'cluster_2', 'distance'])
86 |
87 | df_edge.drop_duplicates(subset=['point_1', 'point_2'], inplace=True)
88 | return df_edge
89 |
--------------------------------------------------------------------------------
/build/lib/SOAPy_st/tl/__init__.py:
--------------------------------------------------------------------------------
1 | from ._mask import get_mask_from_domain
2 | from ._domain import domain_from_STAGATE, global_moran, cal_aucell, domain_from_local_moran
3 | from ._var_genes import cal_spatialDE, cal_sparkX, cal_spark
4 | from ._tendency import adata_from_mask, wilcoxon_test, spearman_correlation, ANOVA, spatial_tendency, gene_cluster
5 | from ._interaction import neighborhood_analysis, infiltration_analysis, get_c_niche
6 | from ._ccc import cell_level_communications, cell_type_level_communication, lr_pairs
7 | from ._tensor import TensorDecomposition
8 |
9 |
--------------------------------------------------------------------------------
/build/objects.inv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/build/objects.inv
--------------------------------------------------------------------------------
/logo_soapy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/logo_soapy.png
--------------------------------------------------------------------------------
/make.bat:
--------------------------------------------------------------------------------
1 | @ECHO OFF
2 |
3 | pushd %~dp0
4 |
5 | REM Command file for Sphinx documentation
6 |
7 | if "%SPHINXBUILD%" == "" (
8 | set SPHINXBUILD=sphinx-build
9 | )
10 | set SOURCEDIR=source
11 | set BUILDDIR=build
12 |
13 | %SPHINXBUILD% >NUL 2>NUL
14 | if errorlevel 9009 (
15 | echo.
16 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17 | echo.installed, then set the SPHINXBUILD environment variable to point
18 | echo.to the full path of the 'sphinx-build' executable. Alternatively you
19 | echo.may add the Sphinx directory to PATH.
20 | echo.
21 | echo.If you don't have Sphinx installed, grab it from
22 | echo.https://www.sphinx-doc.org/
23 | exit /b 1
24 | )
25 |
26 | if "%1" == "" goto help
27 |
28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29 | goto end
30 |
31 | :help
32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33 |
34 | :end
35 | popd
36 |
--------------------------------------------------------------------------------
/pipeline.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/pipeline.png
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | anndata==0.9.1
2 | ctxcore==0.2.0
3 | esda==2.4.3
4 | geopandas==0.14.3
5 | libpysal==4.8.1
6 | networkx==2.8.6
7 | numba==0.60.0
8 | opencv-python==4.8.1.78
9 | pyscenic==0.12.1
10 | s-dbw==0.4.0
11 | shapely==2.0.3
12 | scanpy==1.10.3
13 | scikit-image==0.19.3
14 | scikit-learn==1.1.2
15 | scikit-misc==0.3.1
16 | scipy==1.13.1
17 | seaborn==0.13.2
18 | statsmodels==0.13.2
19 | tensorly==0.8.1
20 | torch==1.12.0
21 | torch_geometric==2.6.1
22 | torch-cluster==1.6.0
23 | torch-scatter==2.1.0
24 | torch-sparse==0.6.16
25 | torch-spline-conv==1.2.1
26 | torchaudio==0.12.0
27 | torchvision==0.13.0
28 | matplotlib
29 | numpy
30 | pandas
31 | tqdm
32 |
--------------------------------------------------------------------------------
/setup.cfg:
--------------------------------------------------------------------------------
1 |
2 | [metadata]
3 | name = SOAPy
4 | py_modules =
5 | SOAPy
6 | version = 1.0.0
7 | author = Heqi Wang
8 | author_email = wangheqi2021@sinh.ac.cn
9 | description = Spatial Omics Analysis in Python
10 | long_description = file: Readme.md
11 | license = AGPL-3.0
12 | url = https://github.com/user/repo
13 | python_requires = >=3.7
14 | classifiers =
15 | Development Status :: 3 - Alpha
16 | Intended Audience :: Developers
17 | Natural Language :: English
18 | Programming Language :: Python :: 3
19 |
20 | [options]
21 | packages = find:
22 | install_requires =
23 | requests
24 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | import setuptools
2 | from pathlib import Path
3 |
4 | with open("README.md", encoding="utf8") as readme_file:
5 | readme = readme_file.read()
6 |
7 | with open("requirements.txt") as f:
8 | requirements = f.read().splitlines()
9 |
10 | setuptools.setup(
11 | name='SOAPy-st',
12 | version='1.0.1',
13 | author='Cancer system biology lab',
14 | author_email='wangheqi2021@sinh.ac.cn',
15 | description='Spatial Omics Analysis in Python',
16 | long_description=readme,
17 | long_description_content_type='text/markdown',
18 | url='https://github.com/LiHongCSBLab/SOAPy',
19 | python_requires='>=3.9',
20 | classifiers=[
21 | 'Development Status :: 3 - Alpha',
22 | 'Intended Audience :: Developers',
23 | 'Natural Language :: English',
24 | 'Programming Language :: Python :: 3'],
25 | keywords=sorted(
26 | [
27 | "bio-informatics",
28 | "spatial omics",
29 | "spatial transcriptomics",
30 | "spatial data analysis",
31 | ]),
32 | packages=setuptools.find_packages(include=["SOAPy-st", "SOAPy-st.*"]),
33 | install_requires=requirements
34 | )
35 |
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_box_plot.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_box\_plot
2 | ============================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_box_plot
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_ccc_chordplot.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_ccc\_chordplot
2 | =================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_ccc_chordplot
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_ccc_dotplot.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_ccc\_dotplot
2 | ===============================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_ccc_dotplot
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_ccc_embedding.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_ccc\_embedding
2 | =================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_ccc_embedding
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_ccc_netplot.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_ccc\_netplot
2 | ===============================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_ccc_netplot
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_celltype_niche_heatmap.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_celltype\_niche\_heatmap
2 | ===========================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_celltype_niche_heatmap
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_celltype_sample_heatmap.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_celltype\_sample\_heatmap
2 | ============================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_celltype_sample_heatmap
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_curves_cluster.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_curves\_cluster
2 | ==================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_curves_cluster
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_factor_matrix_in_CP_tensor.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_factor\_matrix\_in\_CP\_tensor
2 | =================================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_factor_matrix_in_CP_tensor
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_factor_matrix_in_tucker_tensor.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_factor\_matrix\_in\_tucker\_tensor
2 | =====================================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_factor_matrix_in_tucker_tensor
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_infiltration_analysis.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_infiltration\_analysis
2 | =========================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_infiltration_analysis
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_moran_scatterplot.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_moran\_scatterplot
2 | =====================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_moran_scatterplot
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_neighborhood_analysis.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_neighborhood\_analysis
2 | =========================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_neighborhood_analysis
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_network.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_network
2 | ==========================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_network
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_niche_environment.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_niche\_environment
2 | =====================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_niche_environment
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_niche_sample_heatmap.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_niche\_sample\_heatmap
2 | =========================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_niche_sample_heatmap
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_proportion_in_CP.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_proportion\_in\_CP
2 | =====================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_proportion_in_CP
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_proportion_in_tucker.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_proportion\_in\_tucker
2 | =========================================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_proportion_in_tucker
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_tendency.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_tendency
2 | ===========================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_tendency
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pl.show_voronoi.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pl.show\_voronoi
2 | ==========================
3 |
4 | .. currentmodule:: SOAPy_st.pl
5 |
6 | .. autofunction:: show_voronoi
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pp.make_network.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pp.make\_network
2 | ==========================
3 |
4 | .. currentmodule:: SOAPy_st.pp
5 |
6 | .. autofunction:: make_network
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pp.read_csv2adata.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pp.read\_csv2adata
2 | ============================
3 |
4 | .. currentmodule:: SOAPy_st.pp
5 |
6 | .. autofunction:: read_csv2adata
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pp.read_dsp2adata.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pp.read\_dsp2adata
2 | ============================
3 |
4 | .. currentmodule:: SOAPy_st.pp
5 |
6 | .. autofunction:: read_dsp2adata
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pp.read_mult_image2adata.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pp.read\_mult\_image2adata
2 | ====================================
3 |
4 | .. currentmodule:: SOAPy_st.pp
5 |
6 | .. autofunction:: read_mult_image2adata
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pp.read_visium2adata.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pp.read\_visium2adata
2 | ===============================
3 |
4 | .. currentmodule:: SOAPy_st.pp
5 |
6 | .. autofunction:: read_visium2adata
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.pp.st_Seurat2Anndata.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.pp.st\_Seurat2Anndata
2 | ===============================
3 |
4 | .. currentmodule:: SOAPy_st.pp
5 |
6 | .. autofunction:: st_Seurat2Anndata
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.ANOVA.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.ANOVA
2 | ==================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: ANOVA
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.TensorDecomposition.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.TensorDecomposition
2 | ================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autoclass:: TensorDecomposition
7 |
8 |
9 | .. automethod:: __init__
10 |
11 |
12 | .. rubric:: Methods
13 |
14 | .. autosummary::
15 |
16 | ~TensorDecomposition.CP_decomposition
17 | ~TensorDecomposition.__init__
18 | ~TensorDecomposition.highly_variable
19 | ~TensorDecomposition.input_tensor
20 | ~TensorDecomposition.normalization
21 | ~TensorDecomposition.tensor_with_gene
22 | ~TensorDecomposition.tensor_with_obs
23 | ~TensorDecomposition.tucker_decomposition
24 |
25 |
26 |
27 |
28 |
29 | .. rubric:: Attributes
30 |
31 | .. autosummary::
32 |
33 | ~TensorDecomposition.get_tensor
34 |
35 |
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.adata_from_mask.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.adata\_from\_mask
2 | ==============================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: adata_from_mask
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.cal_aucell.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.cal\_aucell
2 | ========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: cal_aucell
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.cal_spark.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.cal\_spark
2 | =======================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: cal_spark
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.cal_sparkX.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.cal\_sparkX
2 | ========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: cal_sparkX
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.cal_spatialDE.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.cal\_spatialDE
2 | ===========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: cal_spatialDE
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.cell_level_communications.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.cell\_level\_communications
2 | ========================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: cell_level_communications
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.cell_type_level_communication.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.cell\_type\_level\_communication
2 | =============================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: cell_type_level_communication
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.domain_from_local_moran.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.domain\_from\_local\_moran
2 | =======================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: domain_from_local_moran
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.domain_from_unsupervised.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.domain\_from\_unsupervised
2 | =======================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: domain_from_unsupervised
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.gene_cluster.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.gene\_cluster
2 | ==========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: gene_cluster
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.get_c_niche.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.get\_c\_niche
2 | ==========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: get_c_niche
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.get_mask_from_domain.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.get\_mask\_from\_domain
2 | ====================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: get_mask_from_domain
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.global_moran.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.global\_moran
2 | ==========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: global_moran
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.infiltration_analysis.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.infiltration\_analysis
2 | ===================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: infiltration_analysis
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.lr_pairs.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.lr\_pairs
2 | ======================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autoclass:: lr_pairs
7 |
8 |
9 | .. automethod:: __init__
10 |
11 |
12 | .. rubric:: Methods
13 |
14 | .. autosummary::
15 |
16 | ~lr_pairs.__init__
17 | ~lr_pairs.get_complexes
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.neighborhood_analysis.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.neighborhood\_analysis
2 | ===================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: neighborhood_analysis
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.spatial_tendency.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.spatial\_tendency
2 | ==============================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: spatial_tendency
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.spearman_correlation.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.spearman\_correlation
2 | ==================================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: spearman_correlation
--------------------------------------------------------------------------------
/source/Api/SOAPy_st.tl.wilcoxon_test.rst:
--------------------------------------------------------------------------------
1 | SOAPy\_st.tl.wilcoxon\_test
2 | ===========================
3 |
4 | .. currentmodule:: SOAPy_st.tl
5 |
6 | .. autofunction:: wilcoxon_test
--------------------------------------------------------------------------------
/source/Api/index.rst:
--------------------------------------------------------------------------------
1 |
2 | API
3 | ===
4 |
5 | Import SOAPy :
6 |
7 | import SOAPy_st as sp
8 |
9 | .. toctree::
10 | :maxdepth: 1
11 |
12 | preprocessing
13 |
14 | This module includes data reading and network construction.
15 |
16 |
17 | .. toctree::
18 | :maxdepth: 1
19 |
20 | tool
21 |
22 | The main analysis function module.
23 |
24 |
25 | .. toctree::
26 | :maxdepth: 1
27 |
28 | plot
29 |
30 | Visualization module.
31 |
--------------------------------------------------------------------------------
/source/Api/plot.rst:
--------------------------------------------------------------------------------
1 | .. module:: SOAPy_st
2 | .. automodule:: SOAPy_st
3 | :noindex:
4 |
5 | pl
6 | ============================
7 |
8 | Spatial network
9 | ------------------------------
10 |
11 | .. module:: SOAPy_st.pl
12 | .. currentmodule:: SOAPy_st
13 |
14 | .. autosummary::
15 | :toctree: .
16 |
17 | pl.show_network
18 | pl.show_voronoi
19 |
20 | Spatial domain
21 | -------------------
22 |
23 | .. module:: SOAPy_st.pl
24 | .. currentmodule:: SOAPy_st
25 |
26 | .. autosummary::
27 | :toctree: .
28 |
29 | pl.show_moran_scatterplot
30 |
31 |
32 | Spatial tendency
33 | -------------------
34 |
35 | .. module:: SOAPy_st.pl
36 | .. currentmodule:: SOAPy_st
37 |
38 | .. autosummary::
39 | :toctree: .
40 |
41 | pl.show_tendency
42 | pl.show_curves_cluster
43 | pl.show_box_plot
44 |
45 |
46 | Cell type proximity
47 | -------------------
48 |
49 | .. module:: SOAPy_st.pl
50 | .. currentmodule:: SOAPy_st
51 |
52 | .. autosummary::
53 | :toctree: .
54 |
55 | pl.show_neighborhood_analysis
56 | pl.show_infiltration_analysis
57 |
58 |
59 | Niche composition
60 | -----------------
61 |
62 | .. module:: SOAPy_st.pl
63 | .. currentmodule:: SOAPy_st
64 |
65 | .. autosummary::
66 | :toctree: .
67 |
68 | pl.show_niche_environment
69 | pl.show_niche_sample_heatmap
70 | pl.show_celltype_niche_heatmap
71 | pl.show_celltype_sample_heatmap
72 |
73 |
74 | Spatial communication
75 | ---------------------
76 |
77 | .. module:: SOAPy_st.pl
78 | .. currentmodule:: SOAPy_st
79 |
80 | .. autosummary::
81 | :toctree: .
82 |
83 | pl.show_ccc_netplot
84 | pl.show_ccc_dotplot
85 | pl.show_ccc_chordplot
86 | pl.show_ccc_embedding
87 |
88 |
89 | Tensor decomposition
90 | ---------------------
91 |
92 | .. module:: SOAPy_st.pl
93 | .. currentmodule:: SOAPy_st
94 |
95 | .. autosummary::
96 | :toctree: .
97 |
98 | pl.show_factor_matrix_in_CP_tensor
99 | pl.show_factor_matrix_in_tucker_tensor
100 | pl.show_proportion_in_tucker
101 | pl.show_proportion_in_CP
--------------------------------------------------------------------------------
/source/Api/preprocessing.rst:
--------------------------------------------------------------------------------
1 | .. module:: SOAPy_st
2 | .. automodule:: SOAPy_st
3 | :noindex:
4 |
5 | pp
6 | ============================
7 |
8 | Read
9 | -----
10 |
11 | .. module:: SOAPy_st.pp
12 | .. currentmodule:: SOAPy_st
13 |
14 | .. autosummary::
15 | :toctree: .
16 |
17 | pp.read_csv2adata
18 | pp.read_mult_image2adata
19 | pp.read_visium2adata
20 | pp.read_dsp2adata
21 |
22 |
23 | Seurat to Anndata
24 | -----------------
25 |
26 | .. module:: SOAPy_st.pp
27 | .. currentmodule:: SOAPy_st
28 |
29 | .. autosummary::
30 | :toctree: .
31 |
32 | pp.st_Seurat2Anndata
33 |
34 |
35 | Spatial network
36 | ---------------
37 |
38 | .. module:: SOAPy_st.pp
39 | .. currentmodule:: SOAPy_st
40 |
41 | .. autosummary::
42 | :toctree: .
43 |
44 | pp.make_network
--------------------------------------------------------------------------------
/source/Api/tool.rst:
--------------------------------------------------------------------------------
1 | .. module:: SOAPy_st
2 | .. automodule:: SOAPy_st
3 | :noindex:
4 |
5 | tl
6 | ============================
7 |
8 | Spatial domain
9 | -------------------
10 |
11 | .. module:: SOAPy_st.tl
12 | .. currentmodule:: SOAPy_st
13 |
14 | .. autosummary::
15 | :toctree: .
16 |
17 | tl.domain_from_unsupervised
18 | tl.cal_aucell
19 | tl.domain_from_local_moran
20 | tl.global_moran
21 |
22 | Mask
23 | -------------------
24 |
25 | .. module:: SOAPy_st.tl
26 | .. currentmodule:: SOAPy_st
27 |
28 | .. autosummary::
29 | :toctree: .
30 |
31 | tl.adata_from_mask
32 | tl.get_mask_from_domain
33 |
34 | Spatial tendency
35 | -------------------
36 |
37 | .. module:: SOAPy_st.tl
38 | .. currentmodule:: SOAPy_st
39 |
40 | .. autosummary::
41 | :toctree: .
42 |
43 | tl.ANOVA
44 | tl.wilcoxon_test
45 | tl.spearman_correlation
46 | tl.spatial_tendency
47 | tl.gene_cluster
48 | tl.cal_spatialDE
49 | tl.cal_sparkX
50 | tl.cal_spark
51 |
52 | Cell type proximity
53 | -------------------
54 |
55 | .. module:: SOAPy_st.tl
56 | .. currentmodule:: SOAPy_st
57 |
58 | .. autosummary::
59 | :toctree: .
60 |
61 | tl.neighborhood_analysis
62 | tl.infiltration_analysis
63 |
64 | Niche composition
65 | -----------------
66 |
67 | .. module:: SOAPy_st.tl
68 | .. currentmodule:: SOAPy_st
69 |
70 | .. autosummary::
71 | :toctree: .
72 |
73 | tl.get_c_niche
74 |
75 | Spatial communication
76 | ---------------------
77 |
78 | .. module:: SOAPy_st.tl
79 | .. currentmodule:: SOAPy_st
80 |
81 | .. autosummary::
82 | :toctree: .
83 |
84 | tl.lr_pairs
85 | tl.cell_level_communications
86 | tl.cell_type_level_communication
87 |
88 | Tensor decomposition
89 | ---------------------
90 |
91 | .. module:: SOAPy_st.tl
92 | .. currentmodule:: SOAPy_st
93 |
94 | .. autosummary::
95 | :toctree: .
96 |
97 | tl.TensorDecomposition
98 |
--------------------------------------------------------------------------------
/source/Installation.rst:
--------------------------------------------------------------------------------
1 | .. highlight:: shell
2 |
3 | ============
4 | Installation
5 | ============
6 |
7 |
8 | Install by PyPi
9 | ---------------
10 |
11 | **Step 1:**
12 |
13 | Prepare conda environment for SOAPy:
14 | ::
15 |
16 | conda create -n SOAPy_st python=3.9
17 | conda activate SOAPy_st
18 |
19 | **Step 2:**
20 |
21 | Install SOAPy using `pip`:
22 | ::
23 |
24 | pip install SOAPy_st
25 |
26 |
27 | Install by github
28 | -----------------
29 |
30 | Download the file from github:
31 | ::
32 |
33 | cd SOAPy_st
34 | python setup.py build
35 | python setup.py install
36 |
37 |
38 | Requirements of SOAPy
39 | -----------------
40 |
41 | Those will be installed automatically when using pip.
42 |
43 | ::
44 |
45 | anndata==0.9.1
46 | ctxcore==0.2.0
47 | esda==2.4.3
48 | geopandas==0.14.3
49 | libpysal==4.8.1
50 | networkx==2.8.6
51 | numba==0.60.0
52 | opencv-python==4.8.1.78
53 | pyscenic==0.12.1
54 | s-dbw==0.4.0
55 | shapely==2.0.3
56 | scanpy==1.10.3
57 | scikit-image==0.19.3
58 | scikit-learn==1.1.2
59 | scikit-misc==0.3.1
60 | scipy==1.13.1
61 | seaborn==0.13.2
62 | statsmodels==0.13.2
63 | tensorly==0.8.1
64 | torch==1.12.0
65 | torchaudio==0.12.0
66 | torchvision==0.13.0
67 | matplotlib
68 | numpy
69 | pandas
70 | tqdm
71 |
72 |
73 | If you want to use unsupervised spatial domain partitioning methods, please refer to the tutorial to install torch_geometric and its dependencies: https://pytorch-geometric.readthedocs.io/en/latest/install/installation.html .
74 |
75 | The versions used in our tests are as follows:
76 | ::
77 |
78 | torch_geometric==2.6.1
79 | torch-cluster==1.6.0
80 | torch-scatter==2.1.0
81 | torch-sparse==0.6.16
82 | torch-spline-conv==1.2.1
83 |
84 |
85 | Install rpy2 for spatial domain (optional)
86 | -----------------
87 |
88 | install r-base by conda:
89 | ::
90 |
91 | conda install -c conda-forge r-base
92 |
93 | In the R console, run the following command to install the mclust package:
94 | ::
95 |
96 | install.packages("mclust")
97 |
98 | Exit the r console after installation, install rpy2 by pip:
99 | ::
100 |
101 | pip install rpy2
102 |
103 |
--------------------------------------------------------------------------------
/source/References.rst:
--------------------------------------------------------------------------------
1 | References
2 | ----------
3 | .. [Wolf18] Wolf *et al.* (2018),
4 | *Scanpy: large-scale single-cell gene expression data analysis*,
5 | `Genome Biology `__.
6 |
7 | .. [Dong21] Dong *et al.* (2021),
8 | *Deciphering spatial domains from spatially resolved transcriptomics with an adaptive graph attention auto-encoder*,
9 | `Nature Communications `__.
10 |
11 | .. [Pham23] Pham *et al.* (2023),
12 | *Robust mapping of spatiotemporal trajectories and cell–cell interactions in healthy and diseased tissues*,
13 | `Nature Communications `__.
14 |
15 | .. [Jin21] Jin *et al.* (2021),
16 | *Inference and analysis of cell-cell communication using CellChat*,
17 | `Nature Communications `__.
18 |
19 | .. [Svensson18] Svensson *et al.* (2018),
20 | *SpatialDE: identification of spatially variable genes*,
21 | `Nature Methods `__.
22 |
23 | .. [Sun20] Sun *et al.* (2020),
24 | *Statistical analysis of spatial expression patterns for spatially resolved transcriptomic studies*,
25 | `Nature Communications `__.
26 |
27 | .. [Sun21] Sun *et al.* (2021),
28 | *SPARK-X: non-parametric modeling enables scalable and robust detection of spatial expression patterns for large spatial transcriptomic studies*,
29 | `Nature Communications `__.
30 |
31 | .. [Kolda09] Kolda *et al.* (2009),
32 | *Tensor Decompositions and Applications*,
33 | `SIAM Rev. `__.
34 |
35 | .. [Keren18] Keren *et al.* (2018),
36 | *A Structured Tumor-Immune Microenvironment in Triple Negative Breast Cancer Revealed by Multiplexed Ion Beam Imaging*,
37 | `Cell. `__.
38 |
39 | .. [Pedregosa11] Pedregosa *et al.* (2011),
40 | *Scikit-learn: Machine Learning in Python*,
41 | `JMLR `__.
42 |
43 | .. [Dong22] Dong *et al.* (2022),
44 | *Deciphering spatial domains from spatially resolved transcriptomics with an adaptive graph attention auto-encoder*,
45 | `Nature Communications `__.
46 |
47 | .. [Cang21] Cang *et al.* (2021),
48 | *SCAN-IT: Domain segmentation of spatial transcriptomics images by graph neural network*,
49 | `BMVC `__.
50 |
51 |
52 |
53 |
54 |
--------------------------------------------------------------------------------
/source/Release_notes.rst:
--------------------------------------------------------------------------------
1 | Release notes
2 | ======================================
3 |
4 | Version 0.1.6
5 | -------------
6 |
7 | Initial version
8 |
9 | Version 0.1.0
10 | -------------
11 |
12 | Add pp.st_Seurat2Anndata
--------------------------------------------------------------------------------
/source/SOAPy_st/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | # -*- coding:utf-8 -*-
3 | from . import pp
4 | from . import tl
5 | from . import pl
6 |
7 | __version__ = "v0.1.6"
8 |
9 | """
10 | # Author: Lihong lab
11 | # File Name:SOAPy
12 | # github:https://github.com/LiHongCSBLab/SOAPy
13 | # Description:
14 | """
15 |
16 | __author__ = "Cancer system biology lab"
17 | __email__ = [
18 | "wangheqi2021@sinh.ac.cn"
19 | "lijiarong2020@sinh.ac.cn"
20 | "lihong01@sibs.ac.cn"
21 | ]
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/source/SOAPy_st/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/__pycache__/utils.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/__pycache__/utils.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/_compat.py:
--------------------------------------------------------------------------------
1 | try:
2 | from typing import Literal
3 | except ImportError:
4 | try:
5 | from typing_extensions import Literal
6 | except ImportError:
7 |
8 | class LiteralMeta(type):
9 | def __getitem__(cls, values):
10 | if not isinstance(values, tuple):
11 | values = (values,)
12 | return type("Literal_", (Literal,), dict(__args__=values))
13 |
14 | class Literal(metaclass=LiteralMeta):
15 | pass
--------------------------------------------------------------------------------
/source/SOAPy_st/_docs.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/_docs.py
--------------------------------------------------------------------------------
/source/SOAPy_st/_metadata.py:
--------------------------------------------------------------------------------
1 | import traceback
2 | from pathlib import Path
3 |
4 | here = Path(__file__).parent
5 |
6 |
7 | def refresh_entry_points():
8 | """\
9 | Under some circumstances, (e.g. when installing a PEP 517 package via pip),
10 | pkg_resources.working_set.entries is stale. This tries to fix that.
11 | See https://github.com/pypa/setuptools_scm/issues/513
12 | """
13 | try:
14 | import sys
15 | import pkg_resources
16 |
17 | ws: pkg_resources.WorkingSet = pkg_resources.working_set
18 | for entry in sys.path:
19 | ws.add_entry(entry)
20 | except Exception:
21 | pass
22 |
23 |
24 | try:
25 | from setuptools_scm import get_version
26 |
27 | refresh_entry_points()
28 | __version__ = get_version(root='..', relative_to=__file__)
29 | except (ImportError, LookupError, FileNotFoundError):
30 | from ._compat import pkg_metadata
31 |
32 | metadata = pkg_metadata(here.name)
33 | __version__ = metadata['Version']
34 |
35 |
36 | def within_flit():
37 | """\
38 | Checks if we are being imported by flit.
39 | This is necessary so flit can import __version__ without all depedencies installed.
40 | There are a few options to make this hack unnecessary, see:
41 | https://github.com/takluyver/flit/issues/253#issuecomment-737870438
42 | """
43 | for frame in traceback.extract_stack():
44 | if frame.name == 'get_docstring_and_version_via_import':
45 | return True
46 | return False
--------------------------------------------------------------------------------
/source/SOAPy_st/pl/__init__.py:
--------------------------------------------------------------------------------
1 | from ._show import show_moran_scatterplot, show_network, show_voronoi
2 | from ._tendency import show_tendency, show_curves_cluster, show_box_plot
3 | from ._neighborhood import show_neighborhood_analysis, show_infiltration_analysis
4 | from ._ccc import show_ccc_netplot, show_ccc_chordplot, show_ccc_dotplot, show_ccc_embedding
5 | from ._niche import show_niche_environment, show_niche_sample_heatmap, show_celltype_niche_heatmap, \
6 | show_celltype_sample_heatmap
7 | from ._tensor import show_factor_matrix_in_CP_tensor, show_factor_matrix_in_tucker_tensor, show_proportion_in_tucker, \
8 | show_proportion_in_CP
9 |
--------------------------------------------------------------------------------
/source/SOAPy_st/pl/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pl/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pl/__pycache__/_ccc.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pl/__pycache__/_ccc.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pl/__pycache__/_chord.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pl/__pycache__/_chord.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pl/__pycache__/_color.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pl/__pycache__/_color.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pl/__pycache__/_heatmap.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pl/__pycache__/_heatmap.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pl/__pycache__/_neighborhood.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pl/__pycache__/_neighborhood.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pl/__pycache__/_niche.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pl/__pycache__/_niche.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pl/__pycache__/_show.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pl/__pycache__/_show.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pl/__pycache__/_tendency.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pl/__pycache__/_tendency.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pl/__pycache__/_tensor.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pl/__pycache__/_tensor.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pl/__pycache__/utils.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pl/__pycache__/utils.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pl/_color.py:
--------------------------------------------------------------------------------
1 | # define color list in SOAPy
2 | from typing import Sequence, Union
3 | from matplotlib.colors import ListedColormap
4 |
5 | # default palette
6 | # 10 color
7 | color_list_10 = [
8 | "#765005", "#0780cf", "#fa6d1d", "#0e2c82", "#b6b51f",
9 | "#da1f18", "#701866", "#f47a75", "#009db2", "#024b51"
10 | ]
11 |
12 | # 50 color
13 | color_list_50 = [
14 | '#5050FFFF', '#CE3D32FF', '#749B58FF', '#F0E685FF', '#466983FF', '#BA6338FF', '#5DB1DDFF',
15 | '#802268FF', '#6BD76BFF', '#D595A7FF', '#924822FF', '#837B8DFF', '#C75127FF', '#D58F5CFF',
16 | '#7A65A5FF', '#E4AF69FF', '#3B1B53FF', '#CDDEB7FF', '#612A79FF', '#AE1F63FF', '#E7C76FFF',
17 | '#5A655EFF', '#CC9900FF', '#99CC00FF', '#A9A9A9FF', '#CC9900FF', '#99CC00FF', '#00D68FFF',
18 | '#14FFB1FF', '#00CC99FF', '#0099CCFF', '#0A47FFFF', '#4775FFFF', '#FFC20AFF', '#FFD147FF',
19 | '#990033FF', '#991A00FF', '#996600FF', '#809900FF', '#339900FF', '#00991AFF', '#009966FF',
20 | '#008099FF', '#003399FF', '#1A0099FF', '#660099FF', '#990080FF', '#D60047FF', '#FF1463FF',
21 | '#00D68FFF'
22 | ]
23 |
24 | # default colorbar
25 | cmap_default = 'parula'
26 |
27 |
28 | def _get_palette(categorical, sort_order: bool = True, palette: Union[Sequence, ListedColormap] = None) -> dict:
29 | are_all_str = all(map(lambda x: isinstance(x, str), categorical))
30 | if not are_all_str:
31 | categorical = str(categorical)
32 |
33 | if sort_order:
34 | categorical = sorted(categorical)
35 |
36 | if palette is None:
37 | if len(categorical) <= 10:
38 | palette = color_list_10
39 | else:
40 | palette = color_list_50
41 |
42 | if isinstance(palette, ListedColormap):
43 | palette = palette.colors
44 |
45 | palette = palette[0: len(categorical)]
46 | palette = dict(zip(categorical, palette))
47 | return palette
--------------------------------------------------------------------------------
/source/SOAPy_st/pp/__init__.py:
--------------------------------------------------------------------------------
1 | from .all2adata import read_csv2adata, read_mult_image2adata, read_visium2adata, read_dsp2adata, st_Seurat2Anndata
2 | from .build_network import make_network
3 |
--------------------------------------------------------------------------------
/source/SOAPy_st/pp/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pp/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pp/__pycache__/all2adata.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pp/__pycache__/all2adata.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pp/__pycache__/build_network.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pp/__pycache__/build_network.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pp/__pycache__/utils.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/pp/__pycache__/utils.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/pp/utils.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import numba as nb
3 | import pandas as pd
4 | from anndata import AnnData
5 | from typing import Union, Optional, Tuple
6 |
7 |
8 | @nb.jit
9 | def _filter_of_graph(obs: pd.DataFrame,
10 | indices: np.ndarray,
11 | distances: np.ndarray,
12 | cluster_label: str,
13 | exclude: Union[str, dict]) -> Tuple[np.ndarray, np.ndarray]:
14 | """
15 | Select the edges as 'exclude'
16 |
17 | Returns
18 | -------
19 | anndata.Anndata object.
20 |
21 | """
22 | if type(exclude) == str:
23 | assert exclude in ['same', 'different']
24 | if type(exclude) == dict:
25 | exclude = [(i, j) for i, j in zip(exclude.keys(), exclude.values())] + \
26 | [(j, i) for i, j in zip(exclude.keys(), exclude.values())]
27 |
28 | for i, neigh in enumerate(indices):
29 | point_1 = neigh[0]
30 | index_point1 = obs.index[point_1]
31 | for j, point_2 in enumerate(neigh):
32 | if j == 0:
33 | continue
34 | index_point2 = obs.index[point_2]
35 | if exclude == 'same' and \
36 | obs.loc[index_point1, cluster_label] == obs.loc[index_point2, cluster_label]:
37 | distances[i][j] = -1
38 | indices[i][j] = -1
39 | continue
40 | if exclude == 'different' and \
41 | obs.loc[index_point1, cluster_label] != obs.loc[index_point2, cluster_label]:
42 | distances[i][j] = -1
43 | indices[i][j] = -1
44 | continue
45 | if type(exclude) == dict and \
46 | (obs.loc[index_point1, cluster_label], obs.loc[index_point2, cluster_label]) in exclude:
47 | distances[i][j] = -1
48 | indices[i][j] = -1
49 | distances[i] = distances[i][distances[i] >= 0]
50 | indices[i] = indices[i][indices[i] >= 0]
51 |
52 | return indices, distances
53 |
54 |
55 | def _preprocessing_of_graph(clu_value: np.ndarray,
56 | indices: np.ndarray,
57 | distances: np.ndarray,
58 | ) -> pd.DataFrame:
59 | """
60 | get information of edges
61 | """
62 | edges = []
63 |
64 | for index, neigh in enumerate(indices):
65 | if len(neigh) == 0:
66 | continue
67 | for index_2, point_2 in enumerate(neigh):
68 | if point_2 == index | point_2 == -1:
69 | continue
70 | elif point_2 < index:
71 | edge = [point_2, index,
72 | clu_value[point_2],
73 | clu_value[index],
74 | distances[index][index_2]]
75 | edges.append(edge)
76 |
77 | elif point_2 > index:
78 | edge = [index, point_2,
79 | clu_value[index],
80 | clu_value[point_2],
81 | distances[index][index_2]]
82 | edges.append(edge)
83 |
84 | df_edge = pd.DataFrame(data=np.array(edges), columns=['point_1', 'point_2',
85 | 'cluster_1', 'cluster_2', 'distance'])
86 |
87 | df_edge.drop_duplicates(subset=['point_1', 'point_2'], inplace=True)
88 | return df_edge
89 |
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/__init__.py:
--------------------------------------------------------------------------------
1 | from ._mask import get_mask_from_domain
2 | from ._domain import domain_from_unsupervised, global_moran, cal_aucell, domain_from_local_moran
3 | from ._var_genes import cal_spatialDE, cal_sparkX, cal_spark
4 | from ._tendency import adata_from_mask, wilcoxon_test, spearman_correlation, ANOVA, spatial_tendency, gene_cluster
5 | from ._interaction import neighborhood_analysis, infiltration_analysis, get_c_niche
6 | from ._ccc import cell_level_communications, cell_type_level_communication, lr_pairs
7 | from ._tensor import TensorDecomposition
8 |
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/__pycache__/_ccc.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/__pycache__/_ccc.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/__pycache__/_distance.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/__pycache__/_distance.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/__pycache__/_domain.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/__pycache__/_domain.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/__pycache__/_interaction.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/__pycache__/_interaction.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/__pycache__/_mask.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/__pycache__/_mask.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/__pycache__/_stagate.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/__pycache__/_stagate.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/__pycache__/_tendency.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/__pycache__/_tendency.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/__pycache__/_tensor.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/__pycache__/_tensor.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/__pycache__/_var_genes.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/__pycache__/_var_genes.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/__pycache__/utils.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/__pycache__/utils.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/GraphST/README.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/GraphST/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """
3 | # Author: Yahui Long
4 | # File Name: __init__.py
5 | # Description:
6 | """
7 |
8 | __author__ = "Yahui Long"
9 | __email__ = "long_yahui@immunol.a-star.edu.sg"
10 |
11 | from .utils import clustering, project_cell_to_spot
12 | from .preprocess import preprocess_adj, preprocess, construct_interaction, add_contrastive_label, get_feature, permutation, fix_seed
13 |
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/GraphST.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/GraphST.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/model.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/model.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/preprocess.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/preprocess.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/utils.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/GraphST/__pycache__/utils.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/STAGATE_pyG/STAGATE.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 |
3 | import torch
4 | import torch.nn as nn
5 | import torch.backends.cudnn as cudnn
6 | cudnn.deterministic = True
7 | cudnn.benchmark = True
8 | import torch.nn.functional as F
9 | from .gat_conv import GATConv
10 |
11 | class STAGATE(torch.nn.Module):
12 | def __init__(self, hidden_dims):
13 | super(STAGATE, self).__init__()
14 |
15 | [in_dim, num_hidden, out_dim] = hidden_dims
16 | self.conv1 = GATConv(in_dim, num_hidden, heads=1, concat=False,
17 | dropout=0, add_self_loops=False, bias=False)
18 | self.conv2 = GATConv(num_hidden, out_dim, heads=1, concat=False,
19 | dropout=0, add_self_loops=False, bias=False)
20 | self.conv3 = GATConv(out_dim, num_hidden, heads=1, concat=False,
21 | dropout=0, add_self_loops=False, bias=False)
22 | self.conv4 = GATConv(num_hidden, in_dim, heads=1, concat=False,
23 | dropout=0, add_self_loops=False, bias=False)
24 |
25 | def forward(self, features, edge_index):
26 |
27 | h1 = F.elu(self.conv1(features, edge_index))
28 | h2 = self.conv2(h1, edge_index, attention=False)
29 | self.conv3.lin_src.data = self.conv2.lin_src.transpose(0, 1)
30 | self.conv3.lin_dst.data = self.conv2.lin_dst.transpose(0, 1)
31 | self.conv4.lin_src.data = self.conv1.lin_src.transpose(0, 1)
32 | self.conv4.lin_dst.data = self.conv1.lin_dst.transpose(0, 1)
33 | h3 = F.elu(self.conv3(h2, edge_index, attention=True,
34 | tied_attention=self.conv1.attentions))
35 | h4 = self.conv4(h3, edge_index, attention=False)
36 |
37 | return h2, h4 # F.log_softmax(x, dim=-1)
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/STAGATE_pyG/Train_STAGATE.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import pandas as pd
3 | from tqdm import tqdm
4 | import scipy.sparse as sp
5 |
6 | from .STAGATE import STAGATE
7 | from .utils import Transfer_pytorch_Data
8 |
9 | import torch
10 | import torch.backends.cudnn as cudnn
11 | cudnn.deterministic = True
12 | cudnn.benchmark = True
13 | import torch.nn.functional as F
14 |
15 |
16 | def train_STAGATE(adata, hidden_dims=[512, 30], n_epochs=1000, lr=0.001, key_added='STAGATE',
17 | gradient_clipping=5., weight_decay=0.0001, verbose=True,
18 | random_seed=0, save_loss=False, save_reconstrction=False,
19 | device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu')):
20 | """\
21 | Training graph attention auto-encoder.
22 |
23 | Parameters
24 | ----------
25 | adata
26 | AnnData object of scanpy package.
27 | hidden_dims
28 | The dimension of the encoder.
29 | n_epochs
30 | Number of total epochs in training.
31 | lr
32 | Learning rate for AdamOptimizer.
33 | key_added
34 | The latent embeddings are saved in adata.obsm[key_added].
35 | gradient_clipping
36 | Gradient Clipping.
37 | weight_decay
38 | Weight decay for AdamOptimizer.
39 | save_loss
40 | If True, the training loss is saved in adata.uns['STAGATE_loss'].
41 | save_reconstrction
42 | If True, the reconstructed expression profiles are saved in adata.layers['STAGATE_ReX'].
43 | device
44 | See torch.device.
45 |
46 | Returns
47 | -------
48 | AnnData
49 | """
50 |
51 | # seed_everything()
52 | seed=random_seed
53 | import random
54 | random.seed(seed)
55 | torch.manual_seed(seed)
56 | torch.cuda.manual_seed_all(seed)
57 | np.random.seed(seed)
58 |
59 | adata.X = sp.csr_matrix(adata.X)
60 |
61 | if 'highly_variable' in adata.var.columns:
62 | adata_Vars = adata[:, adata.var['highly_variable']]
63 | else:
64 | adata_Vars = adata
65 |
66 | if verbose:
67 | print('Size of Input: ', adata_Vars.shape)
68 | if 'Spatial_Net' not in adata.uns.keys():
69 | raise ValueError("Spatial_Net is not existed! Run Cal_Spatial_Net first!")
70 |
71 | data = Transfer_pytorch_Data(adata_Vars)
72 |
73 | model = STAGATE(hidden_dims = [data.x.shape[1]] + hidden_dims).to(device)
74 | data = data.to(device)
75 |
76 | optimizer = torch.optim.Adam(model.parameters(), lr=lr, weight_decay=weight_decay)
77 |
78 | #loss_list = []
79 | for epoch in tqdm(range(1, n_epochs+1)):
80 | model.train()
81 | optimizer.zero_grad()
82 | z, out = model(data.x, data.edge_index)
83 | loss = F.mse_loss(data.x, out) #F.nll_loss(out[data.train_mask], data.y[data.train_mask])
84 | #loss_list.append(loss)
85 | loss.backward()
86 | torch.nn.utils.clip_grad_norm_(model.parameters(), gradient_clipping)
87 | optimizer.step()
88 |
89 | model.eval()
90 | z, out = model(data.x, data.edge_index)
91 |
92 | STAGATE_rep = z.to('cpu').detach().numpy()
93 | adata.obsm[key_added] = STAGATE_rep
94 |
95 | if save_loss:
96 | adata.uns['STAGATE_loss'] = loss
97 | if save_reconstrction:
98 | ReX = out.to('cpu').detach().numpy()
99 | ReX[ReX<0] = 0
100 | adata.layers['STAGATE_ReX'] = ReX
101 |
102 | return adata
103 |
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/STAGATE_pyG/__init__.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | """
3 | # Author: Kangning Dong
4 | # File Name: __init__.py
5 | # Description:
6 | """
7 |
8 | __author__ = "Kangning Dong"
9 | __email__ = "dongkangning16@mails.ucas.ac.cn"
10 |
11 | from .STAGATE import STAGATE
12 | from .Train_STAGATE import train_STAGATE
13 | from .utils import Transfer_pytorch_Data, Cal_Spatial_Net, Stats_Spatial_Net, mclust_R, Cal_Spatial_Net_3D, Batch_Data
14 |
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/readme.txt:
--------------------------------------------------------------------------------
1 | The tools in this folder are only for SOAPy to invoke, if you use the relevant tools, please refer to the relevant text.
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/__init__.py:
--------------------------------------------------------------------------------
1 | # __init__ file
2 | import warnings
3 | warnings.filterwarnings('ignore')
4 |
5 | from . import tools as tl
6 |
7 | import sys
8 | sys.modules.update({f'{__name__}.{m}': globals()[m] for m in ['tl']})
9 |
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/scanit/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__init__.py:
--------------------------------------------------------------------------------
1 | # __init__ file
2 | from ._alpha import graph_alpha
3 | from ._knn import graph_knn
4 | from ._scale_estimation import estimate_cutoff_knn
5 | from ._dgi import rep_dgi
6 | from ._gae import rep_gae
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_alpha.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_alpha.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_dgi.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_dgi.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_gae.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_gae.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_knn.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_knn.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_scale_estimation.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/__pycache__/_scale_estimation.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/_alpha.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | import gudhi
3 | import networkx as nx
4 | from sklearn.neighbors import kneighbors_graph
5 | import matplotlib.pyplot as plt
6 |
7 | def graph_alpha(pts, n_layer = 1, cut = np.inf, draw = False):
8 |
9 | # Get a graph from alpha shape
10 | pts_list = pts.tolist()
11 | n_node = len(pts_list)
12 | alpha_complex = gudhi.AlphaComplex(points=pts_list)
13 | simplex_tree = alpha_complex.create_simplex_tree(max_alpha_square=cut**2)
14 | skeleton = simplex_tree.get_skeleton(1)
15 | initial_graph = nx.Graph()
16 | initial_graph.add_nodes_from([i for i in range(n_node)])
17 | for s in skeleton:
18 | if len(s[0]) == 2:
19 | initial_graph.add_edge(s[0][0], s[0][1])
20 | # Extend the graph for the specified layers
21 | extended_graph = nx.Graph()
22 | extended_graph.add_nodes_from(initial_graph)
23 | extended_graph.add_edges_from(initial_graph.edges)
24 | if n_layer == 2:
25 | for i in range(n_node):
26 | for j in initial_graph.neighbors(i):
27 | for k in initial_graph.neighbors(j):
28 | extended_graph.add_edge(i,k)
29 | elif n_layer == 3:
30 | for i in range(n_node):
31 | for j in initial_graph.neighbors(i):
32 | for k in initial_graph.neighbors(j):
33 | for l in initial_graph.neighbors(k):
34 | extended_graph.add_edge(i,l)
35 | if n_layer >= 4:
36 | print("Setting n_layer to greater than 3 may results in too large neighborhoods")
37 |
38 | # Remove self edges
39 | for i in range(n_node):
40 | try:
41 | extended_graph.remove_edge(i,i)
42 | except:
43 | pass
44 |
45 | # Draw the graph
46 | if draw:
47 | pos_dict = {i:pts_list[i] for i in range(n_node)}
48 | nx.draw_networkx(extended_graph, pos=pos_dict, with_labels=False, node_size=1, node_color='dimgrey', edge_color='darkgrey')
49 | plt.axis('equal'); plt.axis('off'); plt.show()
50 |
51 | # Get the sparse adjacency matrix
52 | A = nx.to_scipy_sparse_matrix(extended_graph, format='csr')
53 |
54 | return A
55 |
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/_dgi.py:
--------------------------------------------------------------------------------
1 | import random
2 | import torch
3 | import torch.nn as nn
4 | from torch_geometric.nn import GCNConv, DeepGraphInfomax
5 |
6 | import numpy as np
7 | from scipy import sparse
8 | import pickle
9 |
10 |
11 | def sparse_mx_to_torch_edge_list(sparse_mx):
12 | sparse_mx = sparse_mx.tocoo().astype(np.float32)
13 | edge_list = torch.from_numpy(
14 | np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64))
15 | return edge_list
16 |
17 | def rep_dgi(
18 | n_h,
19 | X,
20 | A,
21 | n_epoch=1000,
22 | lr=0.001,
23 | print_step=500,
24 | torch_seed=None,
25 | python_seed=None,
26 | numpy_seed=None,
27 | device=None
28 | ):
29 | # torch.set_deterministic(True)
30 | if not torch_seed is None:
31 | torch.manual_seed(torch_seed)
32 | if not python_seed is None:
33 | random.seed(python_seed)
34 | if not numpy_seed is None:
35 | np.random.seed(numpy_seed)
36 |
37 |
38 | n_f = X.shape[1]
39 |
40 | class Encoder(nn.Module):
41 | def __init__(self, in_channels, hidden_channels):
42 | super(Encoder, self).__init__()
43 | self.conv = GCNConv(in_channels, hidden_channels, cached=False)
44 | self.prelu = nn.PReLU(hidden_channels)
45 | self.conv2 = GCNConv(hidden_channels, hidden_channels, cached=False)
46 | self.prelu2 = nn.PReLU(hidden_channels)
47 |
48 | def forward(self, x, edge_index):
49 | x = self.conv(x, edge_index)
50 | x = self.prelu(x)
51 | x = self.conv2(x, edge_index)
52 | x = self.prelu2(x)
53 | return x
54 |
55 | def corruption(x, edge_index):
56 | return x[torch.randperm(x.size(0))], edge_index
57 | if device is None:
58 | device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
59 | else:
60 | device = torch.device(device)
61 | model = DeepGraphInfomax(
62 | hidden_channels = n_h, encoder = Encoder(n_f, n_h),
63 | summary = lambda z, *args, **kwargs: torch.sigmoid(z.mean(dim=0)),
64 | corruption = corruption).to(device)
65 |
66 | X = torch.FloatTensor(X)
67 | X = X.to(device)
68 | edge_list = sparse_mx_to_torch_edge_list(A)
69 | edge_list = edge_list.to(device)
70 |
71 | optimiser = torch.optim.Adam(model.parameters(), lr=lr)
72 |
73 | def train():
74 | model.train()
75 | optimiser.zero_grad()
76 | pos_z, neg_z, summary = model(X, edge_list)
77 | loss = model.loss(pos_z, neg_z, summary)
78 | loss.backward()
79 | optimiser.step()
80 | return loss.item()
81 |
82 | for epoch in range(n_epoch):
83 | loss = train()
84 | if epoch % print_step == 0 or epoch+1 == n_epoch:
85 | print('Epoch: {:03d}, Loss: {:.4f}'.format(epoch, loss))
86 |
87 | z,_,_ = model(X, edge_list)
88 | return z.cpu().detach().numpy()
89 |
90 | def main():
91 | f = open("./X.pkl", 'rb')
92 | X = pickle.load(f)
93 | X = X.toarray()
94 | f = open("./A.pkl", 'rb')
95 | A = pickle.load(f)
96 | z = rep_dgi(32, X, A)
97 | print(z.shape)
98 |
99 | if __name__=="__main__":
100 | main()
101 |
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/_gae.py:
--------------------------------------------------------------------------------
1 | import os.path as osp
2 |
3 | import argparse
4 | import torch
5 | import torch.nn.functional as F
6 | from torch_geometric.datasets import Planetoid
7 | import torch_geometric.transforms as T
8 | from torch_geometric.nn import GCNConv, GAE, VGAE
9 |
10 | import pickle
11 | import numpy as np
12 |
13 | def sparse_mx_to_torch_edge_list(sparse_mx):
14 | sparse_mx = sparse_mx.tocoo().astype(np.float32)
15 | edge_list = torch.from_numpy(
16 | np.vstack((sparse_mx.row, sparse_mx.col)).astype(np.int64))
17 | return edge_list
18 |
19 | def rep_gae(n_h, X, A, mdl_type="VGAE"):
20 |
21 | n_nd, n_f = X.shape
22 |
23 | class Encoder(torch.nn.Module):
24 | def __init__(self, in_channels, out_channels):
25 | super(Encoder, self).__init__()
26 | self.conv1 = GCNConv(in_channels, 2 * out_channels, cached=True)
27 | if mdl_type == 'GAE':
28 | self.conv2 = GCNConv(2 * out_channels, out_channels, cached=True)
29 | elif mdl_type == 'VGAE':
30 | self.conv_mu = GCNConv(2 * out_channels, out_channels, cached=True)
31 | self.conv_logvar = GCNConv(
32 | 2 * out_channels, out_channels, cached=True)
33 |
34 | def forward(self, x, edge_index):
35 | x = F.relu(self.conv1(x, edge_index))
36 | if mdl_type == 'GAE':
37 | return self.conv2(x, edge_index)
38 | elif mdl_type == 'VGAE':
39 | return self.conv_mu(x, edge_index), self.conv_logvar(x, edge_index)
40 |
41 | channels = n_h
42 | device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
43 | if mdl_type == 'GAE':
44 | model = GAE(Encoder(n_f, channels)).to(device)
45 | elif mdl_type == 'VGAE':
46 | model = VGAE(Encoder(n_f, channels)).to(device)
47 | optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
48 | X = torch.FloatTensor(X)
49 | X = X.to(device)
50 | edge_list = sparse_mx_to_torch_edge_list(A)
51 | edge_list = edge_list.to(device)
52 |
53 | def train():
54 | model.train()
55 | optimizer.zero_grad()
56 | z = model.encode(X, edge_list)
57 | loss = model.recon_loss(z, edge_list)
58 | if mdl_type == 'VGAE':
59 | loss = loss + (1 / n_nd) * model.kl_loss()
60 | loss.backward()
61 | optimizer.step()
62 | return loss.item()
63 |
64 | for epoch in range(1000):
65 | loss = train()
66 | print('Epoch: {:03d}, Loss: {:.4f}'.format(epoch, loss))
67 |
68 | z,_,_ = model(X, edge_list)
69 | return z.cpu().detach().numpy()
70 |
71 | def main():
72 | f = open("./X.pkl", 'rb')
73 | X = pickle.load(f)
74 | X = X.todense()
75 | f = open("./A.pkl", 'rb')
76 | A = pickle.load(f)
77 | rep_gae(100, X, A, mdl_type='VGAE')
78 |
79 | if __name__=="__main__":
80 | main()
81 |
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/_knn.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | from scipy import sparse
3 | from sklearn.neighbors import kneighbors_graph, radius_neighbors_graph
4 | import networkx as nx
5 | import matplotlib.pyplot as plt
6 |
7 | def graph_knn(pts, k = 10, cut = np.inf, draw = False):
8 | # Assymetric knn graph
9 | A_knn = kneighbors_graph(pts, n_neighbors=k, mode='connectivity')
10 | # Make it symetric
11 | A_knn_sym = ((A_knn + A_knn.T).astype(bool)).astype(int)
12 | # Apply the cutoff
13 | if not np.isinf(cut):
14 | A_rn = radius_neighbors_graph(pts, radius=cut, mode='connectivity')
15 | A_knn_sym = A_knn_sym.multiply(A_rn)
16 | # Plot the graph
17 | if draw:
18 | G = nx.from_scipy_sparse_matrix(A_knn_sym)
19 | pts_list = list(pts)
20 | n_node = len(pts_list)
21 | pos_dict = {i:pts_list[i] for i in range(n_node)}
22 | nx.draw_networkx(G, pos=pos_dict, with_labels=False, node_size=10, node_color='dimgrey', edge_color='darkgrey')
23 | plt.axis('equal'); plt.axis('off'); plt.show()
24 |
25 | return A_knn_sym
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/_utils/_scale_estimation.py:
--------------------------------------------------------------------------------
1 | import numpy as np
2 | from scipy import sparse
3 | from sklearn.neighbors import kneighbors_graph
4 |
5 | def estimate_cutoff_knn(pts, k=10):
6 | A_knn = kneighbors_graph(pts, n_neighbors=k, mode='distance')
7 | est_cut = A_knn.sum() / float(A_knn.count_nonzero())
8 | return est_cut
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/tools/__init__.py:
--------------------------------------------------------------------------------
1 | from ._scanit_representation import spatial_graph
2 | from ._scanit_representation import spatial_representation
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/tools/__pycache__/__init__.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/scanit/tools/__pycache__/__init__.cpython-39.pyc
--------------------------------------------------------------------------------
/source/SOAPy_st/tl/other_package_without_pip/scanit/tools/__pycache__/_scanit_representation.cpython-39.pyc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/SOAPy_st/tl/other_package_without_pip/scanit/tools/__pycache__/_scanit_representation.cpython-39.pyc
--------------------------------------------------------------------------------
/source/Tutorials/index.rst:
--------------------------------------------------------------------------------
1 | .. module:: SOAPy_st
2 | .. automodule:: SOAPy_st
3 | :noindex:
4 |
5 | Tutorials
6 | ======================================
7 |
8 | Examples data
9 | -------------
10 |
11 | Some of the processed h5ad data will be uploaded to the https://zenodo.org/records/10450764 for direct use by the user,
12 | and other non-uploaded data can be downloaded through the links given in the tutorial.
13 |
14 | Major tutorials
15 | ---------------
16 |
17 | .. toctree::
18 | :maxdepth: 1
19 |
20 | Read_spatial_omics
21 |
22 | .. image:: ../_static/T_read.png
23 | :height: 100px
24 | :target: Read_spatial_omics
25 |
26 | .. toctree::
27 | :maxdepth: 1
28 |
29 | Spatial domain
30 |
31 | .. image:: ../_static/T_domain.png
32 | :height: 100px
33 |
34 | .. toctree::
35 | :maxdepth: 1
36 |
37 | Spatial tendency
38 |
39 | .. image:: ../_static/T_tendency.png
40 | :height: 100px
41 |
42 | .. toctree::
43 | :maxdepth: 1
44 |
45 | Cell type proximity
46 |
47 | .. image:: ../_static/T_cell_proximal.png
48 | :height: 100px
49 |
50 | .. toctree::
51 | :maxdepth: 1
52 |
53 | Niche composition
54 |
55 | .. image:: ../_static/T_niche.png
56 | :height: 100px
57 |
58 | .. toctree::
59 | :maxdepth: 1
60 |
61 | Spatial communications
62 |
63 | .. image:: ../_static/T_communication.png
64 | :height: 100px
65 |
66 | .. toctree::
67 | :maxdepth: 1
68 |
69 | Spatiotemporal pattern
70 |
71 | .. image:: ../_static/T_tensor.png
72 | :height: 100px
73 |
74 |
75 | Other tutorials
76 | ---------------
77 |
78 | .. toctree::
79 | :maxdepth: 1
80 |
81 | Transfer Seurat object into Anndata object
82 | Visualization of Nanostring DSP subtissues
83 | Spatial communication - cell level
84 |
--------------------------------------------------------------------------------
/source/_static/Overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/_static/Overview.png
--------------------------------------------------------------------------------
/source/_static/T_DSP.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/_static/T_DSP.png
--------------------------------------------------------------------------------
/source/_static/T_cell_proximal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/_static/T_cell_proximal.png
--------------------------------------------------------------------------------
/source/_static/T_communication.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/_static/T_communication.png
--------------------------------------------------------------------------------
/source/_static/T_domain.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/_static/T_domain.png
--------------------------------------------------------------------------------
/source/_static/T_niche.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/_static/T_niche.png
--------------------------------------------------------------------------------
/source/_static/T_read.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/_static/T_read.png
--------------------------------------------------------------------------------
/source/_static/T_tendency.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/_static/T_tendency.png
--------------------------------------------------------------------------------
/source/_static/T_tensor.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/_static/T_tensor.png
--------------------------------------------------------------------------------
/source/_static/logo_soapy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/LiHongCSBLab/SOAPy/153095a44200a07a73a6a72c9978adfa1581c853/source/_static/logo_soapy.png
--------------------------------------------------------------------------------
/source/conf.py:
--------------------------------------------------------------------------------
1 | # Configuration file for the Sphinx documentation builder.
2 | #
3 | # This file only contains a selection of the most common options. For a full
4 | # list see the documentation:
5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html
6 |
7 | # -- Path setup --------------------------------------------------------------
8 |
9 | # If extensions (or modules to document with autodoc) are in another directory,
10 | # add these directories to sys.path here. If the directory is relative to the
11 | # documentation root, use os.path.abspath to make it absolute, like shown here.
12 | #
13 | import os
14 | import sys
15 | sys.path.insert(0, os.path.abspath('../SOAPy'))
16 |
17 |
18 | # -- Project information -----------------------------------------------------
19 |
20 | project = 'SOAPy'
21 | copyright = '2023, Heqi Wang'
22 | author = 'Cancer system biology lab'
23 |
24 | # The full version, including alpha/beta/rc tags
25 | release = '1.0.1'
26 |
27 |
28 | # -- General configuration ---------------------------------------------------
29 |
30 | # Add any Sphinx extension module names here, as strings. They can be
31 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
32 | # ones.
33 | extensions = [
34 | 'sphinx.ext.autosummary',
35 | 'nbsphinx',
36 | "sphinx.ext.autodoc",
37 | ]
38 |
39 | nbsphinx_execute = 'never'
40 | nbsphinx_allow_errors = True
41 |
42 | # Add any paths that contain templates here, relative to this directory.
43 | templates_path = ['_templates']
44 |
45 | # List of patterns, relative to source directory, that match files and
46 | # directories to ignore when looking for source files.
47 | # This pattern also affects html_static_path and html_extra_path.
48 | exclude_patterns = []
49 |
50 |
51 | # -- Options for HTML output -------------------------------------------------
52 |
53 | # The theme to use for HTML and HTML Help pages. See the documentation for
54 | # a list of builtin themes.
55 | #
56 |
57 | html_logo = '_static/logo_soapy.png'
58 | html_last_updated_fmt = '%b %d, %Y'
59 | html_domain_indices = True
60 | html_theme_path = ['mxtheme']
61 | html_theme = 'sphinx_rtd_theme'
62 |
63 | html_theme_options = {
64 | 'style_nav_header_background': '#FF8C00',
65 | }
66 |
67 | # Add any paths that contain custom static files (such as style sheets) here,
68 | # relative to this directory. They are copied after the builtin static files,
69 | # so a file named "default.css" will overwrite the builtin "default.css".
70 | html_static_path = ['_static']
71 |
--------------------------------------------------------------------------------
/source/index.rst:
--------------------------------------------------------------------------------
1 | .. soapy documentation master file, created by
2 | sphinx-quickstart on Sun Dec 3 22:27:33 2023.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 |
7 | SOAPy - Spatial Omics Analysis in Python
8 | ====================================================
9 |
10 | |PyPI| |PyPIDownloads|
11 |
12 | .. |PyPI| image:: https://img.shields.io/pypi/v/SOAPy_st?logo=PyPI
13 | :target: https://pypi.org/project/SOAPy_st
14 | .. |PyPIDownloads| image:: https://pepy.tech/badge/SOAPy_st
15 | :target: https://pepy.tech/project/SOAPy_st
16 |
17 |
18 |
19 | **SOAPy** is an integrated toolkit that focuses on addressing spatial heterogeneity. SOAPy contains four data
20 | preprocessing modules (“Data Import”, “spatial network”, and “Spatial Domain”), three modules for analyzing spatial
21 | expression patterns of genes (“Spatial Variation”, “Spatial Tendency”, and “Spatiotemporal Pattern”), two modules
22 | for analyzing the spatial architecture of cells (“Spatial Proximity”, “Spatial Composition”), and two module for
23 | analyzing Spatial Communication.
24 |
25 |
26 | .. image:: ./_static/Overview.png
27 | :alt: Title figure
28 | :width: 700px
29 | :align: center
30 |
31 | .. toctree::
32 | :maxdepth: 2
33 | :caption: Contents:
34 |
35 | Installation
36 | Tutorials/index
37 | Api/index
38 | Release_notes
39 | References
40 |
41 |
42 | Indices and tables
43 | ==================
44 |
45 | * :ref:`genindex`
46 | * :ref:`modindex`
47 | * :ref:`search`
48 |
--------------------------------------------------------------------------------
/source/requirements.txt:
--------------------------------------------------------------------------------
1 | Sphinx==7.2.6
2 | jupyter_sphinx
3 | nbsphinx
4 | sphinx_rtd_theme
5 | recommonmark
6 | anndata==0.9.1
7 | ctxcore==0.2.0
8 | esda==2.4.3
9 | geopandas==0.14.3
10 | libpysal==4.8.1
11 | networkx==2.8.6
12 | numba==0.60.0
13 | opencv-python==4.8.1.78
14 | pyscenic==0.12.1
15 | s-dbw==0.4.0
16 | shapely==2.0.3
17 | scanpy==1.10.3
18 | scikit-image==0.19.3
19 | scikit-learn==1.1.2
20 | scikit-misc==0.3.1
21 | scipy==1.13.1
22 | seaborn==0.13.2
23 | statsmodels==0.13.2
24 | tensorly==0.8.1
25 | matplotlib
26 | numpy
27 | pandas
28 | tqdm
29 |
--------------------------------------------------------------------------------