Skip to content

Commit

Permalink
Merge pull request #24 from dpeerlab/readthedocs
Browse files Browse the repository at this point in the history
add modules
  • Loading branch information
DoronHav authored Apr 24, 2024
2 parents 631e2d0 + 971851e commit 6844214
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 66 deletions.
12 changes: 10 additions & 2 deletions docs/docs_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
sphinx_rtd_theme >= 2.0.0
myst_parser >= 3.0.0
sphinxcontrib-autoprogram
sphinxcontrib-napoleon
sphinx-autodocgen
sphinx-github-style
sphinx-mdinclude
m2r2
nbsphinx
furo
typing-extensions
IPython
79 changes: 62 additions & 17 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,78 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

project = 'scenvi'
copyright = '2024, DoronHav'
author = 'DoronHav'
release = '0.3.1'

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('../..'))
from pathlib import Path

sys.path.insert(0, os.path.abspath("../../src"))

this_directory = Path(__file__).parent





# -- Project information -----------------------------------------------------

project = "scenvi"
copyright = "2024, " + 'Doron Haviv'
author = 'Doron Haviv'

# The full version, including alpha/beta/rc tags
release = '3.0.2'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx_rtd_theme',
'myst_parser']
"sphinx.ext.autodoc",
"nbsphinx",
"sphinx.ext.napoleon",
"sphinx_mdinclude",
]
if os.environ.get('READTHEDOCS') == 'True':
extensions.append("sphinx_github_style")

source_suffix = [".rst", ".md"]

templates_path = ['_templates']
exclude_patterns = []
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ["_build", "**.ipynb_checkpoints"]


# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "furo"
pygments_style = "tango"

highlight_language = "none"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []


autoclass_content = 'both'
61 changes: 14 additions & 47 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,25 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to scenvi's documentation!
==================================

ENVI is a deep learnining based variational inference method to integrate scRNA-seq with spatial transcriptomics data. ENVI learns to reconstruct spatial onto for dissociated scRNA-seq data and impute unimagd genes onto spatial data.

This implementation is written in Python3 and relies on jax, flax, sklearn, scipy and scanpy.


To install JAX, simply run the command:

pip install -U "jax[cuda12_pip]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html

And to install ENVI along with the rest of the requirements:

pip install scenvi

To run ENVI:

import scenvi

envi_model = scenvi.ENVI(spatial_data = st_data, sc_data = sc_data)

envi_model.train()
envi_model.impute_genes()
envi_model.infer_niche_covet()
envi_model.infer_niche_celltype()

st_data.obsm['envi_latent'] = envi_model.spatial_data.obsm['envi_latent']
st_data.uns['COVET_genes'] = envi_model.CovGenes
st_data.obsm['COVET'] = envi_model.spatial_data.obsm['COVET']
st_data.obsm['COVET_SQRT'] = envi_model.spatial_data.obsm['COVET_SQRT']
st_data.obsm['cell_type_niche'] = envi_model.spatial_data.obsm['cell_type_niche']
st_data.obsm['imputation'] = envi_model.spatial_data.obsm['imputation']


sc_data.obsm['envi_latent'] = envi_model.sc_data.obsm['envi_latent']
sc_data.uns['COVET_genes'] = envi_model.CovGenes
sc_data.obsm['COVET'] = envi_model.sc_data.obsm['COVET']
sc_data.obsm['COVET_SQRT'] = envi_model.sc_data.obsm['COVET_SQRT']
sc_data.obsm['cell_type_niche'] = envi_model.sc_data.obsm['cell_type_niche']


And to just compute COVET for spatial data:

st_data.obsm['COVET'], st_data.obsm['COVET_SQRT'], st_data.uns['CovGenes'] = scenvi.compute_covet(st_data)

.. toctree::
:hidden:
:maxdepth: 2
:maxdepth: 4
:caption: Modules:

modules <modules>

.. toctree::
:hidden:
:caption: Tutorials:

MOp_MERFISH_tutorial.ipynb

.. mdinclude:: ../../README.md

Index
=====

* :ref:`genindex`



0 comments on commit 6844214

Please sign in to comment.