Registry / serialization / ga4gh-vrsatile-pydantic

ga4gh-vrsatile-pydantic

JSON →
library0.2.0pypypi✓ verified 81d ago

Provides Pydantic data models for the GA4GH Variation Representation Specification (VRS) and VRSATILE schemas. Currently at v0.2.0, this library transitioned from Pydantic v1 to v2 in a major breaking change. Active development with experimental pre-releases.

pip install ga4gh-vrsatile-pydantic
INSTALL
IMPORT
SIG · GA4GH-VRSATILE-PYD
G
ga4gh-vrsatile-pydantic
serializationpythonv0.2.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Allele
from ga4gh.vrsatile.pydantic.vrs_models import Allele
from ga4gh.vrsatile.pydantic import Allele

Creates a VRS Allele model using Pydantic v2 syntax.

from ga4gh.vrsatile.pydantic import Allele, CopyNumberChange # Example: creating an Allele allele = Allele( type="Allele", location={ "type": "SequenceLocation", "sequence_id": "ga4gh:SQ._0wi-qoPhFdH", "interval": { "type": "SequenceInterval", "start": {"type": "Number", "value": 55181320}, "end": {"type": "Number", "value": 55181321} } }, state={ "type": "LiteralSequenceExpression", "sequence": "A" } ) # Validate print(allele.model_dump_json(exclude_none=True))
Debug
Known issues
breakingv0.2.0 migrated from Pydantic v1 to v2. All .dict() calls must be replaced with .model_dump(), and .json() with .model_dump_json().
fix
Replace all .dict() with .model_dump() and .json() with .model_dump_json() in your code.
affects: 0.2.0+
deprecatedv0.1.0-dev releases (pre-release) used Pydantic v1. These are not compatible with v0.2.0. Avoid using dev versions in production.
fix
Upgrade to v0.2.0 and migrate code to Pydantic v2 syntax.
affects: 0.1.0-dev*
gotchaThe import path changed after v0.2.0. Models were previously under ga4gh.vrsatile.models but now under ga4gh.vrsatile.pydantic.
fix
Update imports: from ga4gh.vrsatile.pydantic import Allele (instead of from ga4gh.vrsatile.models import Allele).
affects: 0.2.0+
Upgrade
Version history
0.2.0latest on PyPI · released Oct 5, 2023
Audit
Dependencies
pydanticrequiredCore dependency for data models
ga4gh.vrsatilerequiredRequired for VRSATILE-specific models
Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
ga4gh-vrsatile-pydantic — pip install ga4gh-vrsatile-pydantic · libregistry