GA4GH Variant Annotation (VA) Spec Python
raw JSON → 0.4.3 verified Sat May 09 auth: no python
GA4GH Variant Annotation (VA) reference implementation providing Pydantic models for the VA specification. Current version 0.4.3, uses VRS-Python for variant representation and pydantic for validation. Release cadence is irregular, tied to VA spec releases.
pip install ga4gh-va-spec Common errors
error ImportError: cannot import name 'Statement' from 'ga4gh.va_spec' ↓
cause Trying to import Statement from top-level instead of submodule.
fix
Use: from ga4gh.va_spec.base import Statement
error pydantic_core._pydantic_core.ValidationError: 1 validation error for Statement extra_forbidden ↓
cause Model has additionalProperties=False and extra fields are provided.
fix
Remove any fields not defined in the model, or update model to include them.
Warnings
breaking Version 0.2.0 changed base model namespace; imports from ga4gh.va_spec.base are required, not ga4gh.va_spec directly. ↓
fix Update imports to use submodules (e.g., base, aac_2017).
breaking Version 0.4.0 updated VA spec to 1.0.0, removing deprecated fields and renaming models. ↓
fix Review VA spec 1.0.0 changelog. Use new model names like 'Statement' with standard GA4GH types.
gotcha Models enforce additionalProperties=False by default; extra fields cause validation errors. ↓
fix Ensure all fields match the model schema exactly. Use model_dump() with exclude_unset to inspect.
Imports
- Statement wrong
from ga4gh.va_spec import Statementcorrectfrom ga4gh.va_spec.base import Statement
Quickstart
from ga4gh.va_spec.base import Statement
from pydantic import ValidationError
try:
stmt = Statement(id='test:1', type='Statement', description='Example')
print(stmt.model_dump(exclude_unset=True))
except ValidationError as e:
print(e)