Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
163 changes: 79 additions & 84 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,54 +1,40 @@
[project]
name = "ga4gh.cat_vrs"
authors = [
{name = "Larry Babb", email = "lbabb@broadinstitute.org"},
{name = "Alex Wagner", email = "alex.wagner@nationwidechildrens.org"},
{name = "Daniel Puthawala", email = "daniel.puthawala@nationwidechildrens.org"},
{ name = "Larry Babb", email = "lbabb@broadinstitute.org" },
{ name = "Alex Wagner", email = "alex.wagner@nationwidechildrens.org" },
{ name = "Daniel Puthawala", email = "daniel.puthawala@nationwidechildrens.org" },
]
readme = "README.md"
description = "GA4GH Categorical Variation Representation (Cat-VRS) reference implementation"
license = {file = "LICENSE"}
license = { file = "LICENSE" }
classifiers = [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Healthcare Industry",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
]
keywords = [
"bioinformatics",
"ga4gh",
"genomics",
"variation"
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"Intended Audience :: Healthcare Industry",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Medical Science Apps.",
]
keywords = ["bioinformatics", "ga4gh", "genomics", "variation"]
requires-python = ">=3.10"
dynamic = ["version"]
dependencies = [
"ga4gh.vrs~=2.4.0a1",
"pydantic>=2.0,<3.0",
"ga4gh.vrs @ git+https://github.com/ga4gh/vrs-python.git@daceb0b6cd773f8c4c5b6dff560fb7f4a5ff7b34",
"pydantic>=2.0,<3.0",
]

[project.optional-dependencies]
dev = [
"pre-commit",
"ruff==0.4.9",
]
tests = [
"pytest",
"pytest-cov",
"pyyaml",
]
notebooks = [
"jupyter",
]
dev = ["pre-commit", "ruff==0.4.9"]
tests = ["pytest", "pytest-cov", "pyyaml"]
notebooks = ["jupyter"]

[project.urls]
Homepage = "https://github.com/ga4gh/cat-vrs-python"
Expand All @@ -63,53 +49,52 @@ build-backend = "setuptools.build_meta"

[tool.ruff]
src = ["src"]
exclude = [
"submodules"
]
exclude = ["submodules"]

