-
Notifications
You must be signed in to change notification settings - Fork 2
Added 4 Sphinx gallery python tutorials #43
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo gees |
||
specific organ of a specific organism. | ||
""" | ||
|
||
import matplotlib.pyplot as plt | ||
|
@@ -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' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need this? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
""" | ||
.. _beginner-guide: | ||
|
||
Beginner guide | ||
============== | ||
|
||
The `atlasapprox <https://atlasapprox.readthedocs.io/en/latest/index.html>`_ API provides access to approximated | ||
cell atlas data from 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). | ||
This guide walks you through installing the package, setting up the API, and running basic queries with simple examples. | ||
""" | ||
|
||
# %% | ||
# Setting up a virtual environment (optional) | ||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
# It's recommended to use a virtual environment to manage dependencies. Run the following command: | ||
# | ||
# ``python -m venv venv`` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually people typically put it into |
||
# | ||
# Activate the environment using the appropriate command for your operating system: | ||
# | ||
# For macOS/Linux: | ||
# ``source venv/bin/activate`` | ||
# | ||
# For Windows: | ||
# ``venv\Scripts\activate`` | ||
|
||
# %% | ||
# Installing required packages | ||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
# Install the ``atlasapprox`` package along with libraries needed for data visualization using *pip*: | ||
# | ||
# ``pip install atlasapprox matplotlib seaborn numpy pandas`` | ||
# | ||
# These packages will be used throughout the tutorials. | ||
|
||
# %% | ||
# Then, import required libraries and instantiate the ``API`` object: | ||
|
||
import atlasapprox | ||
|
||
api = atlasapprox.API() | ||
|
||
# %% | ||
# Querying available data | ||
# ^^^^^^^^^^^^^^^^^^^^^^^ | ||
# Explore available organisms, organs, and cell types using the following methods: | ||
|
||
# %% | ||
|
||
# List available organisms | ||
available_organisms = api.organisms() | ||
print(available_organisms) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just printing the API call directly? |
||
|
||
# %% | ||
|
||
# List available organs for humans | ||
available_organs = api.organs(organism="h_sapiens") | ||
print(available_organs) | ||
|
||
# %% | ||
|
||
# List available cell types in the human lung | ||
available_celltypes = api.celltypes(organism="h_sapiens", organ="lung") | ||
print(available_celltypes) | ||
|
||
|
||
# %% | ||
# Exploring average gene expression | ||
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
# The ``average`` method retrieves 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: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why these genes? |
||
|
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not obvious to many people that putting a variable out there visualises it |
||
|
||
# %% | ||
# Understanding the output | ||
# ------------------------ | ||
# The ``average`` method returns a **pandas.DataFrame** where: | ||
# | ||
# - Rows represent genes. | ||
# - Columns represent cell types. | ||
# - Values show average gene expression in counts per ten thousand (cptt). | ||
|
||
# %% | ||
# Conclusion | ||
# ^^^^^^^^^^ | ||
# This guide covers setup and basic data querying. 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' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why can't you just tell it the number of the figure instead? Having static files makes it difficult to maintain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's going on here?