. After editing source pages or notebooks, stop the
+server and rerun the preview command to refresh the staged documentation.
+
+## Open a pull request
+
+Run the checks relevant to your changes, review the generated documentation, and
+open a pull request on GitHub against `main`. Include a short summary of the change
+and any relevant testing or documentation notes.
+
+- Use `Closes #123` to close an issue automatically when the pull request merges.
+- Use `Refs #123` or link the issue in GitHub for related issues that remain open.
diff --git a/docs/extras/vcf_annotator.md b/docs/extras/vcf_annotator.md
deleted file mode 100644
index eced28b0..00000000
--- a/docs/extras/vcf_annotator.md
+++ /dev/null
@@ -1,52 +0,0 @@
-# VCF Annotator
-
-The [VCF Annotator tool](../../src/ga4gh/vrs/extras/annotator/vcf.py) provides a Python class for annotating VCFs with VRS Allele IDs. A [command-line interface](../../src/ga4gh/vrs/extras/annotator/cli.py) is available for accessing these functions from a shell or shell script.
-
-## How to use
-
-*Note:\
-The examples run from the root of the vrs-python directory and assumes that `input.vcf.gz` lives in the current directory*
-
-To see the help page:
-
-```commandline
-vrs-annotate vcf --help
-```
-
-### Configuring the sequence data proxy
-
-Like other VRS-Python tools, the VCF annotator requires access to [sequence and identifier data services](https://vrs.ga4gh.org/en/stable/impl-guide/required_data.html#data-services), as implemented in libraries like [SeqRepo](https://github.com/biocommons/biocommons.seqrepo). By default, the CLI will attempt to connect to a [SeqRepo REST instance](https://github.com/biocommons/seqrepo-rest-service) at `http://localhost:5000/seqrepo`, but a URI can be passed with the `--dataproxy-uri` option or set with the `GA4GH_VRS_DATAPROXY_URI` environment variable (the former takes priority over the latter).
-
-For example, to use a local set of SeqRepo data, you can use an absolute file path:
-
-```commandline
-vrs-annotate vcf --dataproxy-uri="seqrepo+file:///usr/local/share/seqrepo/2024-12-20/" --vcf-out=out.vcf.gz input.vcf.gz
-```
-
-Alternative, a relative file path:
-
-```commandline
-vrs-annotate vcf --dataproxy-uri="seqrepo+../seqrepo/2024-12-20/" --vcf-out=out.vcf.gz input.vcf.gz
-```
-
-Or an alternate REST path:
-
-```commandline
-vrs-annotate vcf --dataproxy-uri="seqrepo+http://mylabwebsite.org/seqrepo" --vcf-out=out.vcf.gz input.vcf.gz
-```
-
-### Other Options
-`--vrs-attributes`
->Will include VRS_Start, VRS_End, VRS_State fields in the INFO field.
-
-`--assembly` [TEXT]
->The assembly that the `vcf-in` data uses. [default: GRCh38]
-
-`--skip-ref`
->Skip VRS computation for REF alleles.
-
-`--require-validation`
->Require validation checks to pass in order to return a VRS object
-
-`--help`
->Show the options available
diff --git a/docs/extras/vrs-annotate.md b/docs/extras/vrs-annotate.md
new file mode 100644
index 00000000..c313e8a9
--- /dev/null
+++ b/docs/extras/vrs-annotate.md
@@ -0,0 +1,32 @@
+# VRS annotate
+
+Use `vrs-annotate` to annotate input files with VRS variation objects:
+
+```shell
+vrs-annotate --help
+```
+
+## VCF
+
+Install `ga4gh.vrs[extras]` and configure [SeqRepo](../data-services.md).
+Then annotate a VCF with VRS allele identifiers:
+
+```shell
+vrs-annotate vcf \
+ --dataproxy-uri='seqrepo+http://localhost:5000/seqrepo' \
+ --assembly=GRCh38 \
+ --vcf-out=out.vcf.gz \
+ input.vcf.gz
+```
+
+Set `--assembly` to the input VCF's reference assembly. Set the data-proxy URI with
+`--dataproxy-uri` or `GA4GH_VRS_DATAPROXY_URI`. The command-line option overrides
+the environment variable.
+
+For available options and defaults:
+
+```shell
+vrs-annotate vcf --help
+```
+
+To annotate from Python, see the [VCF annotation API](../api/vcf-annotation.md).
diff --git a/docs/index.md b/docs/index.md
new file mode 100644
index 00000000..fbc0464d
--- /dev/null
+++ b/docs/index.md
@@ -0,0 +1,45 @@
+# VRS-Python
+
+VRS-Python implements the
+[GA4GH Variation Representation Specification (VRS)](https://vrs.ga4gh.org/)
+in Python. It helps you represent variants consistently and compare records
+across data sources using identifiers computed from their content.
+
+Use VRS-Python to:
+
+- Build and validate VRS and GKM-Core objects with Pydantic
+ (see [VRS compatibility](compatibility.md)).
+- Normalize alleles and compute consistent GA4GH identifiers.
+- Translate supported HGVS, SPDI, and gnomAD expressions to VRS.
+- Annotate VCF files with VRS allele identifiers.
+- Store and exchange objects using inline or referenced components.
+
+## Start using VRS-Python
+
+
+
+- **[Install](installation.md)**
+
+ Choose the dependencies for your workflow.
+
+- **[Quick start](quick-start.md)**
+
+ Build your first allele and compute its identifier.
+
+- **[Explore with notebooks](notebooks/index.md)**
+
+ Work through models, sequence access, and translation examples.
+
+- **[API reference](api/index.md)**
+
+ Find Python classes, functions, and their parameters.
+
+- **[Set up SeqRepo and UTA](data-services.md)**
+
+ Connect sequence and transcript data for translation and normalization.
+
+- **[Contribute](development.md)**
+
+ Improve the implementation, examples, and documentation.
+
+
diff --git a/docs/installation.md b/docs/installation.md
new file mode 100644
index 00000000..ab06e206
--- /dev/null
+++ b/docs/installation.md
@@ -0,0 +1,65 @@
+# Installation
+
+VRS-Python requires **Python 3.11 or later**. Install it in a virtual environment:
+
+```shell
+python -m venv venv
+source venv/bin/activate
+python -m pip install ga4gh.vrs
+```
+
+The base package supports model validation, serialization, and identifier computation.
+
+## Translation, local sequence access, and VCF annotation
+
+Install `extras` for [SeqRepo](https://github.com/biocommons/seqrepo),
+[UTA](https://github.com/biocommons/uta),
+[HGVS support](https://github.com/biocommons/hgvs), and VCF annotation.
+
+### Prerequisites
+
+Install the prerequisites for your platform:
+
+#### macOS
+
+With [Homebrew](https://docs.brew.sh/Installation) installed, run:
+
+```shell
+brew update
+brew install libpq
+brew install python3
+brew install postgresql@14
+```
+
+#### Ubuntu
+
+```shell
+sudo apt install gcc libpq-dev python3-dev
+```
+
+### Install the extras
+
+In your virtual environment, run:
+
+```shell
+python -m pip install 'ga4gh.vrs[extras]'
+```
+
+Sequence and transcript datasets require separate setup:
+
+- Set up SeqRepo for allele normalization, SPDI/gnomAD translation, and VCF annotation.
+- Set up UTA for HGVS workflows that need transcript metadata or alignments.
+- Model construction, serialization, and identifier computation can run without
+ either service; reference sequence validation requires SeqRepo.
+
+Follow [Set up SeqRepo and UTA](data-services.md) for configuration instructions.
+
+## Notebooks
+
+The `notebooks` group includes dependencies for running the
+[example notebooks](notebooks/index.md). Include `extras` for the translation and
+sequence-access examples:
+
+```shell
+python -m pip install 'ga4gh.vrs[extras,notebooks]'
+```
diff --git a/docs/notebooks/index.md b/docs/notebooks/index.md
new file mode 100644
index 00000000..8273bfe7
--- /dev/null
+++ b/docs/notebooks/index.md
@@ -0,0 +1,79 @@
+# Explore with notebooks
+
+The walkthroughs below are rendered examples, so you can read them directly in
+your browser without installing anything. They demonstrate how to use VRS-Python
+to build variation models, compute identifiers, translate variant descriptions,
+and access sequence data. You can also download a notebook from its page and run
+it in Jupyter. Pages show saved outputs, which may differ from a fresh run against
+your installed release and configured data services.
+
+| Notebook | What you will learn |
+| --- | --- |
+| [Quick start](1_Quick_Start.md) | Translate a variant using sequence services |
+| [SeqRepo data proxy](2_Exploring_the_SeqRepo_DataProxy.md) | Retrieve sequences and resolve aliases |
+| [Basic models](3_Basic_Models.md) | Build alleles and compute identifiers |
+| [Allele translator](4_Exploring_the_AlleleTranslator.md) | Translate supported variant nomenclatures |
+| [CNV translator](5_Exploring_the_CnvTranslator.md) | Represent copy number variation |
+| [Upcoming features](6_Upcoming_features.md) | Explore development examples, subject to change |
+| [Uncertain HGVS ranges](7_Uncertain_Range_HGVS.md) | Work with uncertain coordinates |
+
+!!! note "Data access"
+
+ Some notebooks use public demonstration endpoints for sequence and transcript
+ data. These endpoints are intended for exploring the examples. For heavy
+ workloads or production use, we recommend running your own local services.
+ Follow [SeqRepo and UTA](../data-services.md) to set them up, then update the
+ notebooks to use your endpoints. Inspect setup cells before running them,
+ since they may override environment variables you set in the shell.
+
+## Run the notebooks with MyBinder
+
+[Binder](https://mybinder.org) provides a ready-to-use computing environment for running
+the notebooks directly in your browser, with no local installation required.
+
+You can launch the notebooks on Binder [here](https://mybinder.org/v2/gh/ga4gh/vrs-python/v3?labpath=notebooks).
+
+Once launched, select `VRS_kernel` as the notebook kernel.
+
+## Run the notebooks locally
+
+Clone the [VRS-Python repository](https://github.com/ga4gh/vrs-python), then follow the
+[Installation steps](../installation.md) to create the virtual environment (`venv`)
+and activate it.
+
+!!! note "Notebook dependency"
+
+ If you did not install the `notebooks` optional dependency during setup,
+ run this command from the root of the cloned project (`vrs-python/`),
+ with the virtual environment activated:
+
+ ```shell
+ python3 -m pip install "ga4gh.vrs[extras,notebooks]"
+ ```
+
+### Open a notebook
+
+We recommend either of the following options for opening a notebook.
+
+#### JupyterLab
+
+1. In the terminal, activate the project's `venv` virtual environment:
+
+ source venv/bin/activate
+
+2. In the activated virtual environment, start [JupyterLab](https://docs.jupyter.org/en/latest/):
+
+ python3 -m jupyterlab
+
+3. JupyterLab usually opens automatically in a new browser window. If it does not, open
+ the URL shown in the terminal.
+4. Open a notebook from the `notebooks/` directory.
+
+#### VS Code
+
+1. Install the [Python extension](https://marketplace.visualstudio.com/items?itemName=ms-python.python)
+ and [Jupyter extension](https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter).
+2. Open the project root in VS Code and open a notebook from the
+ `notebooks/` directory.
+3. Select **Select Kernel** in the upper-right corner and choose the Python
+ interpreter from the repository's `venv` virtual environment.
diff --git a/docs/quick-start.md b/docs/quick-start.md
new file mode 100644
index 00000000..456e8e68
--- /dev/null
+++ b/docs/quick-start.md
@@ -0,0 +1,151 @@
+# Quick start
+
+Build a VRS allele, compute its identifier, and translate between HGVS and VRS.
+
+- **Build and identify:** uses SeqRepo to resolve a reference sequence accession.
+- **Translate HGVS:** also configures UTA for transcript metadata and alignments.
+
+Identifier computation itself does not require an external service.
+
+## Build and identify an allele
+
+Before running this example:
+
+1. Install [extras](installation.md#install-the-extras).
+2. Start [SeqRepo](data-services.md#docker-compose).
+
+Create an allele for `NC_000019.10:g.44908684T>C`:
+
+```python
+from ga4gh.core import ga4gh_identify
+from ga4gh.vrs import models
+from ga4gh.vrs.dataproxy import create_dataproxy
+
+dp = create_dataproxy("seqrepo+http://localhost:5000/seqrepo")
+
+# Resolve the RefSeq accession to a RefGet accession.
+refget_accession = dp.derive_refget_accession("NC_000019.10")
+if refget_accession is None:
+ raise ValueError("NC_000019.10 was not found in the SeqRepo dataset")
+
+allele = models.Allele(
+ # Reference sequence and interval to replace.
+ location=models.SequenceLocation(
+ sequenceReference=models.SequenceReference(
+ refgetAccession=refget_accession
+ ),
+ # Zero-based, inter-residue coordinates spanning residue 44908684.
+ start=44908683,
+ end=44908684,
+ ),
+ state=models.LiteralSequenceExpression(sequence="C"), # Replacement sequence.
+)
+```
+
+Compute the identifier and print the allele as JSON:
+
+```python
+identifier = ga4gh_identify(allele)
+print(identifier)
+print(allele.model_dump_json(exclude_none=True, indent=2))
+```
+
+The identifier is:
+
+```text
+ga4gh:VA.NsWfIPdbQ9LWo4Z5f9lIhMW87kZCtrEc
+```
+
+In the JSON, `id` is the GA4GH identifier, `digest` is its digest component,
+and `type` names the VRS object type:
+
+```json
+{
+ "id": "ga4gh:VA.NsWfIPdbQ9LWo4Z5f9lIhMW87kZCtrEc",
+ "type": "Allele",
+ "digest": "NsWfIPdbQ9LWo4Z5f9lIhMW87kZCtrEc",
+ "location": {
+ "type": "SequenceLocation",
+ "digest": "bqt0x0LbTvEpKXw2x7cUfww7mI_Q_pZJ",
+ "sequenceReference": {
+ "type": "SequenceReference",
+ "refgetAccession": "SQ.IIB53T8CNeJJdUqzn9V_JnRtQadwWCbl"
+ },
+ "start": 44908683,
+ "end": 44908684
+ },
+ "state": {
+ "type": "LiteralSequenceExpression",
+ "sequence": "C"
+ }
+}
+```
+
+## Translate HGVS to VRS
+
+Start [UTA](data-services.md#docker-compose) before running this example.
+
+Configure UTA and create a translator with the data proxy from above:
+
+```python
+import os
+
+os.environ["UTA_DB_URL"] = "postgresql://anonymous:anonymous@localhost:5432/uta/uta_20241220"
+
+from ga4gh.vrs.extras.translator import AlleleTranslator
+
+translator = AlleleTranslator(dp)
+```
+
+Translate the same HGVS expression. By default, translation
+[normalizes the allele](api/normalization.md) and computes its identifier:
+
+```python
+allele = translator.to_vrs("NC_000019.10:g.44908684T>C", fmt="hgvs")
+print(allele.model_dump_json(exclude_none=True, indent=2))
+```
+
+The allele and its identifier match the first example. Translation also assigns
+an `id` to the location:
+
+```json
+{
+ "id": "ga4gh:VA.NsWfIPdbQ9LWo4Z5f9lIhMW87kZCtrEc",
+ "type": "Allele",
+ "digest": "NsWfIPdbQ9LWo4Z5f9lIhMW87kZCtrEc",
+ "location": {
+ "id": "ga4gh:SL.bqt0x0LbTvEpKXw2x7cUfww7mI_Q_pZJ",
+ "type": "SequenceLocation",
+ "digest": "bqt0x0LbTvEpKXw2x7cUfww7mI_Q_pZJ",
+ "sequenceReference": {
+ "type": "SequenceReference",
+ "refgetAccession": "SQ.IIB53T8CNeJJdUqzn9V_JnRtQadwWCbl"
+ },
+ "start": 44908683,
+ "end": 44908684
+ },
+ "state": {
+ "type": "LiteralSequenceExpression",
+ "sequence": "C"
+ }
+}
+```
+
+## Translate back to HGVS
+
+`from_vrs` returns a list because a sequence can have multiple accessions.
+By default, it uses RefSeq accessions in your SeqRepo dataset:
+
+```python
+hgvs_expressions = translator.from_vrs(allele, fmt="hgvs")
+print(hgvs_expressions)
+```
+
+The result includes the original expression; other entries depend on your dataset:
+
+```text
+['NC_000019.10:g.44908684T>C']
+```
+
+See the [translation API](api/translation-and-hgvs.md) for options or
+[explore the notebooks](notebooks/index.md) for more examples.
diff --git a/docs/setup_help/m1_mac_setup.md b/docs/setup_help/m1_mac_setup.md
deleted file mode 100644
index 0b354cb6..00000000
--- a/docs/setup_help/m1_mac_setup.md
+++ /dev/null
@@ -1,49 +0,0 @@
-#Notes from Wes Goar on setup of vrs-python on a m1 mac
-- date: 20220328
-- macOS version: 12.3
-- python version: 3.9.11
-
-##Notes
-- I installed seqrepo before trying this setup.
-- I had already installed xcode and homebrew on my machine.
-- This installation assumes you are using zsh. Please change the commands to fit your environment of choice.
-
-###Steps
-1. brew install openssl
-2. add the following statement in your .zshrc:
-```shell
-export PATH="/opt/homebrew/opt/openssl@1.1/bin:$PATH"
-```
-
-3. Run brew info openssl to ascertain the correct environment path to put into the export statements (add the following statements, but follow your info, into your .zshenv:)
-```shell
-export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib"
-export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include"
-export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig"
-```
-
-4. source ~/.zshrc
-5. source ~/.zshenv
-6. brew install libpq
-7. add the following statement in your .zshrc:
-```shell
-export PATH="/opt/homebrew/opt/libpq/bin:$PATH"
-```
-8. Run brew info libpq to ascertain the correct environment path to append to the appropriate flags (add the following statements, but follow your info, into your .zshenv:)
-
-```shell
-export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libpq/lib"
-export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include -I/opt/homebrew/opt/libpq/include"
-export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.1/lib/pkgconfig:/opt/homebrew/opt/libpq/lib/pkgconfig"
-```
-
-9. source ~/.zshenv
-10. brew install postgres
-11. add the following statement in your .zshrc: export PATH="/opt/homebrew/opt/postgresql@14/bin:$PATH"
- ###Make sure that you update the @14 with your own version
-12. source ~/.zshrc
-13. Install UTA (/docs/setup_help/uta_installation.md)
-14. Run the make devready command:
- 1. `make devready`
-15. Run the make test command:
- 1. `make test`
diff --git a/docs/setup_help/uta_installation.md b/docs/setup_help/uta_installation.md
deleted file mode 100644
index e7aee780..00000000
--- a/docs/setup_help/uta_installation.md
+++ /dev/null
@@ -1,33 +0,0 @@
-1. Switch to your admin account #Skip if your user already has sudo permissions
- 1. `su wag002adm` # replace with your admin account name
-2. Start postgres
- 1. `pg_ctl -D /opt/homebrew/var/postgres start`
- 2. `ps aux | grep postgres` #to make sure that this process is running
-3. Start psql and open database postgres, which is the database postgres uses itself to store roles, permissions, and structure:
- 1. `psql postgres`
-4. Create roles for the application, give login and CREATEDB permissions:
- 1. `CREATE ROLE uta_admin WITH LOGIN CREATEDB;`
- 2. `CREATE ROLE anonymous WITH LOGIN CREATEDB;`
-5. List the users using the command
- 1. `\du`
-6. Create the UTA Database object
- 1. `CREATE DATABASE uta;`
-7. Grant privileges to manage the database to uta_admin
- 1. `GRANT ALL PRIVILEGES ON DATABASE uta TO uta_admin;`
-8. Exit postgres
- 1. `\q`
-9. Download the UTA database and place it in the uta database object that you created before (**This step takes around 5 hours**).
- 1. `export UTA_VERSION=uta_20241220.pgd.gz\ncurl -O http://dl.biocommons.org/uta/$UTA_VERSION\ngzip -cdq ${UTA_VERSION} | psql -h localhost -U uta_admin --echo-errors --single-transaction -v ON_ERROR_STOP=1 -d uta -p 5432`
-10. Set your UTA path
- 1. `export UTA_DB_URL=postgresql://uta_admin@localhost:5432/uta/uta_20241220`
-###Optional installation step
-11. If you wanted to wait for the 5 hour update till later please follow these steps instead:
-12. Download the UTA database and place it in the uta database object that you created before.
- 1. `export UTA_VERSION=uta_20241220.pgd.gz
-curl -O http://dl.biocommons.org/uta/$UTA_VERSION
-gzip -cdq ${UTA_VERSION} | grep -v "^REFRESH MATERIALIZED VIEW" | psql -h localhost -U uta_admin --echo-errors --single-transaction -v ON_ERROR_STOP=1 -d uta -p 5432`
-13. Run the refresh materialized view commands
- 1. `REFRESH MATERIALIZED VIEW uta_20241220.exon_set_exons_fp_mv;`
- 2. `REFRESH MATERIALIZED VIEW uta_20241220.tx_exon_set_summary_mv;`
- 3. `REFRESH MATERIALIZED VIEW uta_20241220.tx_def_summary_mv;`
- 4. `REFRESH MATERIALIZED VIEW uta_20241220.tx_similarity_mv;` #**This step will take 5 or more hours**
diff --git a/pyproject.toml b/pyproject.toml
index 365f697b..75556c7c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -65,8 +65,9 @@ lint = [
"ruff==0.9.4",
]
docs = [
- "sphinx",
- "sphinx_rtd_theme",
+ "zensical==0.0.59",
+ "mkdocstrings-python",
+ "nbconvert>=7,<8",
]
notebooks = [
"jupyter",
@@ -75,7 +76,7 @@ notebooks = [
[project.urls]
Homepage = "https://github.com/ga4gh/vrs-python"
-Documentation = "https://github.com/ga4gh/vrs-python"
+Documentation = "https://ga4gh.github.io/vrs-python/latest/"
Changelog = "https://github.com/ga4gh/vrs-python/releases"
Source = "https://github.com/ga4gh/vrs-python"
"Bug Tracker" = "https://github.com/ga4gh/vrs-python/issues"
diff --git a/scripts/__init__.py b/scripts/__init__.py
new file mode 100644
index 00000000..06f551ae
--- /dev/null
+++ b/scripts/__init__.py
@@ -0,0 +1 @@
+"""Documentation build utilities."""
diff --git a/scripts/build_docs.py b/scripts/build_docs.py
new file mode 100644
index 00000000..85cde510
--- /dev/null
+++ b/scripts/build_docs.py
@@ -0,0 +1,94 @@
+"""Stage authored pages, supported versions, and notebooks for Zensical."""
+
+import json
+import re
+from pathlib import Path
+from shutil import copy2, copytree, rmtree
+
+from nbconvert import MarkdownExporter
+
+from ga4gh.core.version import CORE_VERSION
+from ga4gh.vrs.version import VRS_VERSION
+
+ROOT = Path(__file__).resolve().parents[1]
+
+
+def output_language(text: str, default: str = "text") -> str:
+ """Select JSON highlighting for JSON values, otherwise use the fallback.
+
+ :param text: Saved notebook output.
+ :param default: Language for non-JSON output.
+ :return: Code-fence language.
+ """
+ try:
+ json.loads(text)
+ except (ValueError, TypeError):
+ return default
+ return "json"
+
+
+def update_supported_versions(path: Path) -> None:
+ """Replace the supported-versions marker with the installed versions.
+
+ :param path: Staged compatibility page.
+ """
+ table = (
+ "| Standard | Supported version |\n| --- | --- |\n"
+ f"| VRS | {VRS_VERSION} |\n| GKM-Core | {CORE_VERSION} |"
+ )
+ content = path.read_text(encoding="utf-8")
+ path.write_text(
+ content.replace("", table), encoding="utf-8"
+ )
+
+
+def stage_notebook(source: Path, destination: Path, exporter: MarkdownExporter) -> None:
+ """Write a notebook's rendered page, source, and saved output files.
+
+ :param source: Notebook within the repository.
+ :param destination: Staged notebook directory.
+ :param exporter: Markdown exporter using saved notebook outputs.
+ """
+ body, resources = exporter.from_filename(str(source))
+ body = body.replace("](README.md)", "](index.md)")
+ # Notebook links should open the corresponding rendered page.
+ body = re.sub(r"\]\(([^:)]+)\.ipynb(#[^)]*)?\)", r"](\1.md\2)", body)
+
+ notice = (
+ '!!! info "Notebook source"\n\n'
+ f" Rendered from [{source.relative_to(ROOT)}]({source.name}).\n\n"
+ )
+ if "Upcoming" in source.name:
+ notice += (
+ '!!! warning "Exploratory material"\n\n'
+ " This notebook describes upcoming features, not a guarantee of "
+ "support in the current release.\n\n"
+ )
+
+ (destination / f"{source.stem}.md").write_text(notice + body, encoding="utf-8")
+ copy2(source, destination / source.name)
+ for name, data in resources.get("outputs", {}).items():
+ target = destination / name
+ target.parent.mkdir(parents=True, exist_ok=True)
+ target.write_bytes(data)
+
+
+def main() -> None:
+ """Rebuild docs-build from source without executing notebooks."""
+ output = ROOT / "docs-build"
+ if output.exists():
+ rmtree(output)
+ copytree(ROOT / "docs", output)
+ update_supported_versions(output / "compatibility.md")
+
+ exporter = MarkdownExporter(
+ extra_template_basedirs=[str(ROOT / "scripts/templates")],
+ template_file=str(ROOT / "scripts/templates/notebook.md.j2"),
+ filters={"output_language": output_language},
+ )
+ for source in sorted((ROOT / "notebooks/getting_started").glob("*.ipynb")):
+ stage_notebook(source, output / "notebooks", exporter)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/scripts/templates/notebook.md.j2 b/scripts/templates/notebook.md.j2
new file mode 100644
index 00000000..4ad6df59
--- /dev/null
+++ b/scripts/templates/notebook.md.j2
@@ -0,0 +1,31 @@
+{% extends 'markdown/index.md.j2' %}
+
+{% block input %}
+````python{% if cell.execution_count is not none %} title="In [{{ cell.execution_count }}]"{% endif %}
+{{ cell.source }}
+````
+{% endblock input %}
+
+{% block stream %}
+**Output:**
+
+````{{ output.text | output_language }}
+{{ output.text | strip_ansi | trim }}
+````
+{% endblock stream %}
+
+{% block data_text scoped %}
+**Output:**
+
+````{{ output.data['text/plain'] | output_language('python') }}
+{{ output.data['text/plain'] | strip_ansi | trim }}
+````
+{% endblock data_text %}
+
+{% block error %}
+**Output:**
+
+````text
+{{ output.traceback | join('\n') | strip_ansi }}
+````
+{% endblock error %}
diff --git a/src/ga4gh/core/digests.py b/src/ga4gh/core/digests.py
index 1ffbe2d4..3fe40580 100644
--- a/src/ga4gh/core/digests.py
+++ b/src/ga4gh/core/digests.py
@@ -21,11 +21,11 @@ def sha512t24u(blob: bytes) -> str:
For example:
- >>> sha512t24u(b"")
- 'z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXc'
+ >>> sha512t24u(b"")
+ 'z4PhNX7vuL3xVChQ1m2AB9Yg5AULVxXc'
- >>> sha512t24u(b"ACGT")
- 'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2'
+ >>> sha512t24u(b"ACGT")
+ 'aKF498dAxcJAqme6QYQ7EZ07-fiw8Kw2'
:param blob: Binary data to digest.
:return: URL-safe base64 encoding of the first 24 digest bytes.
diff --git a/src/ga4gh/core/identifiers.py b/src/ga4gh/core/identifiers.py
index a36b747e..3bb68d3a 100644
--- a/src/ga4gh/core/identifiers.py
+++ b/src/ga4gh/core/identifiers.py
@@ -144,14 +144,16 @@ def __exit__(
def is_ga4gh_identifier(ir: object) -> bool:
"""Check whether a value starts with the GA4GH namespace prefix
- >>> is_ga4gh_identifier("ga4gh:SQ.0123abcd")
- True
+ For example:
- >>> is_ga4gh_identifier("refseq:NM_01234.5")
- False
+ >>> is_ga4gh_identifier("ga4gh:SQ.0123abcd")
+ True
- >>> is_ga4gh_identifier(None)
- False
+ >>> is_ga4gh_identifier("refseq:NM_01234.5")
+ False
+
+ >>> is_ga4gh_identifier(None)
+ False
:param ir: Value or root model to inspect.
:return: Whether the value has the GA4GH namespace prefix.
@@ -182,17 +184,19 @@ def ga4gh_identify(
updates; it does not override the context policy. Accepts a supported PrevVrsVersion
member or its string value. Raises ValueError for other version values.
- >>> from ga4gh.core import ga4gh_identify
- >>> import ga4gh.vrs
- >>> location = ga4gh.vrs.models.SequenceLocation(
- ... start=44908821,
- ... end=44908822,
- ... sequenceReference=ga4gh.vrs.models.SequenceReference(
- ... refgetAccession="SQ.F-LrLMe1SRpfUZHkQmvkVKFEGaoDeHul"
- ... ),
- ... )
- >>> ga4gh_identify(location)
- 'ga4gh:SL.4t6JnYWqHwYw9WzBT_lmWBb3tLQNalkT'
+ For example:
+
+ >>> from ga4gh.core import ga4gh_identify
+ >>> import ga4gh.vrs
+ >>> location = ga4gh.vrs.models.SequenceLocation(
+ ... start=44908821,
+ ... end=44908822,
+ ... sequenceReference=ga4gh.vrs.models.SequenceReference(
+ ... refgetAccession="SQ.F-LrLMe1SRpfUZHkQmvkVKFEGaoDeHul"
+ ... ),
+ ... )
+ >>> ga4gh_identify(location)
+ 'ga4gh:SL.4t6JnYWqHwYw9WzBT_lmWBb3tLQNalkT'
:param vro: GA4GH model implementing is_ga4gh_identifiable and the digest
and identifier methods used for identifiable objects.
@@ -236,17 +240,19 @@ def ga4gh_digest(
supported PrevVrsVersion member or its string value. Raises ValueError for other
version values.
- >>> from ga4gh.core import ga4gh_digest
- >>> import ga4gh.vrs
- >>> location = ga4gh.vrs.models.SequenceLocation(
- ... start=44908821,
- ... end=44908822,
- ... sequenceReference=ga4gh.vrs.models.SequenceReference(
- ... refgetAccession="SQ.F-LrLMe1SRpfUZHkQmvkVKFEGaoDeHul"
- ... ),
- ... )
- >>> ga4gh_digest(location)
- '4t6JnYWqHwYw9WzBT_lmWBb3tLQNalkT'
+ For example:
+
+ >>> from ga4gh.core import ga4gh_digest
+ >>> import ga4gh.vrs
+ >>> location = ga4gh.vrs.models.SequenceLocation(
+ ... start=44908821,
+ ... end=44908822,
+ ... sequenceReference=ga4gh.vrs.models.SequenceReference(
+ ... refgetAccession="SQ.F-LrLMe1SRpfUZHkQmvkVKFEGaoDeHul"
+ ... ),
+ ... )
+ >>> ga4gh_digest(location)
+ '4t6JnYWqHwYw9WzBT_lmWBb3tLQNalkT'
:param vro: GA4GH model implementing is_ga4gh_identifiable and the digest
and identifier methods used for identifiable objects.
diff --git a/src/ga4gh/vrs/dataproxy.py b/src/ga4gh/vrs/dataproxy.py
index 04ca6b8f..24ae9303 100644
--- a/src/ga4gh/vrs/dataproxy.py
+++ b/src/ga4gh/vrs/dataproxy.py
@@ -61,8 +61,10 @@ def get_sequence(
If the given sequence does not exist, KeyError is raised. If start is after end,
DataProxyValidationError may be raised.
- >>> dp.get_sequence("NM_000551.3", 0, 10)
- 'CCTCGCCTCC'
+ For example:
+
+ >>> dp.get_sequence("NM_000551.3", 0, 10)
+ 'CCTCGCCTCC'
:param identifier: Sequence identifier to resolve.
:param start: Zero-based inclusive start, or None for the sequence start.
@@ -78,16 +80,18 @@ def get_metadata(self, identifier: str) -> dict:
If the given sequence does not exist, KeyError is raised.
- >>> dp.get_metadata("NM_000551.3")
- {'added': '2016-08-24T05:03:11Z',
- 'aliases': ['MD5:215137b1973c1a5afcf86be7d999574a',
- 'RefSeq:NM_000551.3',
- 'SEGUID:T12L0p2X5E8DbnL0+SwI4Wc1S6g',
- 'SHA1:4f5d8bd29d97e44f036e72f4f92c08e167354ba8',
- 'ga4gh:SQ.v_QTc1p-MUYdgrRv4LMT6ByXIOsdw3C_',
- 'gi:319655736'],
- 'alphabet': 'ACGT',
- 'length': 4560}
+ For example:
+
+ >>> dp.get_metadata("NM_000551.3")
+ {'added': '2016-08-24T05:03:11Z',
+ 'aliases': ['MD5:215137b1973c1a5afcf86be7d999574a',
+ 'RefSeq:NM_000551.3',
+ 'SEGUID:T12L0p2X5E8DbnL0+SwI4Wc1S6g',
+ 'SHA1:4f5d8bd29d97e44f036e72f4f92c08e167354ba8',
+ 'ga4gh:SQ.v_QTc1p-MUYdgrRv4LMT6ByXIOsdw3C_',
+ 'gi:319655736'],
+ 'alphabet': 'ACGT',
+ 'length': 4560}
:param identifier: Sequence identifier to resolve.
:return: Sequence metadata, including length and aliases.
@@ -489,9 +493,11 @@ def __getitem__(self, key: int | slice) -> str:
def _isoformat(o: datetime.datetime) -> str:
"""Convert datetime.datetime to iso formatted timestamp
- >>> dt = datetime.datetime(2019, 10, 15, 10, 23, 41, 115927)
- >>> _isoformat(dt)
- '2019-10-15T10:23:41.115927Z'
+ For example:
+
+ >>> dt = datetime.datetime(2019, 10, 15, 10, 23, 41, 115927)
+ >>> _isoformat(dt)
+ '2019-10-15T10:23:41.115927Z'
:param o: date object to format
:return: ISO8601-formatted string equivalent
diff --git a/src/ga4gh/vrs/extras/translator.py b/src/ga4gh/vrs/extras/translator.py
index a3e3aa58..b23ffb6a 100644
--- a/src/ga4gh/vrs/extras/translator.py
+++ b/src/ga4gh/vrs/extras/translator.py
@@ -329,11 +329,11 @@ def from_gnomad(
With ``tlr`` configured for the reference sequence, disable normalization
to inspect the input coordinates and alternate sequence:
- >>> a = tlr.from_gnomad("1-55516888-G-GA", do_normalize=False)
- >>> a.location.start, a.location.end
- (55516887, 55516888)
- >>> a.state.sequence.root
- 'GA'
+ >>> a = tlr.from_gnomad("1-55516888-G-GA", do_normalize=False)
+ >>> a.location.start, a.location.end
+ (55516887, 55516888)
+ >>> a.state.sequence.root
+ 'GA'
"""
if not isinstance(gnomad_expr, str):
@@ -433,11 +433,11 @@ def from_spdi(
With ``tlr`` configured for the reference sequence, disable normalization
to inspect the input coordinates and alternate sequence:
- >>> a = tlr.from_spdi("NC_000013.11:32936731:1:C", do_normalize=False)
- >>> a.location.start, a.location.end
- (32936731, 32936732)
- >>> a.state.sequence.root
- 'C'
+ >>> a = tlr.from_spdi("NC_000013.11:32936731:1:C", do_normalize=False)
+ >>> a.location.start, a.location.end
+ (32936731, 32936732)
+ >>> a.state.sequence.root
+ 'C'
"""
if not isinstance(spdi_expr, str):
diff --git a/zensical.toml b/zensical.toml
new file mode 100644
index 00000000..1c4cfe19
--- /dev/null
+++ b/zensical.toml
@@ -0,0 +1,115 @@
+[project]
+site_name = "VRS-Python"
+site_description = "Represent, normalize, and identify genomic variation in Python"
+site_url = "https://ga4gh.github.io/vrs-python/"
+repo_url = "https://github.com/ga4gh/vrs-python"
+repo_name = "ga4gh/vrs-python"
+edit_uri = "edit/main/docs/"
+docs_dir = "docs-build"
+extra_css = ["assets/css/extra.css"]
+extra_javascript = ["assets/js/external-links.js"]
+strict = true
+nav = [
+ { Home = "index.md" },
+ { Installation = "installation.md" },
+ { "Quick start" = "quick-start.md" },
+ { "Set up SeqRepo and UTA" = "data-services.md" },
+ { "VRS annotate" = "extras/vrs-annotate.md" },
+ { "Explore with notebooks" = [
+ "notebooks/index.md",
+ { "Quick start" = "notebooks/1_Quick_Start.md" },
+ { "Sequence access" = "notebooks/2_Exploring_the_SeqRepo_DataProxy.md" },
+ { "Models" = "notebooks/3_Basic_Models.md" },
+ { "Allele translation" = "notebooks/4_Exploring_the_AlleleTranslator.md" },
+ { "Copy number translation" = "notebooks/5_Exploring_the_CnvTranslator.md" },
+ { "Upcoming features" = "notebooks/6_Upcoming_features.md" },
+ { "Uncertain HGVS ranges" = "notebooks/7_Uncertain_Range_HGVS.md" },
+ ] },
+ { "API reference" = [
+ "api/index.md",
+ { "GKM-Core models" = "api/core-models.md" },
+ { "VRS models" = "api/vrs-models.md" },
+ { "Identifiers and digests" = "api/identifiers-and-digests.md" },
+ { Normalization = "api/normalization.md" },
+ { "Data proxies" = "api/data-proxies.md" },
+ { "Translation and HGVS" = "api/translation-and-hgvs.md" },
+ { "Object references and storage" = "api/object-references-and-storage.md" },
+ { "VCF annotation" = "api/vcf-annotation.md" },
+ ] },
+ { "VRS compatibility" = "compatibility.md" },
+ { "Development and contributing" = "development.md" },
+]
+
+[project.extra.version]
+provider = "mike"
+default = "latest"
+
+[project.theme]
+variant = "classic"
+logo = "assets/images/ga4gh-favicon.svg"
+favicon = "assets/images/ga4gh-favicon.svg"
+features = [
+ "navigation.indexes",
+ "navigation.top",
+ "toc.follow",
+ "content.action.edit",
+ "content.code.copy",
+ "content.tabs.link",
+ "search.suggest",
+ "search.highlight",
+]
+
+# Palette toggle for automatic mode
+[[project.theme.palette]]
+media = "(prefers-color-scheme)"
+toggle.icon = "lucide/sun-moon"
+toggle.name = "Switch to light mode"
+
+# Palette toggle for light mode
+[[project.theme.palette]]
+media = "(prefers-color-scheme: light)"
+scheme = "default"
+primary = "custom"
+accent = "custom"
+toggle.icon = "lucide/sun"
+toggle.name = "Switch to dark mode"
+
+# Palette toggle for dark mode
+[[project.theme.palette]]
+media = "(prefers-color-scheme: dark)"
+scheme = "slate"
+primary = "custom"
+accent = "custom"
+toggle.icon = "lucide/moon"
+toggle.name = "Switch to system preference"
+
+[project.plugins.search]
+
+[project.plugins.mkdocstrings.handlers.python]
+paths = ["src"]
+options.docstring_style = "sphinx"
+options.filters = ["!^_[^_]"]
+options.inherited_members = false
+options.merge_init_into_class = true
+options.members_order = "source"
+options.separate_signature = true
+options.show_signature_annotations = true
+options.show_source = false
+options.show_symbol_type_heading = true
+options.show_symbol_type_toc = true
+options.signature_crossrefs = true
+
+[project.markdown_extensions]
+admonition = {}
+attr_list = {}
+md_in_html = {}
+pymdownx.details = {}
+pymdownx.superfences = {}
+tables = {}
+pymdownx.inlinehilite = {}
+pymdownx.highlight.anchor_linenums = true
+pymdownx.tabbed.alternate_style = true
+pymdownx.emoji.emoji_index = "zensical.extensions.emoji.twemoji"
+pymdownx.emoji.emoji_generator = "zensical.extensions.emoji.to_svg"
+pymdownx.snippets.base_path = ["."]
+pymdownx.snippets.check_paths = true