[tool.ruff.lint]
select = [
"F", # https://docs.astral.sh/ruff/rules/#pyflakes-f
"E", "W", # https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
"I", # https://docs.astral.sh/ruff/rules/#isort-i
"N", # https://docs.astral.sh/ruff/rules/#pep8-naming-n
"D", # https://docs.astral.sh/ruff/rules/#pydocstyle-d
"UP", # https://docs.astral.sh/ruff/rules/#pyupgrade-up
"ANN", # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"ASYNC", # https://docs.astral.sh/ruff/rules/#flake8-async-async
"S", # https://docs.astral.sh/ruff/rules/#flake8-bandit-s
"B", # https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
"A", # https://docs.astral.sh/ruff/rules/#flake8-builtins-a
"C4", # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
"DTZ", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
"T10", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
"EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
"G", # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
"PIE", # https://docs.astral.sh/ruff/rules/#flake8-pie-pie
"T20", # https://docs.astral.sh/ruff/rules/#flake8-print-t20
"PT", # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
"Q", # https://docs.astral.sh/ruff/rules/#flake8-quotes-q
"RSE", # https://docs.astral.sh/ruff/rules/#flake8-raise-rse
"RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret
"SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
"PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
"PGH", # https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
"RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
"F", # https://docs.astral.sh/ruff/rules/#pyflakes-f
"E",
"W", # https://docs.astral.sh/ruff/rules/#pycodestyle-e-w
"I", # https://docs.astral.sh/ruff/rules/#isort-i
"N", # https://docs.astral.sh/ruff/rules/#pep8-naming-n
"D", # https://docs.astral.sh/ruff/rules/#pydocstyle-d
"UP", # https://docs.astral.sh/ruff/rules/#pyupgrade-up
"ANN", # https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
"ASYNC", # https://docs.astral.sh/ruff/rules/#flake8-async-async
"S", # https://docs.astral.sh/ruff/rules/#flake8-bandit-s
"B", # https://docs.astral.sh/ruff/rules/#flake8-bugbear-b
"A", # https://docs.astral.sh/ruff/rules/#flake8-builtins-a
"C4", # https://docs.astral.sh/ruff/rules/#flake8-comprehensions-c4
"DTZ", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
"T10", # https://docs.astral.sh/ruff/rules/#flake8-datetimez-dtz
"EM", # https://docs.astral.sh/ruff/rules/#flake8-errmsg-em
"G", # https://docs.astral.sh/ruff/rules/#flake8-logging-format-g
"PIE", # https://docs.astral.sh/ruff/rules/#flake8-pie-pie
"T20", # https://docs.astral.sh/ruff/rules/#flake8-print-t20
"PT", # https://docs.astral.sh/ruff/rules/#flake8-pytest-style-pt
"Q", # https://docs.astral.sh/ruff/rules/#flake8-quotes-q
"RSE", # https://docs.astral.sh/ruff/rules/#flake8-raise-rse
"RET", # https://docs.astral.sh/ruff/rules/#flake8-return-ret
"SIM", # https://docs.astral.sh/ruff/rules/#flake8-simplify-sim
"PTH", # https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
"PGH", # https://docs.astral.sh/ruff/rules/#pygrep-hooks-pgh
"RUF", # https://docs.astral.sh/ruff/rules/#ruff-specific-rules-ruf
]
fixable = [
"I",
"F401",
"D",
"UP",
"ANN",
"B",
"C4",
"G",
"PIE",
"PT",
"RSE",
"SIM",
"RUF"
"I",
"F401",
"D",
"UP",
"ANN",
"B",
"C4",
"G",
"PIE",
"PT",
"RSE",
"SIM",
"RUF",
]
# ANN101 - missing-type-self
# ANN003 - missing-type-kwargs
Expand All @@ -128,11 +113,21 @@ fixable = [
# S321 - suspicious-ftp-lib-usage
# *ignored for compatibility with formatter
ignore = [
"ANN101", "ANN003",
"D203", "D205", "D206", "D213", "D300", "D400", "D415",
"E111", "E114", "E117", "E501",
"W191",
"S321",
"ANN101",
"ANN003",
"D203",
"D205",
"D206",
"D213",
"D300",
"D400",
"D415",
"E111",
"E114",
"E117",
"E501",
"W191",
"S321",
]

[tool.ruff.lint.per-file-ignores]
Expand Down
12 changes: 7 additions & 5 deletions src/ga4gh/cat_vrs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
"""Package for Cat-VRS Python implementation"""

from importlib.metadata import PackageNotFoundError, version
from importlib.metadata import PackageNotFoundError
from importlib.metadata import version as package_version

from . import models, recipes
from .metadata import CatVRSMetadataMixin
from .version import CATVRS_VERSION

try:
__version__ = version(__name__)
__version__ = package_version(__name__)
except PackageNotFoundError: # pragma: nocover
__version__ = "unknown"
finally:
del version, PackageNotFoundError
del package_version, PackageNotFoundError


CATVRS_VERSION = "1.1.0-snapshot.2026-02.3"

__all__ = [
"CATVRS_VERSION",
"CatVRSMetadataMixin",
"__version__",
"models",
"recipes",
Expand Down
11 changes: 11 additions & 0 deletions src/ga4gh/cat_vrs/metadata.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""Provide metadata mixins for Cat-VRS models."""

from ga4gh.cat_vrs.version import CATVRS_VERSION
from ga4gh.core.metadata import GKSMetadataMixin


class CatVRSMetadataMixin(GKSMetadataMixin):
"""Provide metadata for a concrete Cat-VRS model."""

_product_name = "cat-vrs"
_product_version = CATVRS_VERSION
36 changes: 27 additions & 9 deletions src/ga4gh/cat_vrs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
the GA4GH website for more information.
"""

from typing import Literal
from typing import ClassVar, Literal

from pydantic import Field, RootModel

from ga4gh.cat_vrs.metadata import CatVRSMetadataMixin
from ga4gh.core.metadata import Maturity
from ga4gh.core.models import (
BaseModelForbidExtra,
ConceptMapping,
Expand All @@ -18,11 +20,13 @@
from ga4gh.vrs.models import Allele, CopyChange, Range, SequenceLocation, Variation


class DefiningAlleleConstraint(BaseModelForbidExtra):
class DefiningAlleleConstraint(CatVRSMetadataMixin, BaseModelForbidExtra):
"""The defining allele and its associated relationships that are congruent with
member variants.
"""

_maturity: ClassVar[Maturity] = Maturity.TRIAL_USE

type: Literal["DefiningAlleleConstraint"] = Field(
default="DefiningAlleleConstraint",
description="MUST be 'DefiningAlleleConstraint'",
Expand All @@ -34,11 +38,13 @@ class DefiningAlleleConstraint(BaseModelForbidExtra):
)


class DefiningLocationConstraint(BaseModelForbidExtra):
class DefiningLocationConstraint(CatVRSMetadataMixin, BaseModelForbidExtra):
"""The defining location and its associated relationships that are congruent with
member locations.
"""

_maturity: ClassVar[Maturity] = Maturity.TRIAL_USE

type: Literal["DefiningLocationConstraint"] = Field(
default="DefiningLocationConstraint",
description="MUST be 'DefiningLocationConstraint'",
Expand All @@ -54,11 +60,13 @@ class DefiningLocationConstraint(BaseModelForbidExtra):
)


class CopyCountConstraint(BaseModelForbidExtra):
class CopyCountConstraint(CatVRSMetadataMixin, BaseModelForbidExtra):
"""The exact or range of copies that members of this categorical variant must
satisfy.
"""

_maturity: ClassVar[Maturity] = Maturity.TRIAL_USE

type: Literal["CopyCountConstraint"] = Field(
default="CopyCountConstraint", description="MUST be 'CopyCountConstraint'"
)
Expand All @@ -68,11 +76,13 @@ class CopyCountConstraint(BaseModelForbidExtra):
)


class CopyChangeConstraint(BaseModelForbidExtra):
class CopyChangeConstraint(CatVRSMetadataMixin, BaseModelForbidExtra):
"""The relative assessment of the change in copies that members of this categorical
variant satisfy.
"""

_maturity: ClassVar[Maturity] = Maturity.DRAFT

type: Literal["CopyChangeConstraint"] = Field(
default="CopyChangeConstraint", description="MUST be 'CopyChangeConstraint'"
)
Expand All @@ -82,19 +92,23 @@ class CopyChangeConstraint(BaseModelForbidExtra):
)


class FeatureContextConstraint(BaseModelForbidExtra):
class FeatureContextConstraint(CatVRSMetadataMixin, BaseModelForbidExtra):
"""The feature that members of this categorical variant are associated with."""

_maturity: ClassVar[Maturity] = Maturity.DRAFT

type: Literal["FeatureContextConstraint"] = Field(
default="FeatureContextConstraint",
description="MUST be 'FeatureContextConstraint'",
)
featureContext: MappableConcept = Field(..., description="A feature identifier.")


class FunctionConstraint(BaseModelForbidExtra):
class FunctionConstraint(CatVRSMetadataMixin, BaseModelForbidExtra):
"""A classification of the protein functional consequence that characterizes members of this categorical variant."""

_maturity: ClassVar[Maturity] = Maturity.DRAFT

type: Literal["FunctionConstraint"] = Field(
default="FunctionConstraint",
description='MUST be "FunctionConstraint"',
Expand All @@ -108,9 +122,11 @@ class FunctionConstraint(BaseModelForbidExtra):
)


class Constraint(RootModel):
class Constraint(CatVRSMetadataMixin, RootModel):
"""Constraints are used to construct an intensional semantics of categorical variant types."""

_maturity: ClassVar[Maturity] = Maturity.TRIAL_USE

root: (
DefiningAlleleConstraint
| DefiningLocationConstraint
Expand All @@ -121,11 +137,13 @@ class Constraint(RootModel):
) = Field(..., discriminator="type")


class CategoricalVariant(Entity, BaseModelForbidExtra):
class CategoricalVariant(CatVRSMetadataMixin, Entity, BaseModelForbidExtra):
"""A representation of a categorically-defined domain for variation, in which
individual Constraintual variation instances may be members of the domain.
"""

_maturity: ClassVar[Maturity] = Maturity.TRIAL_USE

type: Literal["CategoricalVariant"] = Field(
default="CategoricalVariant", description="MUST be 'CategoricalVariant'"
)
Expand Down
Loading
Loading