-
Notifications
You must be signed in to change notification settings - Fork 0
mkdocs + zensical #5
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
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 |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| # API Reference | ||
|
|
||
| ## Functional API | ||
|
|
||
| ::: rtemis.a3.create_a3 | ||
|
|
||
| ::: rtemis.a3.a3_from_json | ||
|
|
||
| ::: rtemis.a3.a3_to_json | ||
|
|
||
| ::: rtemis.a3.residue_at | ||
|
|
||
| ::: rtemis.a3.variants_at | ||
|
|
||
| ## File I/O | ||
|
|
||
| ::: rtemis.a3.read_a3json | ||
|
|
||
| ::: rtemis.a3.write_a3json | ||
|
|
||
| ## Types | ||
|
|
||
| ::: rtemis.a3.A3 | ||
|
|
||
| ::: rtemis.a3.VariantRecord | ||
|
|
||
| ## Errors | ||
|
|
||
| ::: rtemis.a3.A3ValidationError | ||
|
|
||
| ::: rtemis.a3.A3ParseError |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| # rtemis-a3 | ||
|
|
||
| Python implementation of the **Amino Acid Annotation (A3)** format — | ||
| a structured JSON format for amino acid sequences with site, region, PTM, | ||
| processing, and variant annotations. | ||
|
|
||
| Part of the [rtemis-org/a3](https://github.com/rtemis-org/a3) monorepo, | ||
| which provides A3 implementations in Python, TypeScript, R, Julia, and Rust. | ||
|
|
||
| ## Installation | ||
|
|
||
| ```bash | ||
| pip install rtemis-a3 | ||
| # or with uv | ||
| uv add rtemis-a3 | ||
| ``` | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ```python | ||
| from rtemis.a3 import create_a3 | ||
|
|
||
| a3 = create_a3( | ||
| "MKTAYIAKQR", | ||
| site={ | ||
| "Active site": {"index": [3, 5], "type": "activeSite"}, | ||
| }, | ||
| region={ | ||
| "Repeat 1": {"index": [[1, 4]], "type": ""}, | ||
| }, | ||
| ptm={ | ||
| "Phosphorylation": {"index": [7], "type": ""}, | ||
| }, | ||
| variant=[{"position": 3, "from": "K", "to": "R"}], | ||
| metadata={ | ||
| "uniprot_id": "P12345", | ||
| "description": "Example protein", | ||
| "organism": "Homo sapiens", | ||
| }, | ||
| ) | ||
|
|
||
| len(a3.sequence) # 10 | ||
| ``` | ||
|
|
||
| ## Parsing JSON | ||
|
|
||
| ```python | ||
| from rtemis.a3 import a3_from_json, A3ValidationError, A3ParseError | ||
|
|
||
| try: | ||
| a3 = a3_from_json(json_string) | ||
| except A3ValidationError as e: | ||
| print(e.errors) # list of Pydantic error dicts with field paths | ||
| except A3ParseError as e: | ||
| print(e) # malformed JSON | ||
| ``` | ||
|
|
||
| ## File I/O | ||
|
|
||
| ```python | ||
| from rtemis.a3 import read_a3json, write_a3json | ||
|
|
||
| a3 = read_a3json("protein.json") | ||
| write_a3json(a3, "output.json", indent=2) | ||
| ``` | ||
|
|
||
| ## Serialization | ||
|
|
||
| ```python | ||
| from rtemis.a3 import a3_to_json | ||
|
|
||
| json_string = a3_to_json(a3) # compact | ||
| json_string = a3_to_json(a3, indent=2) # pretty-printed | ||
| ``` | ||
|
|
||
| ## Wire Format | ||
|
|
||
| ```json | ||
| { | ||
| "sequence": "MKTAYIAKQR", | ||
| "annotations": { | ||
| "site": { "Active site": { "index": [3, 5], "type": "activeSite" } }, | ||
| "region": { "Repeat 1": { "index": [[1, 4]], "type": "" } }, | ||
| "ptm": { "Phospho": { "index": [7], "type": "" } }, | ||
| "processing": {}, | ||
| "variant": [{ "position": 3, "from": "K", "to": "R" }] | ||
| }, | ||
| "metadata": { | ||
| "uniprot_id": "P12345", | ||
| "description": "Example protein", | ||
| "reference": "", | ||
| "organism": "Homo sapiens" | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| All five annotation families are always present in output. Each annotation | ||
| entry is `{ index, type }` — bare arrays are rejected. Positions are | ||
| 1-based, sorted, and deduplicated. Ranges are `[start, end]` pairs | ||
| (`start < end`), sorted by start; overlapping ranges are rejected. | ||
|
|
||
| ## Canonical Schema | ||
|
|
||
| See the [A3 specification](https://github.com/rtemis-org/a3/blob/main/specs/A3.md) | ||
| for the language-agnostic schema definition. | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,13 @@ | ||||||
| site_name: rtemis_a3 | ||||||
|
||||||
| site_name: rtemis_a3 | |
| site_name: rtemis-a3 |
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.
The mkdocs.yml configuration is inconsistent with zensical.toml. Specifically, the site_name differs (rtemis_a3 vs rtemis-a3), and it lacks the nav, site_description, and site_author fields defined in the Zensical configuration. Keeping these in sync ensures a consistent documentation experience regardless of which tool is used for building. Additionally, rtemis-a3 matches the project name in pyproject.toml.
site_name: rtemis-a3
site_description: Python implementation of the A3 amino acid annotation format.
site_author: E.D. Gennatas
nav:
- Home: index.md
- API Reference: api.md
Copilot
AI
Mar 31, 2026
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.
The repo’s Python CI workflow currently runs lint/typecheck/tests but does not build the documentation site. Since this PR adds MkDocs/Zensical configuration and mkdocstrings directives, consider adding a CI step to at least run a docs build (or a mkdocstrings render check) so doc generation failures are caught early.
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.
docs/index.mdappears to duplicate the existingREADME.mdcontent in this package (and alsopython/README.md). Keeping multiple copies of the same introductory text tends to drift over time; consider reusing a single source (e.g., include/redirect the README into MkDocs) so updates only need to be made in one place.