anyvar.core.objects

Provide types, classes, and functions for objects stored by AnyVar.

anyvar.core.objects.SupportedVrsObject: TypeAlias = ga4gh.vrs.models.Allele | ga4gh.vrs.models.SequenceLocation | ga4gh.vrs.models.SequenceReference[source]

Any time this is updated, a corresponding member MUST be added to anyvar.restapi.schema.SupportedVariationType.

tests/unit/restapi/test_schema.py will fail if you don’t.

anyvar.core.objects.SupportedVrsVariation[source]

Builds a dict in the form of “ModelName”: models.ModelName for every class listed in the VrsObject type union

For example:

>>> vrs_object_class_map["Allele"] = models.Allele
anyvar.core.objects.recursive_identify(vrs_object)[source]

Add GA4GH IDs to an object and all GA4GH-identifiable objects contained within.

Attention

This is a very hack-y solution and should not be relied upon any more than it is. It appears that enref/deref() will add IDs within objects, but don’t produce a correct ID, and ga4gh_identify() won’t add IDs to contained objects, so this function runs both in succession.

There is probably an upstream fix in VRS-Python that needs to happen.

Parameters:

vrs_object (TypeVar(Type_SupportedVrsObject, bound= Allele | SequenceLocation | SequenceReference)) – AnyVar-supported variation object

Return type:

TypeVar(Type_SupportedVrsObject, bound= Allele | SequenceLocation | SequenceReference)

Returns:

same object, with any missing ID fields filled in