Skip to content

Added Sphinx Gallery with three new python tutorials #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,11 @@ dmypy.json
# Files generated during package build and CMD check, unnecessary for the package
atlasapprox.Rcheck/
.Rhistory
.RData
.RData

# sphinx gallery source and build files
docs/source/_build
docs/source/python/gallery

# OS files
**/.DS_Store
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
Quickstart
==========

This example shows a quick and easy example of how to use atlasapprox to get and plot the expression of some gees in a specific organ of a specific organism.
This example shows a quick and easy example of how to use atlasapprox to get and plot the expression of some gees in a
specific organ of a specific organism.
"""

import matplotlib.pyplot as plt
Expand All @@ -19,3 +20,5 @@
fig, ax = plt.subplots(figsize=(7, 4))
sns.heatmap(expression, ax=ax)
fig.tight_layout()

# sphinx_gallery_thumbnail_path = '_static/quickstart.png'
79 changes: 79 additions & 0 deletions docs/gallery/python/1_beginner_guide.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
"""
.. _beginner-guide:

Beginner guide
==============

The `atlasapprox <https://atlasapprox.readthedocs.io/en/latest/index.html>`_ API provides access to approximated
single-cell data across 30 species, including both animals and plants. You can explore data from species such as *Homo
sapiens* (humans), *Mus musculus* (mice), *Arabidopsis thaliana* (thale cress), and *Zea mays* (corn). Follow this guide
to get started with installation, basic usage, and example queries.
"""

# %%
# To ensure consistent dependencies, setting up a virtual environment is recommended before installing the package.
# Here's one way to do it:
#
# Create a virtual environment:
# ``python -m venv myenv``
#
# Activate your environment (use the appropriate command for your OS):
#
# For macOS/Linux users:
# ``source myenv/bin/activate``
#
# For Windows users:
# ``myenv\Scripts\activate``


# %%
# Installation
# ^^^^^^^^^^^^
# Use pip to install the *atlasapprox* Python package:
#
# ``pip install atlasapprox``

# %%
# Each time you work with the API, start by importing the *atlasapprox* Python package and instantiate the ``API``
# project:

import atlasapprox
api = atlasapprox.API()

# %%
# Easy start: getting average gene expression
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
# The ``average`` function allows you to retrieve gene expression levels for selected genes in a specific organ of an
# organism.
#
# The following example shows how to examine the average expression of five genes
# (*COL13A1*, *COL14A1*, *TGFBI*, *PDGFRA*, *GZMA*) in the human lung:

# Call API function with params
avg_gene_expr_lung = api.average(
organism = "h_sapiens",
organ = "lung",
features = ["COL13A1", "COL14A1", "TGFBI", "PDGFRA", "GZMA"],
measurement_type = "gene_expression"
)

# Display the result
avg_gene_expr_lung

# %%
# Understanding the output
# ------------------------
# This method returns a **pandas.DataFrame** where:
#
# - Each row represents a gene.
# - Each column corresponds to a cell type.
# - The values indicate the average gene expression, measured in counts per ten thousand (cptt).

# %%
# Conclusion
# ^^^^^^^^^^
# This tutorial provided a general beginner guide to using the *atlasapprox* Python package. For more detailed
# information, refer to the official
# `documentation <https://atlasapprox.readthedocs.io/en/latest/python/index.html>`_.

# sphinx_gallery_thumbnail_path = '_static/beginner_guide.png'
Loading