ISCN 2024 karyotype validation — parser, rule engine, and types. Pure Python, zero runtime dependencies.
Project description
iscn-authenticator
ISCN 2024 karyotype validation — parser, rule engine, and AST types. Pure Python, zero runtime dependencies, supports Python 3.10–3.13.
Validates karyotype strings against the 2024 International System for Human Cytogenomic Nomenclature (ISCN) and returns a structured AST alongside any rule violations.
Install
pip install iscn-authenticator
Quick start
from iscn_authenticator import is_valid_karyotype, validate_karyotype
is_valid_karyotype("46,XX") # True
is_valid_karyotype("47,XY,+21") # True
is_valid_karyotype("46,XX,t(9;22)(q34;q11.2)") # True
is_valid_karyotype("47,XY,+21[8]/46,XY[12]") # True (mosaic)
is_valid_karyotype("garbage") # False
result = validate_karyotype("46,XX,del(5)(q13q33)")
# result.valid -> True
# result.errors -> []
# result.parsed -> KaryotypeAST(...)
API surface
validate_karyotype(s: str) -> ValidationResult— full validation, returns{valid, errors, parsed}.is_valid_karyotype(s: str) -> bool— boolean convenience wrapper.KaryotypeAST,Abnormality,Breakpoint,CellLine— dataclasses describing the parsed structure.ParseError— raised by the parser on malformed syntax;validate_karyotypecatches it and surfaces it througherrors.
Supported nomenclature
ISCN 2024 grammar covered:
- Numerical aberrations:
+21,-X, ... - Structural rearrangements:
del,dup,inv,t(translocation),ins(insertion). - Specialized rearrangements:
i(isochromosome),idic(isodicentric),der(derivative),dic(dicentric),r(ring),rob(Robertsonian),trp(triplication). - Marker chromosomes:
mar. - Uncertainty (
?), inheritance suffixes (mat,pat,dn), mosaicism (cell lines split on/).
ISCN 2024 reference
Implementation tracks the 2024 edition of the International System for Human Cytogenomic Nomenclature. See the ISCN publication.
Cross-implementation parity
A TypeScript port (@iscn/core) lives in the iscn-authenticator monorepo under packages/core/, and consumes the same fixture corpus shipped in this repo at fixtures/validity.json. Parity is enforced via CI in both repos.
Contributing
git clone https://github.com/nuin/iscn-authenticator-py.git
cd iscn-authenticator-py
pip install pre-commit ruff
pre-commit install
python3 -m unittest discover tests
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file iscn_authenticator-0.2.1.tar.gz.
File metadata
- Download URL: iscn_authenticator-0.2.1.tar.gz
- Upload date:
- Size: 27.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
604c2a8182fc1b32787cc19e68db352a9eea8f29f6a762c9d13df2aca7952142
|
|
| MD5 |
c27f81e8f825d861662e34c4e134a835
|
|
| BLAKE2b-256 |
824fc874937d5ac58e66b33824b97398e6316bf98c9e46eb37c2c30a7924241b
|
Provenance
The following attestation bundles were made for iscn_authenticator-0.2.1.tar.gz:
Publisher:
publish-pypi.yml on nuin/iscn-authenticator-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iscn_authenticator-0.2.1.tar.gz -
Subject digest:
604c2a8182fc1b32787cc19e68db352a9eea8f29f6a762c9d13df2aca7952142 - Sigstore transparency entry: 1700706027
- Sigstore integration time:
-
Permalink:
nuin/iscn-authenticator-py@645a2d724366c49df58334edcf388d8bd2c8d207 -
Branch / Tag:
refs/tags/v0.2.1-py - Owner: https://github.com/nuin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@645a2d724366c49df58334edcf388d8bd2c8d207 -
Trigger Event:
push
-
Statement type:
File details
Details for the file iscn_authenticator-0.2.1-py3-none-any.whl.
File metadata
- Download URL: iscn_authenticator-0.2.1-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a09039427dbce4c3f6319913a3627814b80778c1c085e155d43ae4f20372473
|
|
| MD5 |
299ab66c956cf72e17a2934cd6452235
|
|
| BLAKE2b-256 |
20def7c23d5d36eb4ec7356d3c58f31143c14824e965992ebf315effc4b9cf00
|
Provenance
The following attestation bundles were made for iscn_authenticator-0.2.1-py3-none-any.whl:
Publisher:
publish-pypi.yml on nuin/iscn-authenticator-py
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
iscn_authenticator-0.2.1-py3-none-any.whl -
Subject digest:
9a09039427dbce4c3f6319913a3627814b80778c1c085e155d43ae4f20372473 - Sigstore transparency entry: 1700706276
- Sigstore integration time:
-
Permalink:
nuin/iscn-authenticator-py@645a2d724366c49df58334edcf388d8bd2c8d207 -
Branch / Tag:
refs/tags/v0.2.1-py - Owner: https://github.com/nuin
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@645a2d724366c49df58334edcf388d8bd2c8d207 -
Trigger Event:
push
-
Statement type: