Example notebook

Example notebook#

import numpy as np
import pandas as pd
from anndata import AnnData
adata = AnnData(np.random.normal(size=(20, 10)))

With myst it is possible to link in the text cell of a notebook such as this one the documentation of a function or a class.

Let’s take as an example the class scldm.TransformerVAE. You can see that by clicking on the text, the link redirects to the API documentation of the class. Check the raw markdown of this cell to understand how this is specified.

This works also for any package listed by intersphinx. Go to docs/conf.py and look for the intersphinx_mapping variable. There, you will see a list of packages (that this package is dependent on) for which this functionality is supported.

For instance, we can link to the class anndata.AnnData, to the attribute anndata.AnnData.obs or the method anndata.AnnData.write().

Again, check the raw markdown of this cell to see how each of these links are specified.

You can read more about this in the intersphinx page and the myst page.

# Example: scldm provides TransformerVAE and ScviVAE models
# For actual usage, refer to the experiments/configs directory for configuration examples
pd.DataFrame().assign(A=["a", "b", "c"], B=[1, 2, 3])
A B
0 a 1
1 b 2
2 c 3