Skip to content

Source bindings API

Public Python classes, dataset metadata constants, and builder entry points exported by Altar's eight annotation and variant–gene link binding distributions. For the built-in regions source, see altar.variants.

Packages

Module Integration Public exports
altar_popfreq gnomAD (altar_popfreq) ANCESTRY_GROUPS, GNOMAD_ANNOTATIONS, GNOMAD_DATASETS, GNOMAD_KEY_COLUMNS, PARQUET_METADATA_PREFIX …
altar_clinvar ClinVar (altar_clinvar) CLINVAR_ANNOTATIONS, CLINVAR_GENOME_BUILDS, CLINVAR_KEY_COLUMNS, FIRST_GERMLINE_RELEASE, KNOWN_ORIGIN_BITS …
altar_conservation phyloP (altar_conservation) PHYLOP100WAY, PHYLOP100WAY_ANNOTATIONS, PHYLOP100WAY_VCF_INFO_FIELDS, TRACKS, ConservationAnnotationSource …
altar_opentargets_e2g Open Targets E2G (altar_opentargets_e2g) OPEN_TARGETS_E2G_DATASET, PUBLISHED_DATASET, PUBLISHED_GENOME_BUILD, PUBLISHED_RELEASE, VCF_INFO_FIELDS …
altar_alphamissense AlphaMissense (altar_alphamissense) ALPHAMISSENSE_ANNOTATIONS, ALPHAMISSENSE_KEY_COLUMNS, PARQUET_LAYOUT, PARQUET_METADATA_PREFIX, RELEASE_METADATA …
altar_spliceai SpliceAI (altar_spliceai) PARQUET_LAYOUT, PARQUET_METADATA_PREFIX, RELEASE_METADATA, SPLICEAI_ANNOTATIONS, SPLICEAI_KEY_COLUMNS …
altar_gpnstar GPN-Star (altar_gpnstar) ASSET_MANIFEST_NAME, DEFAULT_HF_DATASET_URI, DEFAULT_SCORE_SET, GPNSTAR_ANNOTATIONS, GPNSTAR_KEY_COLUMNS …
altar_e2g_atlas ENCODE E2G Atlases (altar_e2g_atlas) E2G_ATLAS_DATASET, ENCODE_RE2G_COLUMNS, SCE2G_V1_3_COLUMNS, AtlasImportLedger, AtlasIngestor …

altar_popfreq

altar-popfreq — gnomAD v4.1 population allele frequencies, counts, and dataset builder. Full scientific details, outputs, and CLI examples are on the gnomAD (altar_popfreq) integration page.

Symbol Description
ANCESTRY_GROUPS Public export.
GNOMAD_ANNOTATIONS The gnomAD population-frequency annotation contract, version 1.0.0.
GNOMAD_DATASETS Public export.
GNOMAD_KEY_COLUMNS The allelic key columns altar-popfreq-build writes.
PARQUET_METADATA_PREFIX The prefix of the Parquet key-value metadata altar-popfreq-build writes: version, dataset, genome_build, and builder_version.
PUBLISHED_DATASET Where PUBLISHED_RELEASE is published, read anonymously by default.
PUBLISHED_RELEASE The latest gnomAD release the Kundaje lab publishes as altar-popfreq-build output: v4.1.1 genomes on hg38.
RELEASE_METADATA How altar-popfreq-build records the release in every Parquet file, and how GnomADSource checks it.
VCF_INFO_FIELDS The gnomAD contract's columns as ALTAR1_GNOMAD_* INFO fields, in contract order.
GnomADDataset Public export.
GnomADRelease The gnomAD release and dataset a backend serves.
GnomADSource How common each variant is in gnomAD v4: allele frequencies overall and per genetic ancestry group.
GnomADTableSource A GnomADSource over an owned BigQuery table that also joins into a BigQuery store's SQL.
bigquery_relation Return the relation= SQL that reads the gnomAD contract columns from table_id.
bigquery_source Return a BigQueryAnnotationSource that reads gnomAD frequencies from table_id in SQL.
max_ancestry_af Return the greatest non-null ancestry AF in values, keyed by column name, or None if all are null.
release_fields Return the fields that identify release in Parquet metadata: version, dataset, and genome_build.

Public exports for the gnomAD Altar binding.

ANCESTRY_GROUPS module-attribute

ANCESTRY_GROUPS = (
    "afr",
    "ami",
    "amr",
    "asj",
    "eas",
    "fin",
    "mid",
    "nfe",
    "sas",
    "remaining",
)

GNOMAD_ANNOTATIONS module-attribute

GNOMAD_ANNOTATIONS = AnnotationContract(
    source_id="org.kundajelab.altar.annotation.gnomad",
    schema_version="1.0.0",
    columns=(
        AnnotationColumn(
            name="gnomad_af",
            dtype="float",
            label="gnomAD AF",
        ),
        AnnotationColumn(
            name="gnomad_ac", dtype="int", label="gnomAD AC"
        ),
        AnnotationColumn(
            name="gnomad_an", dtype="int", label="gnomAD AN"
        ),
        AnnotationColumn(
            name="gnomad_nhomalt",
            dtype="int",
            label="gnomAD Homozygotes",
        ),
        AnnotationColumn(
            name="gnomad_af_grpmax",
            dtype="float",
            label="gnomAD Grpmax AF",
        ),
        AnnotationColumn(
            name="gnomad_grpmax",
            dtype="str",
            label="gnomAD Grpmax Group",
        ),
        AnnotationColumn(
            name="gnomad_faf95_max",
            dtype="float",
            label="gnomAD Max FAF95",
        ),
        AnnotationColumn(
            name="gnomad_af_max_ancestry",
            dtype="float",
            label="gnomAD Max Ancestry AF",
        ),
        *(
            AnnotationColumn(
                name=f"gnomad_af_{group}",
                dtype="float",
                label=f"gnomAD AF ({_ANCESTRY_LABELS[group]})",
            )
            for group in ANCESTRY_GROUPS
        ),
        AnnotationColumn(
            name="gnomad_filters",
            dtype="str",
            label="gnomAD Filters",
        ),
    ),
)

The gnomAD population-frequency annotation contract, version 1.0.0.

Any source can implement it; GnomADSource is the reference implementation. A table built by altar-popfreq-build holds exactly these columns plus variant_id and its allelic key columns. The data release is not a column: it is in each source's identity(), so it is not repeated in every row.

GNOMAD_DATASETS module-attribute

GNOMAD_DATASETS: tuple[GnomADDataset, ...] = get_args(
    GnomADDataset
)

GNOMAD_KEY_COLUMNS module-attribute

GNOMAD_KEY_COLUMNS = AllelicKeyColumns(
    chromosome="chr",
    position="pos",
    reference_allele="ref",
    alternate_allele="alt",
)

The allelic key columns altar-popfreq-build writes. The chromosome uses the canonical chr spelling.

PARQUET_METADATA_PREFIX module-attribute

PARQUET_METADATA_PREFIX = 'altar_popfreq.'

The prefix of the Parquet key-value metadata altar-popfreq-build writes: version, dataset, genome_build, and builder_version.

PUBLISHED_DATASET module-attribute

PUBLISHED_DATASET = PublishedDataset(
    locations=(
        PublishedLocation(
            "gcs",
            "gs://kundajelab-altar/popfreq/gnomad-4.1.1-genomes",
        ),
        PublishedLocation(
            "hf",
            "hf://datasets/altar-genomics/gnomad-4.1.1-genomes",
        ),
    ),
    identity=PUBLISHED_RELEASE.identity(),
    release_metadata=RELEASE_METADATA,
    release_fields=release_fields(PUBLISHED_RELEASE),
)

Where PUBLISHED_RELEASE is published, read anonymously by default.

Its primary location, gcs, is a public-read Cloud Storage bucket. hf is a public Hugging Face dataset holding the same files, byte for byte, in the same layout. Both serve one release under one identity.

It declares the release metadata every file records, so altar pull gnomad checks an owned copy against it.

Local Parquet copies work out of the box after installing altar-popfreq. Reading the default gs:// published copy requires altar[gcs] (pip install "altar[gcs]"), and reading the hf mirror requires altar[hf].

GnomADSource.published_dataset() returns it, and GnomADSource.from_keywords reads it when no owned dataset or table is named. Only the latest release is published.

PUBLISHED_RELEASE module-attribute

PUBLISHED_RELEASE = GnomADRelease(
    version="4.1.1", dataset="genomes"
)

The latest gnomAD release the Kundaje lab publishes as altar-popfreq-build output: v4.1.1 genomes on hg38.

RELEASE_METADATA module-attribute

RELEASE_METADATA = ParquetReleaseMetadata(
    prefix=PARQUET_METADATA_PREFIX,
    distribution="altar-popfreq",
    label="gnomAD",
    command="altar-popfreq-build",
)

How altar-popfreq-build records the release in every Parquet file, and how GnomADSource checks it.

VCF_INFO_FIELDS module-attribute

VCF_INFO_FIELDS = (
    _field("gnomad_af", "Float", "gnomAD allele frequency"),
    _field("gnomad_ac", "Integer", "gnomAD allele count"),
    _field("gnomad_an", "Integer", "gnomAD allele number"),
    _field(
        "gnomad_nhomalt",
        "Integer",
        "gnomAD homozygous individuals",
    ),
    _field(
        "gnomad_af_grpmax",
        "Float",
        "gnomAD grpmax allele frequency",
    ),
    _field(
        "gnomad_grpmax",
        "String",
        "gnomAD genetic ancestry group with the highest allele frequency",
    ),
    _field(
        "gnomad_faf95_max",
        "Float",
        "gnomAD highest filtering allele frequency (95% CI)",
    ),
    _field(
        "gnomad_af_max_ancestry",
        "Float",
        "gnomAD highest allele frequency across ancestry groups",
    ),
    *(
        _field(
            f"gnomad_af_{group}",
            "Float",
            f"gnomAD allele frequency in the {_ANCESTRY_LABELS[group]} group",
        )
        for group in ANCESTRY_GROUPS
    ),
    _field(
        "gnomad_filters", "String", "gnomAD site filters"
    ),
)

The gnomAD contract's columns as ALTAR1_GNOMAD_* INFO fields, in contract order.

GnomADDataset module-attribute

GnomADDataset = Literal['genomes', 'exomes', 'joint']

GnomADRelease dataclass

GnomADRelease(
    version: str,
    dataset: GnomADDataset,
    genome_build: str = "hg38",
)

The gnomAD release and dataset a backend serves.

version is gnomAD's exact release string, as in its file names: "4.1.1" for the v4.1.1 files, not "4.1", because a patch release changes values. dataset is genomes, exomes, or joint; the joint dataset combines exomes and genomes and exists only in some releases (4.1). genome_build is the assembly of the coordinates. Only gnomAD v4 on hg38 is supported: v2.1.1 (GRCh37) uses other INFO names and ancestry groups (popmax, oth, no ami or mid), so it would need its own column mapping and would not mean the same thing under these column names.

release is the canonical label of the data, "<version>-<dataset>", such as "4.1-genomes". Frequencies from different datasets or versions are different quantities, so both are part of the label.

release property

release: str

Return the canonical release label, "<version>-<dataset>".

from_label classmethod

from_label(
    label: str, *, genome_build: str = "hg38"
) -> GnomADRelease

Return the release a canonical label such as "4.1.1-genomes" names, on genome_build.

Raises ValueError for a label that is not "<version>-<dataset>" or names an unsupported release.

identity

Return the identity of a source serving this release: GNOMAD_ANNOTATIONS, the label, and the build.

GnomADSource

GnomADSource(
    backend: AllelicRecordBackend, *, release: GnomADRelease
)

Bases: AllelicRecordAnnotationSource[GnomADRelease]

How common each variant is in gnomAD v4: allele frequencies overall and per genetic ancestry group.

backend reads a table with the allelic key columns its own configuration names plus every column of GNOMAD_ANNOTATIONS. release describes the data behind it, and identity() declares that contract with the release's label and genome build. A variant with no row is omitted from the result.

With a ParquetAllelicRecordBackend, the constructor reads the release metadata altar-popfreq-build writes into each Parquet file and raises ValueError if a file was built for another version, dataset, or build, or records no release at all; a host's own export must carry the metadata release_fields names. from_dataset builds the source from such a dataset alone, taking the release from that metadata (read_release), and close closes what it or from_keywords opened. from_keywords builds it from a run spec: over the published latest release by default, or over an owned Parquet copy or BigQuery table; over a BigQuery table it returns a GnomADTableSource, which also joins into a BigQuery store's SQL.

annotate raises ValueError if the backend returns an unrequested variant, more than one row for a variant, or a row that breaks the column contract: a non-null gnomad_af with gnomad_an of 0, or a gnomad_af_max_ancestry that is not the maximum of the non-null ancestry frequencies.

release_fields classmethod

release_fields(release: GnomADRelease) -> dict[str, str]

Return release_fields(release), the footer fields that identify release.

read_release classmethod

read_release(
    dataset: str | PathLike[str],
    *,
    storage_options: Mapping[str, Any] | None = None,
) -> GnomADRelease

Return the release the Parquet metadata of dataset records, read from its first file.

dataset is the path of a directory or a single file keyed by GNOMAD_KEY_COLUMNS, not the gnomAD dataset name, as a local path or a URI read with storage_options; a directory is searched recursively. Raises FileNotFoundError when it holds no Parquet file and ValueError when that file records no release; the constructor then holds the dataset to the release this returns.

from_keywords classmethod

from_keywords(
    *,
    dataset: str | PathLike[str] | None = None,
    table: str | None = None,
    release: str | None = None,
    genome_build: str | None = None,
    storage_options: Mapping[str, Any] | None = None,
    connection: Connection | None = None,
    location: str | None = None,
    **unknown: object,
) -> Self

Build the source from run spec options, reading the published, an owned Parquet, or a BigQuery copy.

  • With neither dataset nor table, the source reads the published latest release (published_dataset()) where it is hosted: anonymously by default, or with the storage options of connection, or with storage_options, when one is given. It reads the primary location, the gcs bucket, unless location names another, such as "hf" for the Hugging Face mirror, which needs the altar[hf] extra. location applies to the published copy only.
  • dataset is an owned Parquet copy that altar-popfreq-build wrote, as a path or a URI (from_dataset), read with the storage options of connection, or with storage_options, when one is given.
  • table is an owned BigQuery table of the builder's columns, project.dataset.table, read with connection.bigquery_client(), so it needs a connection. A table holds no Parquet metadata, so release names the release it holds, as a label such as "4.1-joint"; it defaults to the published latest release, which a table loaded from the published Parquet holds. The table's release labels, which altar pull --bigquery writes, are read with one metadata call (no query, no bytes billed): a table labelled with another release or build is refused, and a table with no labels, such as one loaded by hand, is accepted with a warning naming the release assumed (check_bigquery_release). The source is a GnomADTableSource: a BigQueryScoreStore joins it into its own SQL through bigquery_relation(table), and any other store reads it through the checked Python annotate(). The two paths enforce different row rules; a table altar pull loaded holds the builder's guarantees, so both return the same values from it.

storage_options and connection are exclusive: a connection supplies the storage options.

genome_build, when given, must name the build of the data, as hg38 or GRCh38. The source's identity is the release's, so the three ways of reading one release, and bigquery_source over the same table, give the same identity, and the connection never enters it.

An option not named above raises ValueError listing the valid options.

published_dataset classmethod

published_dataset() -> PublishedDataset

Return PUBLISHED_DATASET, the latest release the lab publishes, which from_keywords reads by default.

annotation_contract classmethod

annotation_contract() -> AnnotationContract

Return GNOMAD_ANNOTATIONS, which every gnomAD source implements, so tooling can list it unbuilt.

vcf_info_fields classmethod

vcf_info_fields() -> tuple[AnnotationInfoField, ...]

Return altar_popfreq.vcf.VCF_INFO_FIELDS, the augmented-VCF preset of the gnomAD columns.

Provisional: altar.variants.augment_run_export reads it, and the hook is expected to change.

annotation_columns

annotation_columns() -> list[AnnotationColumn]

Declare the published gnomAD frequency columns.

identity

Declare GNOMAD_ANNOTATIONS for the release, such as 4.1-genomes, on its genome build.

annotate async

annotate(
    variant_ids: Sequence[str],
) -> dict[str, dict[str, object]]

Return gnomAD frequencies for the requested variants that gnomAD has a row for.

GnomADTableSource

GnomADTableSource(
    client: Any, table_id: str, *, release: GnomADRelease
)

Bases: AllelicRecordTableSource[GnomADRelease], GnomADSource

A GnomADSource over an owned BigQuery table that also joins into a BigQuery store's SQL.

annotate() is GnomADSource's: it fetches rows through a BigQueryAllelicRecordBackend and checks each one. sql_join() is bigquery_source's: it returns bigquery_relation(table_id), so a BigQueryScoreStore reads gnomAD inside its materialize and export queries instead of calling annotate(). The two paths check different rules; see the module docstring and the binding's README ("What each path checks").

GnomADSource.from_keywords(table=...) builds this from a run spec, after checking the table's release labels. Its identity is release.identity(), the same as every other way of reading the release.

relation_columns classmethod

relation_columns() -> Sequence[str]

Return the contract columns, with the two derived ones computed from their inputs.

bigquery_relation

bigquery_relation(table_id: str) -> str

Return the relation= SQL that reads the gnomAD contract columns from table_id.

table_id is a project.dataset.table reference to a table loaded from altar-popfreq-build output, or any table with a canonical variant_id column and the columns of GNOMAD_ANNOTATIONS. The relation keeps the {variant_filter} token, so the store limits the read to the job's variants before joining. Clustering the table on variant_id lets BigQuery skip storage blocks for that filter.

The relation computes the two derived columns rather than reading them: gnomad_af is null where gnomad_an is 0, and gnomad_af_max_ancestry is the greatest non-null ancestry AF, rendered from altar.predicates.Greatest in its null-ignoring form. The table's own gnomad_af_max_ancestry is not read. Uniqueness of variant_id is not checked.

bigquery_source

bigquery_source(
    client: Any, table_id: str, *, release: GnomADRelease
) -> BigQueryAnnotationSource

Return a BigQueryAnnotationSource that reads gnomAD frequencies from table_id in SQL.

The source has GnomADSource's name and columns and, like it, no prioritization predicate. release describes the data in the table; the source's identity() is release.identity(), the same identity a GnomADSource over that release declares. It is the SQL path of GnomADTableSource.

max_ancestry_af

max_ancestry_af(
    values: Mapping[str, object],
) -> float | None

Return the greatest non-null ancestry AF in values, keyed by column name, or None if all are null.

release_fields

release_fields(release: GnomADRelease) -> dict[str, str]

Return the fields that identify release in Parquet metadata: version, dataset, and genome_build.


altar_clinvar

altar-clinvar — ClinVar germline classifications, review stars, conditions, and dataset builder. Full scientific details, outputs, and CLI examples are on the ClinVar (altar_clinvar) integration page.

Symbol Description
CLINVAR_ANNOTATIONS The ClinVar annotation contract, version 1.0.0.
CLINVAR_GENOME_BUILDS Public export.
CLINVAR_KEY_COLUMNS The allelic key columns altar-clinvar-build writes.
FIRST_GERMLINE_RELEASE The first archived ClinVar VCF in which CLNSIG and CLNREVSTAT hold the germline classification only.
KNOWN_ORIGIN_BITS Public export.
LOW_PENETRANCE_CLASSIFICATIONS The CLNSIG terms that make clinvar_low_penetrance true.
ORIGIN_BITS The allele-origin bits ClinVar's ORIGIN field combines.
PARQUET_METADATA_PREFIX The prefix of the Parquet key-value metadata altar-clinvar-build writes: release_date, genome_build, and builder_version.
PATHOGENIC_CLASSIFICATIONS The CLNSIG terms that make clinvar_pathogenic true, in ClinVar's VCF spelling.
PATHOGENIC_PREDICATE The rule ClinVarSource(prioritize_pathogenic=True) returns: a pathogenic or likely pathogenic germline classification with at least one review star,...
PUBLISHED_DATASET Where PUBLISHED_RELEASE is published, read anonymously by default.
PUBLISHED_RELEASE The latest ClinVar release the Kundaje lab publishes as altar-clinvar-build output: clinvar_20260928.vcf.gz from ClinVar's vcf_GRCh38 directory,...
RELEASE_METADATA How altar-clinvar-build records the release in every Parquet file, and how ClinVarSource checks it.
REVIEW_STARS ClinVar's gold stars for each germline review status, in its VCF spelling (spaces become underscores).
VCF_INFO_FIELDS The ClinVar contract's columns as ALTAR1_CLINVAR_* INFO fields, in contract order.
ClinVarGenomeBuild Public export.
ClinVarRelease The ClinVar VCF release a backend serves.
ClinVarSource ClinVar's germline classification of each variant, with its review status, conditions and genes.
ClinVarTableSource A ClinVarSource over an owned BigQuery table that also joins into a BigQuery store's SQL.
bigquery_relation Return the relation= SQL that reads the ClinVar contract columns from table_id.
bigquery_source Return a BigQueryAnnotationSource that reads ClinVar classifications from table_id in SQL.
classification_terms Return the terms of a CLNSIG value, split on / and \|; a comma stays inside its term.
is_low_penetrance Return whether a CLNSIG value includes a low-penetrance pathogenic or likely pathogenic classification.
is_pathogenic Return whether a CLNSIG value includes a pathogenic or likely pathogenic germline classification.
origin_labels Return the allele origins an ORIGIN bitmask combines: ["unknown"] for 0, and [] when it is missing.
release_fields Return the fields that identify release in Parquet metadata: release_date and genome_build.
review_stars Return ClinVar's gold stars for a germline review status, or None if it is missing or not in REVIEW_STARS.

Public exports for the ClinVar Altar binding.

CLINVAR_ANNOTATIONS module-attribute

CLINVAR_ANNOTATIONS = AnnotationContract(
    source_id="org.kundajelab.altar.annotation.clinvar",
    schema_version="1.0.0",
    columns=(
        AnnotationColumn(
            name="clinvar_variation_id",
            dtype="int",
            label="ClinVar Variation ID",
        ),
        AnnotationColumn(
            name="clinvar_allele_id",
            dtype="int",
            label="ClinVar Allele ID",
        ),
        AnnotationColumn(
            name="clinvar_classification",
            dtype="str",
            label="ClinVar Germline Classification",
        ),
        AnnotationColumn(
            name="clinvar_pathogenic",
            dtype="bool",
            label="ClinVar Pathogenic",
        ),
        AnnotationColumn(
            name="clinvar_low_penetrance",
            dtype="bool",
            label="ClinVar Low-Penetrance Pathogenic",
        ),
        AnnotationColumn(
            name="clinvar_review_status",
            dtype="str",
            label="ClinVar Review Status",
        ),
        AnnotationColumn(
            name="clinvar_review_stars",
            dtype="int",
            label="ClinVar Review Stars",
        ),
        AnnotationColumn(
            name="clinvar_conditions",
            dtype="str",
            label="ClinVar Conditions",
            repeated=True,
        ),
        AnnotationColumn(
            name="clinvar_conflicting_classifications",
            dtype="str",
            label="ClinVar Conflicting Classifications",
            repeated=True,
        ),
        AnnotationColumn(
            name="clinvar_molecular_consequences",
            dtype="str",
            label="ClinVar Molecular Consequences",
            repeated=True,
        ),
        AnnotationColumn(
            name="clinvar_variant_type",
            dtype="str",
            label="ClinVar Variant Type",
        ),
        AnnotationColumn(
            name="clinvar_origin",
            dtype="int",
            label="ClinVar Allele Origin Bits",
        ),
        AnnotationColumn(
            name="clinvar_origins",
            dtype="str",
            label="ClinVar Allele Origins",
            repeated=True,
        ),
        AnnotationColumn(
            name="clinvar_genes",
            dtype="struct",
            label="ClinVar Genes",
            repeated=True,
            fields=(
                AnnotationColumn(
                    name="symbol",
                    dtype="str",
                    label="Gene Symbol",
                ),
                AnnotationColumn(
                    name="gene_id",
                    dtype="int",
                    label="NCBI Gene ID",
                ),
            ),
        ),
        AnnotationColumn(
            name="clinvar_oncogenicity",
            dtype="str",
            label="ClinVar Oncogenicity",
        ),
        AnnotationColumn(
            name="clinvar_oncogenicity_review_status",
            dtype="str",
            label="ClinVar Oncogenicity Review Status",
        ),
        AnnotationColumn(
            name="clinvar_somatic_impact",
            dtype="str",
            label="ClinVar Somatic Clinical Impact",
        ),
        AnnotationColumn(
            name="clinvar_somatic_impact_review_status",
            dtype="str",
            label="ClinVar Somatic Impact Review Status",
        ),
    ),
)

The ClinVar annotation contract, version 1.0.0.

Any source can implement it; ClinVarSource is the reference implementation. A table built by altar-clinvar-build holds exactly these columns plus variant_id and its allelic key columns. The data release is not a column: it is in each source's identity(), so it is not repeated in every row.

CLINVAR_GENOME_BUILDS module-attribute

CLINVAR_GENOME_BUILDS: tuple[ClinVarGenomeBuild, ...] = (
    get_args(ClinVarGenomeBuild)
)

CLINVAR_KEY_COLUMNS module-attribute

CLINVAR_KEY_COLUMNS = AllelicKeyColumns(
    chromosome="chr",
    position="pos",
    reference_allele="ref",
    alternate_allele="alt",
)

The allelic key columns altar-clinvar-build writes. The chromosome uses the canonical chr spelling.

FIRST_GERMLINE_RELEASE module-attribute

FIRST_GERMLINE_RELEASE = '20240127'

The first archived ClinVar VCF in which CLNSIG and CLNREVSTAT hold the germline classification only.

Earlier files (through clinvar_20240107) mixed germline and somatic submissions in CLNSIG, described as "clinical significance", and had no separate oncogenicity (ONC) or somatic clinical impact (SCI) fields. Their CLNSIG is a different quantity, so the contract does not accept them.

KNOWN_ORIGIN_BITS module-attribute

KNOWN_ORIGIN_BITS = sum(bit for bit, _ in ORIGIN_BITS)

LOW_PENETRANCE_CLASSIFICATIONS module-attribute

LOW_PENETRANCE_CLASSIFICATIONS = (
    "Pathogenic,_low_penetrance",
    "Likely_pathogenic,_low_penetrance",
)

The CLNSIG terms that make clinvar_low_penetrance true. Alone, they do not make clinvar_pathogenic true.

ORIGIN_BITS module-attribute

ORIGIN_BITS: tuple[tuple[int, str], ...] = (
    (1, "germline"),
    (2, "somatic"),
    (4, "inherited"),
    (8, "paternal"),
    (16, "maternal"),
    (32, "de_novo"),
    (64, "biparental"),
    (128, "uniparental"),
    (256, "not_tested"),
    (512, "tested_inconclusive"),
    (1073741824, "other"),
)

The allele-origin bits ClinVar's ORIGIN field combines. A value of 0 means unknown.

A bit not listed here keeps its place in clinvar_origin but has no label in clinvar_origins.

PARQUET_METADATA_PREFIX module-attribute

PARQUET_METADATA_PREFIX = 'altar_clinvar.'

The prefix of the Parquet key-value metadata altar-clinvar-build writes: release_date, genome_build, and builder_version.

PATHOGENIC_CLASSIFICATIONS module-attribute

PATHOGENIC_CLASSIFICATIONS = (
    "Pathogenic",
    "Likely_pathogenic",
)

The CLNSIG terms that make clinvar_pathogenic true, in ClinVar's VCF spelling.

CLNSIG joins the germline classifications of one variant with / (Pathogenic/Likely_pathogenic, Pathogenic/Likely_risk_allele) and appends other terms after | (Pathogenic|risk_factor), so a value is split on both before its terms are compared. Pathogenic,_low_penetrance and Likely_pathogenic,_low_penetrance are separate terms (see LOW_PENETRANCE_CLASSIFICATIONS); risk alleles and Conflicting_classifications_of_pathogenicity are not pathogenic terms.

PATHOGENIC_PREDICATE module-attribute

PATHOGENIC_PREDICATE = And(
    Eq(Col("clinvar_pathogenic"), Lit(True)),
    Ge(
        Col("clinvar_review_stars"),
        Lit(MIN_PRIORITIZED_REVIEW_STARS),
    ),
)

The rule ClinVarSource(prioritize_pathogenic=True) returns: a pathogenic or likely pathogenic germline classification with at least one review star, so a classification submitted without assertion criteria does not prioritize a variant.

PUBLISHED_DATASET module-attribute

PUBLISHED_DATASET = PublishedDataset(
    locations=(
        PublishedLocation(
            "gcs",
            "gs://kundajelab-altar/clinvar/clinvar-20260928-hg38",
        ),
        PublishedLocation(
            "hf",
            "hf://datasets/altar-genomics/clinvar-20260928-hg38",
        ),
    ),
    identity=PUBLISHED_RELEASE.identity(),
    release_metadata=RELEASE_METADATA,
    release_fields=release_fields(PUBLISHED_RELEASE),
)

Where PUBLISHED_RELEASE is published, read anonymously by default.

Its primary location, gcs, is a public-read Cloud Storage bucket. hf is a public Hugging Face dataset holding the same files, byte for byte, in the same layout. Both serve one release under one identity.

It declares the release metadata every file records, so altar pull clinvar checks an owned copy against it.

Local Parquet copies work out of the box after installing altar-clinvar. Reading the default gs:// published copy requires altar[gcs] (pip install "altar[gcs]"), and reading the hf mirror requires altar[hf].

ClinVarSource.published_dataset() returns it, and ClinVarSource.from_keywords reads it when no owned dataset or table is named. Only the latest release is published, and ClinVar releases often, so a newer release than this one is read from an owned copy (altar-clinvar-build) until the binding moves to it.

PUBLISHED_RELEASE module-attribute

PUBLISHED_RELEASE = ClinVarRelease(
    release_date="20260928", genome_build="hg38"
)

The latest ClinVar release the Kundaje lab publishes as altar-clinvar-build output: clinvar_20260928.vcf.gz from ClinVar's vcf_GRCh38 directory, on hg38.

RELEASE_METADATA module-attribute

RELEASE_METADATA = ParquetReleaseMetadata(
    prefix=PARQUET_METADATA_PREFIX,
    distribution="altar-clinvar",
    label="ClinVar",
    command="altar-clinvar-build",
)

How altar-clinvar-build records the release in every Parquet file, and how ClinVarSource checks it.

REVIEW_STARS module-attribute

REVIEW_STARS: dict[str, int] = {
    "practice_guideline": 4,
    "reviewed_by_expert_panel": 3,
    "criteria_provided,_multiple_submitters,_no_conflicts": 2,
    "criteria_provided,_conflicting_classifications": 1,
    "criteria_provided,_single_submitter": 1,
    "no_assertion_criteria_provided": 0,
    "no_classification_provided": 0,
    "no_classification_for_the_single_variant": 0,
    "no_classifications_from_unflagged_records": 0,
    "criteria_provided,_conflicting_interpretations": 1,
    "no_assertion_provided": 0,
    "no_interpretation_for_the_single_variant": 0,
}

ClinVar's gold stars for each germline review status, in its VCF spelling (spaces become underscores).

The mapping follows https://www.ncbi.nlm.nih.gov/clinvar/docs/review_status/. A review status not listed here has no star count, so clinvar_review_stars is null for it.

VCF_INFO_FIELDS module-attribute

VCF_INFO_FIELDS = (
    _field(
        "clinvar_variation_id",
        "Integer",
        "ClinVar Variation ID per ALT",
    ),
    _field(
        "clinvar_allele_id",
        "Integer",
        "ClinVar Allele ID per ALT",
    ),
    _field(
        "clinvar_classification",
        "String",
        "ClinVar germline classification per ALT",
    ),
    _field(
        "clinvar_pathogenic",
        "Integer",
        "ClinVar pathogenic or likely pathogenic germline classification (1 or 0) per ALT",
    ),
    _field(
        "clinvar_low_penetrance",
        "Integer",
        "ClinVar low-penetrance pathogenic classification (1 or 0) per ALT",
    ),
    _field(
        "clinvar_review_status",
        "String",
        "ClinVar germline review status per ALT",
    ),
    _field(
        "clinvar_review_stars",
        "Integer",
        "ClinVar germline review stars (0 to 4) per ALT",
    ),
    _field(
        "clinvar_conditions",
        "String",
        "ClinVar conditions per ALT, joined by &",
        shape="list",
    ),
    _field(
        "clinvar_conflicting_classifications",
        "String",
        "ClinVar conflicting classifications per ALT, joined by &",
        shape="list",
    ),
    _field(
        "clinvar_molecular_consequences",
        "String",
        "ClinVar molecular consequences per ALT, joined by &",
        shape="list",
    ),
    _field(
        "clinvar_variant_type",
        "String",
        "ClinVar variant type per ALT",
    ),
    _field(
        "clinvar_origin",
        "Integer",
        "ClinVar allele origin bits per ALT",
    ),
    _field(
        "clinvar_origins",
        "String",
        "ClinVar allele origins per ALT, joined by &",
        shape="list",
    ),
    _field(
        "clinvar_genes",
        "String",
        "ClinVar genes, one entry per gene",
        shape="entries",
        fields=("symbol", "gene_id"),
    ),
    _field(
        "clinvar_oncogenicity",
        "String",
        "ClinVar oncogenicity classification per ALT",
    ),
    _field(
        "clinvar_oncogenicity_review_status",
        "String",
        "ClinVar oncogenicity review status per ALT",
    ),
    _field(
        "clinvar_somatic_impact",
        "String",
        "ClinVar somatic clinical impact per ALT",
    ),
    _field(
        "clinvar_somatic_impact_review_status",
        "String",
        "ClinVar somatic clinical impact review status per ALT",
    ),
)

The ClinVar contract's columns as ALTAR1_CLINVAR_* INFO fields, in contract order.

ClinVarGenomeBuild module-attribute

ClinVarGenomeBuild = Literal['hg38', 'hg19']

ClinVarRelease dataclass

ClinVarRelease(
    release_date: str, genome_build: ClinVarGenomeBuild
)

The ClinVar VCF release a backend serves.

release_date is the YYYYMMDD date in ClinVar's file names, such as "20260928" for clinvar_20260928.vcf.gz; weekly and monthly files are both named this way. It must be 20240127 or later, the first release whose CLNSIG holds germline classifications only (see FIRST_GERMLINE_RELEASE).

genome_build is "hg38" (ClinVar's vcf_GRCh38 files) or "hg19" (vcf_GRCh37). ClinVar publishes each release on both assemblies from the same records, so the columns mean the same thing on either; only the coordinates differ, and the build is part of the identity.

release is the canonical label of the data, the release date.

release property

release: str

Return the canonical release label, the YYYYMMDD release date.

assembly property

assembly: str

Return the assembly name ClinVar writes in the VCF header, GRCh38 or GRCh37.

from_label classmethod

from_label(
    label: str, *, genome_build: str = "hg38"
) -> ClinVarRelease

Return the release a canonical label, its YYYYMMDD date such as "20260928", names on genome_build.

Raises TypeError for a label that is not a string and ValueError for one that is not a supported release date, or for an unsupported genome build.

identity

Return the identity of a source serving this release: CLINVAR_ANNOTATIONS, the date, and the build.

ClinVarSource

ClinVarSource(
    backend: AllelicRecordBackend,
    *,
    release: ClinVarRelease,
    prioritize_pathogenic: bool = False,
)

Bases: AllelicRecordAnnotationSource[ClinVarRelease]

ClinVar's germline classification of each variant, with its review status, conditions and genes.

backend reads a table with the allelic key columns its own configuration names plus every column of CLINVAR_ANNOTATIONS. release describes the data behind it, and identity() declares that contract with the release date and genome build. A variant with no row is omitted from the result.

prioritize_predicate() returns None unless prioritize_pathogenic is true, in which case it returns PATHOGENIC_PREDICATE. ClinVar is curated evidence rather than a model prediction, and many hosts use it as a filter or a display column rather than a reason to prioritize a variant, so prioritizing on it is opt-in. The flag changes only prioritization, not the values, so it is not part of identity().

With a ParquetAllelicRecordBackend, the constructor reads the release metadata altar-clinvar-build writes into each Parquet file and raises ValueError if a file was built for another release date or build, or records no release at all; a host's own export must carry the metadata release_fields names. from_dataset builds the source from such a dataset alone, taking the release from that metadata (read_release), and close closes what it or from_keywords opened. from_keywords builds it from a run spec: over the published latest release by default, or over an owned Parquet copy or BigQuery table; over a BigQuery table it returns a ClinVarTableSource, which also joins into a BigQuery store's SQL.

annotate raises ValueError if the backend returns an unrequested variant, more than one row for a variant, or a row that breaks the column contract: a clinvar_pathogenic, clinvar_low_penetrance, or clinvar_review_stars that does not follow from the classification and review status, clinvar_origins that do not decode clinvar_origin, or a clinvar_genes record without both a symbol and a gene ID. Repeated columns are lists; a null one reads as an empty list, and a JSON array string, as SQLite stores one, is decoded.

release_fields classmethod

release_fields(release: ClinVarRelease) -> dict[str, str]

Return release_fields(release), the footer fields that identify release.

read_release classmethod

read_release(
    dataset: str | PathLike[str],
    *,
    storage_options: Mapping[str, Any] | None = None,
) -> ClinVarRelease

Return the release the Parquet metadata of dataset records, read from its first file.

dataset is a file or a directory searched recursively, as a local path or a URI read with storage_options. Raises FileNotFoundError when it holds no Parquet file and ValueError when that file records no release; the constructor then holds the dataset to the release this returns.

from_keywords classmethod

from_keywords(
    *,
    dataset: str | PathLike[str] | None = None,
    table: str | None = None,
    release: str | None = None,
    genome_build: str | None = None,
    prioritize_pathogenic: bool = False,
    storage_options: Mapping[str, Any] | None = None,
    connection: Connection | None = None,
    location: str | None = None,
    **unknown: object,
) -> Self

Build the source from run spec options, reading the published, an owned Parquet, or a BigQuery copy.

  • With neither dataset nor table, the source reads the published latest release (published_dataset()) where it is hosted: anonymously by default, or with the storage options of connection, or with storage_options, when one is given. It reads the primary location, the gcs bucket, unless location names another, such as "hf" for the Hugging Face mirror, which needs the altar[hf] extra. location applies to the published copy only.
  • dataset is an owned Parquet copy that altar-clinvar-build wrote, as a path or a URI (from_dataset), read with the storage options of connection, or with storage_options, when one is given. It may hold any release the builder accepts, such as one newer than the published release.
  • table is an owned BigQuery table of the builder's columns, project.dataset.table, with the repeated columns as ARRAYs (altar pull --bigquery loads them so), read with connection.bigquery_client(), so it needs a connection. A table holds no Parquet metadata, so release names the release it holds, as its YYYYMMDD date; it defaults to the published latest release, which a table loaded from the published Parquet holds. The table's release labels, which altar pull --bigquery writes, are read with one metadata call (no query, no bytes billed): a table labelled with another release or build is refused, and a table with no labels, such as one loaded by hand, is accepted with a warning naming the release assumed (check_bigquery_release). The source is a ClinVarTableSource: a BigQueryScoreStore joins it into its own SQL through bigquery_relation(table), and any other store reads it through the checked Python annotate(). The two paths enforce different row rules; a table altar pull loaded holds the builder's guarantees, so both return the same values from it.

prioritize_pathogenic opts into PATHOGENIC_PREDICATE in every mode, and never changes the identity. storage_options and connection are exclusive: a connection supplies the storage options.

genome_build, when given, must name the build of the data, such as hg38 or GRCh38. The source's identity is the release's, so the three ways of reading one release, and bigquery_source over the same table, give the same identity, and the connection never enters it.

An option not named above raises ValueError listing the valid options.

published_dataset classmethod

published_dataset() -> PublishedDataset

Return PUBLISHED_DATASET, the latest release the lab publishes, which from_keywords reads by default.

annotation_contract classmethod

annotation_contract() -> AnnotationContract

Return CLINVAR_ANNOTATIONS, which every ClinVar source implements, so tooling can list it unbuilt.

vcf_info_fields classmethod

vcf_info_fields() -> tuple[AnnotationInfoField, ...]

Return altar_clinvar.vcf.VCF_INFO_FIELDS, the augmented-VCF preset of the ClinVar columns.

Provisional: altar.variants.augment_run_export reads it, and the hook is expected to change.

annotation_columns

annotation_columns() -> list[AnnotationColumn]

Declare the published ClinVar columns.

identity

Declare CLINVAR_ANNOTATIONS for the release date on its genome build.

prioritize_predicate

prioritize_predicate() -> Predicate | None

Return PATHOGENIC_PREDICATE when constructed with prioritize_pathogenic=True, else None.

annotate async

annotate(
    variant_ids: Sequence[str],
) -> dict[str, dict[str, object]]

Return ClinVar values for the requested variants that ClinVar has a row for.

ClinVarTableSource

ClinVarTableSource(
    client: Any,
    table_id: str,
    *,
    release: ClinVarRelease,
    prioritize_pathogenic: bool = False,
)

Bases: AllelicRecordTableSource[ClinVarRelease], ClinVarSource

A ClinVarSource over an owned BigQuery table that also joins into a BigQuery store's SQL.

annotate() is ClinVarSource's: it fetches rows through a BigQueryAllelicRecordBackend and checks each one. sql_join() is bigquery_source's: it returns bigquery_relation(table_id), so a BigQueryScoreStore reads ClinVar inside its materialize and export queries instead of calling annotate(). The two paths check different rules; see the module docstring.

prioritize_pathogenic gives PATHOGENIC_PREDICATE on both paths. ClinVarSource.from_keywords(table=...) builds this from a run spec, after checking the table's release labels. Its identity is release.identity(), the same as every other way of reading the release.

bigquery_relation

bigquery_relation(table_id: str) -> str

Return the relation= SQL that reads the ClinVar contract columns from table_id.

table_id is a project.dataset.table reference to a table loaded from altar-clinvar-build output, or any table with a canonical variant_id column and the columns of CLINVAR_ANNOTATIONS, its repeated columns as ARRAYs: ARRAY<STRING> for the repeated text columns and ARRAY<STRUCT<symbol STRING, gene_id INT64>> for clinvar_genes, as a Parquet load with list inference makes them (see the module docstring). The relation selects each column as it is, so a store's query returns the arrays themselves. It keeps the {variant_filter} token, so the store limits the read to the job's variants before joining. Clustering the table on variant_id lets BigQuery skip storage blocks for that filter.

bigquery_source

bigquery_source(
    client: Any,
    table_id: str,
    *,
    release: ClinVarRelease,
    prioritize_pathogenic: bool = False,
) -> BigQueryAnnotationSource

Return a BigQueryAnnotationSource that reads ClinVar classifications from table_id in SQL.

The source has ClinVarSource's name and columns. Like it, it has no prioritization predicate unless prioritize_pathogenic is true, when it has PATHOGENIC_PREDICATE. release describes the data in the table; the source's identity() is release.identity(), the same identity a ClinVarSource over that release declares. It is the SQL path of ClinVarTableSource.

classification_terms

classification_terms(
    classification: str | None,
) -> list[str]

Return the terms of a CLNSIG value, split on / and |; a comma stays inside its term.

is_low_penetrance

is_low_penetrance(classification: str | None) -> bool

Return whether a CLNSIG value includes a low-penetrance pathogenic or likely pathogenic classification.

is_pathogenic

is_pathogenic(classification: str | None) -> bool

Return whether a CLNSIG value includes a pathogenic or likely pathogenic germline classification.

Any term in PATHOGENIC_CLASSIFICATIONS counts, so Pathogenic/Pathogenic,_low_penetrance|risk_factor and Likely_pathogenic/Likely_risk_allele are pathogenic, and Pathogenic,_low_penetrance alone is not. A missing classification is not pathogenic.

origin_labels

origin_labels(origin: int | None) -> list[str]

Return the allele origins an ORIGIN bitmask combines: ["unknown"] for 0, and [] when it is missing.

Bits ClinVar has not defined (see ORIGIN_BITS) have no label and are left out. Raises ValueError for a negative value.

release_fields

release_fields(release: ClinVarRelease) -> dict[str, str]

Return the fields that identify release in Parquet metadata: release_date and genome_build.

review_stars

review_stars(review_status: str | None) -> int | None

Return ClinVar's gold stars for a germline review status, or None if it is missing or not in REVIEW_STARS.


altar_conservation

altar-conservation — base-wise phyloP conservation lookup and bigWig track builder. Full scientific details, outputs, and CLI examples are on the phyloP (altar_conservation) integration page.

Symbol Description
PHYLOP100WAY UCSC hg38 phyloP 100-way (hg38.phyloP100way.bw, May 2015), published as phylop100way-hg38.
PHYLOP100WAY_ANNOTATIONS The phyloP 100-way annotation contract: one float column, phylop100way.
PHYLOP100WAY_VCF_INFO_FIELDS The phylop100way column as the ALTAR1_PHYLOP100WAY INFO field.
TRACKS Every published track by name, as the builder's --track names it.
ConservationAnnotationSource Annotate variants with one conservation track's score, from its published copy or an owned copy.
ConservationTrack One published base-wise conservation track.
PhyloP100wayAnnotationSource Evolutionary conservation at each variant's bases, from UCSC's hg38 phyloP 100-way scores.

Base-wise conservation score tracks, such as UCSC phyloP 100-way, as Altar annotation sources.

PHYLOP100WAY module-attribute

PHYLOP100WAY = ConservationTrack(
    contract=PHYLOP100WAY_ANNOTATIONS,
    genome_build="hg38",
    release="2015-05",
    upstream_url="https://hgdownload.soe.ucsc.edu/goldenPath/hg38/phyloP100way/hg38.phyloP100way.bw",
    upstream_md5="43858006bdf98145b6fd239490bd0478",
    published=_published(
        PHYLOP100WAY_ANNOTATIONS,
        release="2015-05",
        genome_build="hg38",
        path="phylop100way-hg38",
    ),
)

UCSC hg38 phyloP 100-way (hg38.phyloP100way.bw, May 2015), published as phylop100way-hg38.

PHYLOP100WAY_ANNOTATIONS module-attribute

PHYLOP100WAY_ANNOTATIONS = AnnotationContract(
    source_id="org.kundajelab.altar.annotation.phylop100way",
    schema_version="1.0.0",
    columns=(
        AnnotationColumn(
            name="phylop100way",
            dtype="float",
            label="phyloP 100-way",
        ),
    ),
)

The phyloP 100-way annotation contract: one float column, phylop100way.

The value is UCSC's phyloP score over the 100-vertebrate alignment at the variant's base: a base-wise -log10 p-value of conservation (positive, slower evolution than neutral) or acceleration (negative, faster), from about -20 to 10. A source scoring indels takes the greatest score over the bases the variant touches. A contract names no genome build, so an hg19 copy would implement it too, under another identity.

PHYLOP100WAY_VCF_INFO_FIELDS module-attribute

PHYLOP100WAY_VCF_INFO_FIELDS = (
    AnnotationInfoField(
        "ALTAR1_PHYLOP100WAY",
        ("phylop100way",),
        "Float",
        "UCSC phyloP 100-way conservation score per ALT, the greatest over the bases the ALT touches",
    ),
)

The phylop100way column as the ALTAR1_PHYLOP100WAY INFO field.

TRACKS module-attribute

TRACKS: dict[str, ConservationTrack] = {
    track.name: track for track in (PHYLOP100WAY,)
}

Every published track by name, as the builder's --track names it.

ConservationAnnotationSource

Bases: PositionScoreAnnotationSource

Annotate variants with one conservation track's score, from its published copy or an owned copy.

A subclass names its track and registers under track.name. Build it with from_keywords. The identity is the track's contract with the dataset's release and genome build, so the published copy, a pulled copy and a copy built with altar-conservation-build from the same upstream file declare one identity; indels="max" adds +indels-max to the release. A track exists on one genome build, which a subclass declares as its supported_genome_builds: phyloP 100-way is hg38, so materialization joins it only to hg38 variants, and on another assembly a model's dependency on it reads as missing.

from_keywords classmethod

from_keywords(
    *,
    dataset: str | PathLike[str] | None = None,
    location: str | None = None,
    storage_options: Mapping[str, Any] | None = None,
    connection: Connection | None = None,
    indels: Literal["skip", "max"] = "skip",
    genome_build: str | None = None,
    name: str | None = None,
    prioritize_predicate: Predicate | None = None,
    **unknown: object,
) -> Self

Build the source from run spec options, over the published copy or an owned Parquet copy.

  • With no dataset, the source reads the published copy (published_dataset()) where it is hosted: anonymously, or with connection's or storage_options' options, from the primary gcs location unless location names another, such as "hf" (which needs altar[hf]).
  • dataset is an owned copy, as a path or a URI: one altar pull <track> --to <dir> made, or one altar-conservation-build wrote. It is read with connection's storage options for it, or with storage_options.

indels is "skip" (SNVs only, the default) or "max" (every variant, by the greatest score over the bases it touches; see PositionScoreAnnotationSource). genome_build, when given, must be the dataset's. name renames the source, and prioritize_predicate, which a spec cannot spell, makes it gate prioritized when built in code. The source reads no BigQuery table, so it takes neither table nor release, which names a table's release. A table raises ValueError that says to pull the dataset instead. An unknown location raises ValueError naming the published locations, and an option not named here raises ValueError listing the valid ones.

published_dataset classmethod

published_dataset() -> PublishedDataset

Return the track's published copy, which from_keywords reads by default.

annotation_contract classmethod

annotation_contract() -> AnnotationContract

Return the track's contract, which every instance implements, for altar sources.

ConservationTrack dataclass

ConservationTrack(
    contract: AnnotationContract,
    genome_build: str,
    release: str,
    upstream_url: str,
    upstream_md5: str,
    published: PublishedDataset,
)

One published base-wise conservation track.

contract declares the track's one float column, whose name is also the track's name, its source's registry name and its builder's --track. release labels the upstream file (UCSC's file date, YYYY-MM), upstream_url is where the bigWig is downloaded from and upstream_md5 the checksum its host publishes, which the builder checks. published is where the Kundaje lab hosts the built dataset.

name property

name: str

The track's name: its contract's one column, such as phylop100way.

PhyloP100wayAnnotationSource

Bases: ConservationAnnotationSource

Evolutionary conservation at each variant's bases, from UCSC's hg38 phyloP 100-way scores.

Positive scores mark bases that evolved more slowly than neutral across 100 vertebrates, negative faster. The track is PHYLOP100WAY, registered as phylop100way.

vcf_info_fields classmethod

vcf_info_fields() -> tuple[AnnotationInfoField, ...]

Return altar_conservation.vcf.PHYLOP100WAY_VCF_INFO_FIELDS, the augmented-VCF preset of the score.

Provisional: altar.variants.augment_run_export reads it, and the hook is expected to change.


altar_opentargets_e2g

altar-opentargets-e2g — enhancer-to-gene link source and annotation source. Full scientific details, outputs, and CLI examples are on the Open Targets E2G (altar_opentargets_e2g) integration page.

Symbol Description
OPEN_TARGETS_E2G_DATASET Public export.
PUBLISHED_DATASET Where PUBLISHED_RELEASE is published, read anonymously by default.
PUBLISHED_GENOME_BUILD Public export.
PUBLISHED_RELEASE The Open Targets Platform release the Kundaje lab publishes as a link dataset: enhancer_to_gene of 26.09 (2026-09-24), on hg38.
VCF_INFO_FIELDS The link contract's columns as ALTAR1_OT_E2G_* INFO fields.
OpenTargetsE2GAnnotationSource The genes each variant may regulate, from ENCODE-rE2G enhancer–gene links (Open Targets).
OpenTargetsE2GImportConfig Release metadata required to interpret Open Targets rows.
OpenTargetsE2GImportReport Counts for one atomically published streaming import.
OpenTargetsE2GImporter Normalize an iterable of Open Targets rows without owning its transport or database.
OpenTargetsE2GRow The public subset of one Open Targets enhancer_to_gene Parquet/table row.
OpenTargetsE2GSource Query normalized Open Targets evidence from any compliant link store.
OpenTargetsResourceScore One named component score retained from the Open Targets interval schema.
vcf_info_fields Return the link columns as INFO fields; a column_prefix also goes into each INFO ID.

Open Targets ENCODE-rE2G binding for Altar's variant-gene link contract.

OPEN_TARGETS_E2G_DATASET module-attribute

OPEN_TARGETS_E2G_DATASET = VariantGeneLinkDatasetRef(
    namespace="org.opentargets.platform",
    name="enhancer-to-gene",
    version="1",
)

PUBLISHED_DATASET module-attribute

PUBLISHED_DATASET = PublishedDataset(
    locations=(
        PublishedLocation(
            "gcs",
            "gs://kundajelab-altar/opentargets-e2g/enhancer-to-gene-26.09",
        ),
        PublishedLocation(
            "hf",
            "hf://datasets/altar-genomics/opentargets-e2g-26.09",
        ),
    ),
    identity=VARIANT_GENE_LINK_ANNOTATION_CONTRACT.identity(
        release=PUBLISHED_RELEASE,
        genome_build=PUBLISHED_GENOME_BUILD,
    ),
    release_metadata=LINK_DATASET_METADATA,
    release_fields=link_dataset_release_fields(
        release=PUBLISHED_RELEASE,
        genome_build=PUBLISHED_GENOME_BUILD,
        dataset=OPEN_TARGETS_E2G_DATASET,
    ),
    cluster_by=("chromosome", "start"),
)

Where PUBLISHED_RELEASE is published, read anonymously by default.

Its primary location, gcs, is a public-read Cloud Storage bucket; hf is a public Hugging Face dataset holding the same files in the same layout. It declares the footer fields every file records, so altar pull opentargets_e2g checks a copy against it, and altar pull opentargets_e2g --bigquery clusters the table on chromosome, start, the columns a table read filters on. Local Parquet copies work out of the box; reading the default gs:// published copy requires altar[gcs] (pip install "altar[gcs]"), and reading the hf mirror requires altar[hf].

PUBLISHED_GENOME_BUILD module-attribute

PUBLISHED_GENOME_BUILD = 'hg38'

PUBLISHED_RELEASE module-attribute

PUBLISHED_RELEASE = '26.09'

The Open Targets Platform release the Kundaje lab publishes as a link dataset: enhancer_to_gene of 26.09 (2026-09-24), on hg38.

VCF_INFO_FIELDS module-attribute

VCF_INFO_FIELDS = vcf_info_fields()

The link contract's columns as ALTAR1_OT_E2G_* INFO fields.

OpenTargetsE2GAnnotationSource

Bases: VariantGeneLinkAnnotationSource

The genes each variant may regulate, from ENCODE-rE2G enhancer–gene links (Open Targets).

Each variant gets the Open Targets E2G links whose element overlaps it.

Build it with from_keywords (the published copy by default) or the inherited from_dataset and from_bigquery_table. Its columns and identity are VARIANT_GENE_LINK_ANNOTATION_CONTRACT's, with the release the dataset records, so the published copy, a pulled copy and a copy built with altar-opentargets-e2g-build from the same release declare one identity. filters (with a fingerprint added to the release) and column_prefix work as on VariantGeneLinkAnnotationSource.

from_keywords classmethod

from_keywords(
    *,
    dataset: str | PathLike[str] | None = None,
    table: str | None = None,
    release: str | None = None,
    genome_build: str | None = None,
    filters: Mapping[str, Any]
    | VariantGeneLinkFilters
    | None = None,
    column_prefix: str | None = None,
    name: str | None = None,
    prioritize_predicate: Predicate | None = None,
    storage_options: Mapping[str, Any] | None = None,
    connection: Connection | None = None,
    location: str | None = None,
    **unknown: object,
) -> Self

Build the source from run spec options, over the published copy, an owned Parquet copy or a table.

  • With no dataset, the source reads the published latest release (published_dataset()) where it is hosted: anonymously, or with connection's or storage_options' options, from the primary gcs location unless location names another, such as "hf" (which needs altar[hf]).
  • dataset is an owned copy, as a path or a URI: one altar pull opentargets_e2g --to <dir> made, or one altar-opentargets-e2g-build wrote, which may hold another release. It is read with connection's storage options for it, or with storage_options.
  • table is an owned BigQuery table, project.dataset.table, such as one altar pull opentargets_e2g --bigquery <table> loaded, read with connection.bigquery_client(), so it needs a gcp connection. A table holds no Parquet metadata, so release names the release it holds, by default the published one. The table's release labels are checked with one metadata call: a table labelled with another release is refused, and one with no labels is read with a warning. annotate runs one range-join query per 10,000 variants (VariantGeneLinkAnnotationSource.from_bigquery_table).

filters is a mapping of VariantGeneLinkFilters fields whose identifier filters are lists of strings, such as {context_names = ["right kidney"]}; with filters, the identity's release is the dataset's release plus a fingerprint of them. column_prefix and name work as on VariantGeneLinkAnnotationSource, and prioritize_predicate, which a spec cannot spell, makes the source gate prioritized when the source is built in code. genome_build, when given, must be the dataset's. release is refused without a table: Parquet files record their own. An unknown location or filter raises ValueError naming the valid ones, and so does an option not named here.

close

close() -> None

Close what the source opened, and the BigQuery client from_keywords built; a second call does nothing.

published_dataset classmethod

published_dataset() -> PublishedDataset

Return PUBLISHED_DATASET, the latest release the lab publishes, which from_keywords reads by default.

annotation_contract classmethod

annotation_contract() -> AnnotationContract

Return VARIANT_GENE_LINK_ANNOTATION_CONTRACT, which every instance implements, for altar sources.

vcf_info_fields classmethod

vcf_info_fields() -> tuple[AnnotationInfoField, ...]

Return altar_opentargets_e2g.vcf.VCF_INFO_FIELDS, the augmented-VCF preset of the link columns.

It reads the columns without a column_prefix. Provisional: altar.variants.augment_run_export reads it, and the hook is expected to change.

OpenTargetsE2GImportConfig dataclass

OpenTargetsE2GImportConfig(
    data_release: str,
    genome_build: GenomeBuild = GRCH38,
    gene_namespace_version: str | None = None,
    dataset_url: str | None = None,
    score_threshold: float | None = None,
    threshold_applied: bool | None = None,
)

Release metadata required to interpret Open Targets rows.

OpenTargetsE2GImportReport dataclass

OpenTargetsE2GImportReport(
    generation_id: str,
    processed_rows: int,
    added_records: int,
    skipped_records: int,
)

Counts for one atomically published streaming import.

OpenTargetsE2GImporter

OpenTargetsE2GImporter(
    store: VariantGeneLinkStoreWriter,
    *,
    dataset: VariantGeneLinkDatasetRef = OPEN_TARGETS_E2G_DATASET,
    batch_size: int = 10000,
)

Normalize an iterable of Open Targets rows without owning its transport or database.

ingest async

ingest(
    rows: Iterable[OpenTargetsE2GRow],
    config: OpenTargetsE2GImportConfig,
    *,
    generation_id: str,
) -> OpenTargetsE2GImportReport

Stage bounded batches and publish only after the complete iterable succeeds.

generation_id should identify the exact upstream asset or extraction. Replaying the same rows with the same identifier is idempotent; changed records are rejected by the store rather than overwritten.

OpenTargetsE2GRow dataclass

OpenTargetsE2GRow(
    interval_id: str,
    chromosome: str,
    start: int,
    end: int,
    gene_id: str,
    score: float | None,
    biosample_name: str | None,
    biosample_id: str | None,
    interval_type: str,
    distance_to_tss: int | None,
    datasource_id: str,
    pmid: str | None = None,
    study_id: str | None = None,
    gene_symbol: str | None = None,
    biosample_from_source_id: str | None = None,
    resource_scores: tuple[
        OpenTargetsResourceScore, ...
    ] = (),
    quality_controls: tuple[str, ...] = (),
    evidence_metadata: Mapping[str, object] = dict(),
)

The public subset of one Open Targets enhancer_to_gene Parquet/table row.

from_source_mapping classmethod

from_source_mapping(
    row: Mapping[str, object],
) -> OpenTargetsE2GRow

Parse one row using the official Open Targets camelCase Parquet schema.

to_evidence_record

to_evidence_record(
    config: OpenTargetsE2GImportConfig,
) -> VariantGeneEvidenceRecord

Normalize this source row into Altar's query-independent storage record.

OpenTargetsE2GSource

Bases: StoredVariantGeneLinkSource

Query normalized Open Targets evidence from any compliant link store.

decode_record

decode_record(
    record: VariantGeneEvidenceRecord, locus: VariantLocus
) -> VariantGeneLink

Restore stable tuple shapes used by the binding's public provenance metadata.

OpenTargetsResourceScore dataclass

OpenTargetsResourceScore(name: str, value: float | None)

One named component score retained from the Open Targets interval schema.

vcf_info_fields

vcf_info_fields(
    column_prefix: str | None = None,
) -> tuple[AnnotationInfoField, ...]

Return the link columns as INFO fields; a column_prefix also goes into each INFO ID.


altar_alphamissense

altar-alphamissense — missense pathogenicity lookup across Parquet, SQLite, and BigQuery. Full scientific details, outputs, and CLI examples are on the AlphaMissense (altar_alphamissense) integration page.

Symbol Description
ALPHAMISSENSE_ANNOTATIONS The AlphaMissense annotation contract: the per-variant summary, transcript detail and release provenance.
ALPHAMISSENSE_KEY_COLUMNS The allelic key columns altar-alphamissense-build writes.
PARQUET_LAYOUT The file layout altar-alphamissense-build writes and the source reads.
PARQUET_METADATA_PREFIX The prefix of the Parquet key-value metadata altar-alphamissense-build writes: release, genome_build, layout, and builder_version.
RELEASE_METADATA How altar-alphamissense-build records the release and layout in every Parquet file, and how the source checks them.
VCF_INFO_FIELDS The AlphaMissense contract's scores as ALTAR1_AM_* INFO fields.
AlphaMissenseLocus One normalized variant key requested from an AlphaMissense backend.
AlphaMissenseRelease The published AlphaMissense release a backend serves.
AlphaMissenseRow One native transcript-level AlphaMissense record returned by a backend.
AlphaMissenseSource Predicted missense pathogenicity for each variant, from AlphaMissense.
release_fields Return the fields that identify release in Parquet metadata: release and genome_build.

Public exports for the AlphaMissense Altar binding.

ALPHAMISSENSE_ANNOTATIONS module-attribute

ALPHAMISSENSE_ANNOTATIONS = AnnotationContract(
    source_id="org.kundajelab.altar.annotation.alphamissense",
    schema_version="1.0.0",
    columns=(
        AnnotationColumn(
            name="am_pathogenicity",
            dtype="float",
            label="AlphaMissense Pathogenicity",
        ),
        AnnotationColumn(
            name="am_class",
            dtype="str",
            label="AlphaMissense Class",
        ),
        AnnotationColumn(
            name="am_transcript_scores",
            dtype="struct",
            label="AlphaMissense Transcript Scores",
            repeated=True,
            fields=TRANSCRIPT_SCORE_FIELDS,
        ),
        AnnotationColumn(
            name="am_genome_build",
            dtype="str",
            label="AlphaMissense Genome Build",
        ),
        AnnotationColumn(
            name="am_source_release",
            dtype="str",
            label="AlphaMissense Source Release",
        ),
    ),
)

The AlphaMissense annotation contract: the per-variant summary, transcript detail and release provenance.

Any source can implement it, such as a warehouse table a host already holds; AlphaMissenseSource is the reference implementation.

ALPHAMISSENSE_KEY_COLUMNS module-attribute

ALPHAMISSENSE_KEY_COLUMNS = AllelicKeyColumns(
    chromosome="chr",
    position="pos",
    reference_allele="ref",
    alternate_allele="alt",
)

The allelic key columns altar-alphamissense-build writes. The chromosome uses the canonical chr spelling.

PARQUET_LAYOUT module-attribute

PARQUET_LAYOUT = '2'

The file layout altar-alphamissense-build writes and the source reads.

Layout 2 is chr=<chromosome>/<input>.parquet with variant_id, the key columns ALPHAMISSENSE_KEY_COLUMNS and the native columns in every file. The first builder wrote CHROM=<chromosome>/ partitions whose files held neither the chromosome nor variant_id and recorded no layout; the source refuses such a dataset and names the builder to rebuild it with.

PARQUET_METADATA_PREFIX module-attribute

PARQUET_METADATA_PREFIX = 'altar_alphamissense.'

The prefix of the Parquet key-value metadata altar-alphamissense-build writes: release, genome_build, layout, and builder_version.

RELEASE_METADATA module-attribute

RELEASE_METADATA = ParquetReleaseMetadata(
    prefix=PARQUET_METADATA_PREFIX,
    distribution="altar-alphamissense",
    label="AlphaMissense",
    command="altar-alphamissense-build",
    layout=PARQUET_LAYOUT,
)

How altar-alphamissense-build records the release and layout in every Parquet file, and how the source checks them.

VCF_INFO_FIELDS module-attribute

VCF_INFO_FIELDS = (
    AnnotationInfoField(
        "ALTAR1_AM_SCORE",
        ("am_pathogenicity",),
        "Float",
        "AlphaMissense pathogenicity score per ALT",
    ),
    AnnotationInfoField(
        "ALTAR1_AM_CLASS",
        ("am_class",),
        "String",
        "AlphaMissense class per ALT",
    ),
    AnnotationInfoField(
        "ALTAR1_AM_TRANSCRIPTS",
        ("am_transcript_scores",),
        "String",
        "AlphaMissense scores, one entry per transcript",
        shape="entries",
        fields=TRANSCRIPT_ENTRY_FIELDS,
    ),
)

The AlphaMissense contract's scores as ALTAR1_AM_* INFO fields.

AlphaMissenseLocus dataclass

AlphaMissenseLocus(
    variant_id: str,
    chromosome: str,
    position: int,
    reference_allele: str,
    alternate_allele: str,
)

One normalized variant key requested from an AlphaMissense backend.

from_variant_id classmethod

from_variant_id(variant_id: str) -> AlphaMissenseLocus

Parse a chromosome:position:reference:alternate variant identifier.

AlphaMissenseRelease dataclass

AlphaMissenseRelease(
    genome_build: str, source_release: str
)

The published AlphaMissense release a backend serves.

genome_build is the assembly of the release's coordinates, spelled as in its genome column: hg19 or hg38. source_release names the exact upstream release, such as the Zenodo record version that was downloaded. Both are part of the scientific identity of every annotation the source emits.

AlphaMissenseRow dataclass

AlphaMissenseRow(
    variant_id: str,
    genome: str,
    uniprot_id: str | None,
    transcript_id: str | None,
    protein_variant: str | None,
    am_pathogenicity: float,
    am_class: str,
)

One native transcript-level AlphaMissense record returned by a backend.

AlphaMissenseSource

AlphaMissenseSource(
    backend: AllelicRecordBackend,
    *,
    release: AlphaMissenseRelease,
    genome_build: str,
    prioritization_threshold: float | None = None,
)

Bases: AllelicRecordAnnotationSource[AlphaMissenseRelease]

Predicted missense pathogenicity for each variant, from AlphaMissense.

Normalizes transcript-level AlphaMissense evidence into per-variant annotations.

The transcript with the greatest pathogenicity score supplies the scalar am_pathogenicity and am_class values. All transcript matches are retained in am_transcript_scores as typed records, ordered by descending pathogenicity.

release describes the data behind backend. genome_build is the assembly of the variant IDs the caller will pass to annotate, in either spelling (hg38 or GRCh38). The constructor raises ValueError when the two name different assemblies. annotate raises ValueError if the backend returns a record whose native genome value is not the release's build.

With a ParquetAllelicRecordBackend, the constructor also reads the release metadata altar-alphamissense-build writes into the dataset's first Parquet file and raises ValueError if it was built for another release or build, records no release at all, or has another file layout than PARQUET_LAYOUT, as a dataset of the first builder has; a host's own export must carry the metadata RELEASE_METADATA.write(release_fields(release)) returns. from_dataset builds the source from such a dataset alone, taking the release from that metadata (read_release), and close closes the backend it opened.

release_fields classmethod

release_fields(
    release: AlphaMissenseRelease,
) -> dict[str, str]

Return release_fields(release), the footer fields that identify release.

read_release classmethod

read_release(
    dataset: str | PathLike[str],
    *,
    storage_options: Mapping[str, Any] | None = None,
) -> AlphaMissenseRelease

Return the release the Parquet metadata of dataset records, read from its first file.

dataset is a file or a directory searched recursively, as a local path or a URI read with storage_options. Raises FileNotFoundError when it holds no Parquet file and ValueError when that file records no release; the constructor then holds the dataset to the release this returns.

from_keywords classmethod

from_keywords(
    *,
    dataset: str | PathLike[str],
    genome_build: str | None = None,
    prioritization_threshold: float | None = None,
    storage_options: Mapping[str, Any] | None = None,
    connection: Connection | None = None,
    **unknown: Any,
) -> Self

Build the source from run spec options, over the Parquet dataset altar-alphamissense-build wrote.

dataset is the dataset's path or URI (from_dataset). It is read with connection's storage options for it, or with storage_options. With neither, the provider's ambient credentials apply. storage_options and connection are exclusive: a connection supplies the storage options. The connection never enters the source's identity.

genome_build, when given, must name the dataset's build, as hg38 or GRCh38.

An option not named above raises ValueError listing the valid options.

annotation_contract classmethod

annotation_contract() -> AnnotationContract

Return ALPHAMISSENSE_ANNOTATIONS, which every AlphaMissense source implements, so tooling lists it.

vcf_info_fields classmethod

vcf_info_fields() -> tuple[AnnotationInfoField, ...]

Return altar_alphamissense.vcf.VCF_INFO_FIELDS, the augmented-VCF preset of the AlphaMissense columns.

Provisional: altar.variants.augment_run_export reads it, and the hook is expected to change.

annotation_columns

annotation_columns() -> list[AnnotationColumn]

Declare the scalar summary, lossless transcript detail, and release provenance.

identity

Declare ALPHAMISSENSE_ANNOTATIONS for the release's upstream version and genome build.

annotate async

annotate(
    variant_ids: Sequence[str],
) -> dict[str, dict[str, object]]

Fetch and aggregate AlphaMissense transcript records for variant_ids.

prioritize_predicate

prioritize_predicate() -> Predicate

Prioritize by prioritization_threshold when set, else likely_pathogenic / ambiguous classes.

release_fields

release_fields(
    release: AlphaMissenseRelease,
) -> dict[str, str]

Return the fields that identify release in Parquet metadata: release and genome_build.


altar_spliceai

altar-spliceai — precomputed splice delta lookup and dataset builder. Full scientific details, outputs, and CLI examples are on the SpliceAI (altar_spliceai) integration page.

Symbol Description
PARQUET_LAYOUT The file layout altar-spliceai-build writes and SpliceAISource reads.
PARQUET_METADATA_PREFIX The prefix of the Parquet key-value metadata altar-spliceai-build writes: release, masked, genome_build, layout, and builder_version.
RELEASE_METADATA How altar-spliceai-build records the release and layout in every Parquet file, and how SpliceAISource checks them.
SPLICEAI_ANNOTATIONS The precomputed SpliceAI annotation contract: the top gene record, every gene record, and provenance.
SPLICEAI_KEY_COLUMNS The allelic key columns altar-spliceai-build writes.
VCF_INFO_FIELDS The SpliceAI contract's scores as ALTAR1_SPLICEAI_* INFO fields.
SpliceAILocus One normalized variant key requested from a SpliceAI backend.
SpliceAIRelease The published SpliceAI score release a backend serves.
SpliceAIRow One gene-level SpliceAI record returned by a backend.
SpliceAISource Predicted splicing disruption for each variant, from precomputed SpliceAI scores.
release_fields Return the fields that identify release in Parquet metadata: release, masked, and genome_build.

Public exports for the precomputed SpliceAI Altar binding.

PARQUET_LAYOUT module-attribute

PARQUET_LAYOUT = '2'

The file layout altar-spliceai-build writes and SpliceAISource reads.

Layout 2 is chr=<chromosome>/<input>.parquet with variant_id, the key columns SPLICEAI_KEY_COLUMNS and the gene record's columns in every file. The first builder wrote CHROM=<chromosome>/ partitions whose files held neither the chromosome nor variant_id and recorded no layout; the source refuses such a dataset and names the builder to rebuild it with.

PARQUET_METADATA_PREFIX module-attribute

PARQUET_METADATA_PREFIX = 'altar_spliceai.'

The prefix of the Parquet key-value metadata altar-spliceai-build writes: release, masked, genome_build, layout, and builder_version.

RELEASE_METADATA module-attribute

RELEASE_METADATA = ParquetReleaseMetadata(
    prefix=PARQUET_METADATA_PREFIX,
    distribution="altar-spliceai",
    label="SpliceAI",
    command="altar-spliceai-build",
    layout=PARQUET_LAYOUT,
)

How altar-spliceai-build records the release and layout in every Parquet file, and how SpliceAISource checks them.

SPLICEAI_ANNOTATIONS module-attribute

SPLICEAI_ANNOTATIONS = AnnotationContract(
    source_id="org.kundajelab.altar.annotation.spliceai",
    schema_version="1.0.0",
    columns=(
        AnnotationColumn(
            name="spliceai_ds_max",
            dtype="float",
            label="SpliceAI Maximum Delta Score",
        ),
        AnnotationColumn(
            name="spliceai_symbol",
            dtype="str",
            label="SpliceAI Top Gene",
        ),
        AnnotationColumn(
            name="spliceai_ds_ag",
            dtype="float",
            label="SpliceAI Acceptor Gain",
        ),
        AnnotationColumn(
            name="spliceai_ds_al",
            dtype="float",
            label="SpliceAI Acceptor Loss",
        ),
        AnnotationColumn(
            name="spliceai_ds_dg",
            dtype="float",
            label="SpliceAI Donor Gain",
        ),
        AnnotationColumn(
            name="spliceai_ds_dl",
            dtype="float",
            label="SpliceAI Donor Loss",
        ),
        AnnotationColumn(
            name="spliceai_dp_ag",
            dtype="int",
            label="SpliceAI Acceptor Gain Position",
        ),
        AnnotationColumn(
            name="spliceai_dp_al",
            dtype="int",
            label="SpliceAI Acceptor Loss Position",
        ),
        AnnotationColumn(
            name="spliceai_dp_dg",
            dtype="int",
            label="SpliceAI Donor Gain Position",
        ),
        AnnotationColumn(
            name="spliceai_dp_dl",
            dtype="int",
            label="SpliceAI Donor Loss Position",
        ),
        AnnotationColumn(
            name="spliceai_gene_scores",
            dtype="struct",
            label="SpliceAI Gene Scores",
            repeated=True,
            fields=GENE_SCORE_FIELDS,
        ),
        AnnotationColumn(
            name="spliceai_genome_build",
            dtype="str",
            label="SpliceAI Genome Build",
        ),
        AnnotationColumn(
            name="spliceai_masked",
            dtype="bool",
            label="SpliceAI Masked Scores",
        ),
        AnnotationColumn(
            name="spliceai_source_release",
            dtype="str",
            label="SpliceAI Source Release",
        ),
    ),
)

The precomputed SpliceAI annotation contract: the top gene record, every gene record, and provenance.

Any source can implement it; SpliceAISource is the reference implementation.

SPLICEAI_KEY_COLUMNS module-attribute

SPLICEAI_KEY_COLUMNS = AllelicKeyColumns(
    chromosome="chr",
    position="pos",
    reference_allele="ref",
    alternate_allele="alt",
)

The allelic key columns altar-spliceai-build writes. The chromosome uses the canonical chr spelling.

VCF_INFO_FIELDS module-attribute

VCF_INFO_FIELDS = (
    _field(
        "spliceai_ds_max", "Float", "maximum delta score"
    ),
    _field(
        "spliceai_symbol",
        "String",
        "gene of the maximum delta score",
    ),
    *(
        _field(
            f"spliceai_ds_{kind}",
            "Float",
            f"{label} delta score",
        )
        for kind, label in _SCORES.items()
    ),
    *(
        _field(
            f"spliceai_dp_{kind}",
            "Integer",
            f"{label} position relative to the ALT",
        )
        for kind, label in _SCORES.items()
    ),
    _field(
        "spliceai_masked",
        "Integer",
        "masked scores (1 or 0)",
    ),
    AnnotationInfoField(
        "ALTAR1_SPLICEAI_GENES",
        ("spliceai_gene_scores",),
        "String",
        "SpliceAI scores, one entry per gene",
        shape="entries",
        fields=GENE_ENTRY_FIELDS,
    ),
)

The SpliceAI contract's scores as ALTAR1_SPLICEAI_* INFO fields.

SpliceAILocus dataclass

SpliceAILocus(
    variant_id: str,
    chromosome: str,
    position: int,
    reference_allele: str,
    alternate_allele: str,
)

One normalized variant key requested from a SpliceAI backend.

from_variant_id classmethod

from_variant_id(variant_id: str) -> SpliceAILocus

Parse a chromosome:position:reference:alternate identifier.

SpliceAIRelease dataclass

SpliceAIRelease(
    genome_build: str, masked: bool, source_release: str
)

The published SpliceAI score release a backend serves.

genome_build is the assembly of the release's coordinates: hg19 or hg38. masked is True for Illumina's masked score files and False for the raw files. Masked files set a delta score to 0 when it reports a gain of an existing splice site or a loss of a non-site, so raw and masked scores are different quantities. source_release names the exact upstream release, for example "1.3". All three are part of the scientific identity of every annotation the source emits.

SpliceAIRow dataclass

SpliceAIRow(
    variant_id: str,
    symbol: str,
    ds_ag: float | None,
    ds_al: float | None,
    ds_dg: float | None,
    ds_dl: float | None,
    dp_ag: int | None,
    dp_al: int | None,
    dp_dg: int | None,
    dp_dl: int | None,
)

One gene-level SpliceAI record returned by a backend.

ds_max property

ds_max: float | None

Return the greatest non-missing acceptor/donor delta score.

SpliceAISource

SpliceAISource(
    backend: AllelicRecordBackend,
    *,
    release: SpliceAIRelease,
    genome_build: str,
    prioritization_threshold: float = DEFAULT_PRIORITIZATION_THRESHOLD,
)

Bases: AllelicRecordAnnotationSource[SpliceAIRelease]

Predicted splicing disruption for each variant, from precomputed SpliceAI scores.

Normalizes gene-level SpliceAI records into per-variant annotations.

release describes the data behind backend. genome_build is the assembly of the variant IDs the caller will pass to annotate, in either spelling (hg38 or GRCh38). The constructor raises ValueError when the two name different assemblies.

With a ParquetAllelicRecordBackend, the constructor also reads the release metadata altar-spliceai-build writes into the dataset's first Parquet file and raises ValueError if it was built for another release, masking, or build, records no release at all, or has another file layout than PARQUET_LAYOUT, as a dataset of the first builder has; a host's own export must carry the metadata RELEASE_METADATA.write(release_fields(release)) returns. from_dataset builds the source from such a dataset alone, taking the release from that metadata (read_release), and close closes the backend it opened.

release_fields classmethod

release_fields(release: SpliceAIRelease) -> dict[str, str]

Return release_fields(release), the footer fields that identify release and its masking.

read_release classmethod

read_release(
    dataset: str | PathLike[str],
    *,
    storage_options: Mapping[str, Any] | None = None,
) -> SpliceAIRelease

Return the release the Parquet metadata of dataset records, read from its first file.

dataset is a file or a directory searched recursively, as a local path or a URI read with storage_options. Raises FileNotFoundError when it holds no Parquet file and ValueError when that file records no release or an unreadable masking; the constructor then holds the dataset to the release this returns.

from_keywords classmethod

from_keywords(
    *,
    dataset: str | PathLike[str],
    genome_build: str | None = None,
    prioritization_threshold: float = DEFAULT_PRIORITIZATION_THRESHOLD,
    storage_options: Mapping[str, Any] | None = None,
    connection: Connection | None = None,
    **unknown: Any,
) -> Self

Build the source from run spec options, over the Parquet dataset altar-spliceai-build wrote.

dataset is the dataset's path or URI (from_dataset). It is read with connection's storage options for it, or with storage_options. With neither, the provider's ambient credentials apply. storage_options and connection are exclusive: a connection supplies the storage options. The connection never enters the source's identity.

genome_build, when given, must name the dataset's build, as hg38 or GRCh38. prioritization_threshold prioritizes a variant whose greatest delta score is at least this value.

An option not named above raises ValueError listing the valid options.

annotation_contract classmethod

annotation_contract() -> AnnotationContract

Return SPLICEAI_ANNOTATIONS, which every SpliceAI source implements, so tooling can list it unbuilt.

vcf_info_fields classmethod

vcf_info_fields() -> tuple[AnnotationInfoField, ...]

Return altar_spliceai.vcf.VCF_INFO_FIELDS, the augmented-VCF preset of the SpliceAI columns.

Provisional: altar.variants.augment_run_export reads it, and the hook is expected to change.

annotation_columns

annotation_columns() -> list[AnnotationColumn]

Declare a coherent top record, lossless gene-level detail, and release provenance.

identity

Declare SPLICEAI_ANNOTATIONS for the release, its masking, and its genome build.

Masked and raw scores are different quantities, so the release label carries the masking: "1.3-masked" or "1.3-raw".

annotate async

annotate(
    variant_ids: Sequence[str],
) -> dict[str, dict[str, object]]

Fetch and aggregate every SpliceAI gene record for variant_ids.

prioritize_predicate

prioritize_predicate() -> Predicate

Prioritize variants meeting the configured maximum delta-score cutoff.

release_fields

release_fields(release: SpliceAIRelease) -> dict[str, str]

Return the fields that identify release in Parquet metadata: release, masked, and genome_build.

masked is written as "true" or "false": raw and masked scores are different quantities, so a dataset built from the other score set is rejected like one from another release.


altar_gpnstar

altar-gpnstar — multi-species genomic language model constraint lookup. Full scientific details, outputs, and CLI examples are on the GPN-Star (altar_gpnstar) integration page.

Symbol Description
ASSET_MANIFEST_NAME Public export.
DEFAULT_HF_DATASET_URI Public export.
DEFAULT_SCORE_SET Public export.
GPNSTAR_ANNOTATIONS The precomputed GPN-Star annotation contract: calibrated allele scores and their provenance.
GPNSTAR_KEY_COLUMNS Public export.
SCORE_SETS Public export.
AssetShard One chromosome shard in a normalized local or remote GPN-Star asset.
ChecksumPolicy Public export.
GPNStarAsset Scientific and byte-level identity of a normalized score asset.
GPNStarAssetVerifier Verify GPN-Star asset metadata and optional shard checksums independently of the record backend.
GPNStarLocus One normalized biallelic SNV requested from a GPN-Star source.
GPNStarRow One decoded allele-specific score record.
GPNStarScoreSet Scientific identity of one published GPN-Star score set.
GPNStarSource Genome-wide variant effect scores for each SNV, from a GPN-Star score set.
hf_dataset_uri Return the pinned Hugging Face dataset root URI for score_set after validating the score set name.

Public API for the precomputed GPN-Star annotation-source binding.

ASSET_MANIFEST_NAME module-attribute

ASSET_MANIFEST_NAME = 'gpnstar-asset.json'

DEFAULT_HF_DATASET_URI module-attribute

DEFAULT_HF_DATASET_URI = f"hf://datasets/{SOURCE_REPOSITORY}@{CANONICAL_PARQUET_REVISION}"

DEFAULT_SCORE_SET module-attribute

DEFAULT_SCORE_SET = 'gpn-star-hg38-m447-200m'

GPNSTAR_ANNOTATIONS module-attribute

GPNSTAR_ANNOTATIONS = AnnotationContract(
    source_id="org.kundajelab.altar.annotation.gpnstar",
    schema_version="1.0.0",
    columns=(
        AnnotationColumn(
            name="gpnstar_llr_calibrated",
            dtype="float",
            label="GPN-Star Calibrated LLR",
        ),
        AnnotationColumn(
            name="gpnstar_abs_llr_calibrated",
            dtype="float",
            label="GPN-Star Calibrated Absolute LLR",
        ),
        AnnotationColumn(
            name="gpnstar_score_set",
            dtype="str",
            label="GPN-Star Score Set",
        ),
        AnnotationColumn(
            name="gpnstar_genome_build",
            dtype="str",
            label="GPN-Star Genome Build",
        ),
        AnnotationColumn(
            name="gpnstar_model_id",
            dtype="str",
            label="GPN-Star Model",
        ),
        AnnotationColumn(
            name="gpnstar_model_revision",
            dtype="str",
            label="GPN-Star Model Revision",
        ),
        AnnotationColumn(
            name="gpnstar_alignment_id",
            dtype="str",
            label="GPN-Star Alignment",
        ),
        AnnotationColumn(
            name="gpnstar_alignment_revision",
            dtype="str",
            label="GPN-Star Alignment Revision",
        ),
        AnnotationColumn(
            name="gpnstar_species_set",
            dtype="str",
            label="GPN-Star Species Set",
        ),
        AnnotationColumn(
            name="gpnstar_source_release",
            dtype="str",
            label="GPN-Star Source Release",
        ),
        AnnotationColumn(
            name="gpnstar_source_asset_sha256",
            dtype="str",
            label="GPN-Star Source Asset SHA-256",
        ),
    ),
)

The precomputed GPN-Star annotation contract: calibrated allele scores and their provenance.

GPNSTAR_KEY_COLUMNS module-attribute

GPNSTAR_KEY_COLUMNS = AllelicKeyColumns(
    chromosome="chrom",
    position="pos",
    reference_allele="ref",
    alternate_allele="alt",
)

SCORE_SETS module-attribute

SCORE_SETS: dict[str, GPNStarScoreSet] = {
    "gpn-star-hg38-v100-200m": GPNStarScoreSet(
        name="gpn-star-hg38-v100-200m",
        genome_build="hg38",
        model_id="songlab/gpn-star-hg38-v100-200m",
        model_revision="0c949f132d35619a3eb188b402848c998a3313ae",
        alignment_id="songlab/multiz100way-pigz",
        alignment_revision="6a9d42a35e7debbba845979dea6064f14d5cb3f9",
        alignment_name="multiz100way",
        species_set="100 vertebrates",
    ),
    "gpn-star-hg38-m447-200m": GPNStarScoreSet(
        name="gpn-star-hg38-m447-200m",
        genome_build="hg38",
        model_id="songlab/gpn-star-hg38-m447-200m",
        model_revision="0d8f5164fba8e8108200c160370b86652bfb6244",
        alignment_id="songlab/hg38_cactus447way",
        alignment_revision="f523f0467bc143b62fb5b3b9a91c510e8dc2a7f6",
        alignment_name="cactus447way",
        species_set="447 mammals",
    ),
    "gpn-star-hg38-p243-200m": GPNStarScoreSet(
        name="gpn-star-hg38-p243-200m",
        genome_build="hg38",
        model_id="songlab/gpn-star-hg38-p243-200m",
        model_revision="16773016130e826cd3d72e91ed312a3cb27ba2b5",
        alignment_id="songlab/hg38_cactus447way",
        alignment_revision="f523f0467bc143b62fb5b3b9a91c510e8dc2a7f6",
        alignment_name="cactus447way primate subset",
        species_set="243 primates",
    ),
    "mm39": GPNStarScoreSet(
        name="mm39",
        genome_build="mm39",
        model_id="songlab/gpn-star-mm39-v35-85m",
        model_revision="dac8b6b1debe89e20dd96c94c25fb6273fb6fa38",
        alignment_id="songlab/mm39_multiz35way",
        alignment_revision="0e4f0417b4983df5f03ff1f27d8f7ab682a91c5c",
        alignment_name="multiz35way",
        species_set="35 vertebrates",
    ),
    "gg6": GPNStarScoreSet(
        name="gg6",
        genome_build="gg6",
        model_id="songlab/gpn-star-galGal6-v77-85m",
        model_revision="48a680f32150def601be17c120690df1294c0a90",
        alignment_id="songlab/galGal6_multiz77way",
        alignment_revision="684864853062dcd578efba218114b9c64d873882",
        alignment_name="multiz77way",
        species_set="77 vertebrates",
    ),
    "dm6": GPNStarScoreSet(
        name="dm6",
        genome_build="dm6",
        model_id="songlab/gpn-star-dm6-i124-85m",
        model_revision="82e9751a31ae479f0a3b59f9309496c376e4a60a",
        alignment_id="songlab/dm6_multiz124way",
        alignment_revision="e192eeeb41b00a8841c730c234020bc427d0872a",
        alignment_name="multiz124way",
        species_set="124 insects",
    ),
    "ce11": GPNStarScoreSet(
        name="ce11",
        genome_build="ce11",
        model_id="songlab/gpn-star-ce11-n135-25m",
        model_revision="078ad60c23bbaf40fbeae89fb509a21320a71bbb",
        alignment_id="songlab/ce11_multiz135way",
        alignment_revision="1e4b77d776882977bc72986bdf4c5194a21c2d17",
        alignment_name="multiz135way",
        species_set="135 nematodes",
    ),
    "tair10": GPNStarScoreSet(
        name="tair10",
        genome_build="tair10",
        model_id="songlab/gpn-star-tair10-b18-25m",
        model_revision="317841ed55164ff4cd3d14e636bcc2d5de23cf49",
        alignment_id="songlab/tair10_multiz18way",
        alignment_revision="34b56f69320c4d81ecbea53a7709f4e06cc5ef6f",
        alignment_name="multiz18way",
        species_set="18 Brassicaceae",
    ),
}

ChecksumPolicy module-attribute

ChecksumPolicy = Literal[
    "none",
    "lazy",
    "on_first_use",
    "eager",
    "trust_manifest",
]

AssetShard dataclass

AssetShard(
    chromosome: str,
    path: str,
    sha256: str,
    size: int,
    rows: int,
    min_position: int,
    max_position: int,
    source_path: str,
    source_sha256: str,
)

One chromosome shard in a normalized local or remote GPN-Star asset.

GPNStarAsset dataclass

GPNStarAsset(
    contract_version: int,
    score_set: str,
    genome_build: str,
    model_id: str,
    model_revision: str,
    alignment_id: str,
    alignment_revision: str,
    alignment_name: str,
    species_set: str,
    source_repository: str,
    source_release_revision: str,
    canonical_parquet_revision: str,
    source_release_manifest_sha256: str,
    source_license: str,
    synthetic_fixture: bool,
    shards: tuple[AssetShard, ...],
)

Scientific and byte-level identity of a normalized score asset.

published_metadata property

published_metadata: GPNStarScoreSet

Return the binding's pinned metadata for this score set.

to_json

to_json() -> str

Serialize deterministically for reproducible dataset builds.

GPNStarAssetVerifier

GPNStarAssetVerifier(
    asset: str | PathLike[str],
    *,
    score_set: str = DEFAULT_SCORE_SET,
    checksum_policy: ChecksumPolicy = "none",
    storage_options: Mapping[str, Any] | None = None,
)

Verify GPN-Star asset metadata and optional shard checksums independently of the record backend.

Default checksum_policy="none" checks shard existence without downloading or hashing multi-GB Parquet shards, so remote Hugging Face or object-storage point lookups fetch only Parquet footers and matched row groups. Pass checksum_policy="on_first_use" or "eager" to verify full-file SHA-256 digests.

verify_chromosomes async

verify_chromosomes(chromosomes: Sequence[str]) -> None

Verify each requested chromosome at most once without blocking the event loop.

GPNStarLocus dataclass

GPNStarLocus(
    variant_id: str,
    chromosome: str,
    position: int,
    reference_allele: str,
    alternate_allele: str,
)

One normalized biallelic SNV requested from a GPN-Star source.

from_variant_id classmethod

from_variant_id(variant_id: str) -> GPNStarLocus

Parse chromosome:position:reference:alternate into a native key.

to_key

to_key() -> AllelicKey

Return the generic backend key while preserving the caller's variant identity.

GPNStarRow dataclass

GPNStarRow(
    variant_id: str,
    llr_calibrated: float,
    abs_llr_calibrated: float,
)

One decoded allele-specific score record.

GPNStarScoreSet dataclass

GPNStarScoreSet(
    name: str,
    genome_build: str,
    model_id: str,
    model_revision: str,
    alignment_id: str,
    alignment_revision: str,
    alignment_name: str,
    species_set: str,
)

Scientific identity of one published GPN-Star score set.

GPNStarSource

GPNStarSource(
    backend: AllelicRecordBackend,
    *,
    asset: GPNStarAsset,
    genome_build: str,
    verifier: GPNStarAssetVerifier | None = None,
    prioritization_threshold: float | None = None,
    allow_synthetic_fixture: bool = False,
)

Bases: AllelicRecordAnnotationSource[GPNStarAsset]

Genome-wide variant effect scores for each SNV, from a GPN-Star score set.

Reads either the pinned Hugging Face songlab/gpn-star-scores Parquet shards in place (requiring altar[hf] when dataset is omitted) or an owned copy built with altar-gpnstar-build. By default (checksum_policy="none"), point lookups fetch only Parquet footers and matched row groups rather than downloading entire chromosome shards.

asset property

asset: GPNStarAsset

Return the asset the source serves, its release.

from_dataset classmethod

from_dataset(
    dataset: str | PathLike[str] | None = None,
    *,
    score_set: str | None = None,
    genome_build: str | None = None,
    checksum_policy: ChecksumPolicy = "none",
    prioritization_threshold: float | None = None,
    allow_synthetic_fixture: bool = False,
    storage_options: Mapping[str, Any] | None = None,
) -> Self

Build the source over dataset, or the pinned Hugging Face dataset when dataset is None.

from_keywords classmethod

from_keywords(
    *,
    dataset: str | PathLike[str] | None = None,
    score_set: str = DEFAULT_SCORE_SET,
    genome_build: str | None = None,
    checksum_policy: Literal[
        "none",
        "lazy",
        "on_first_use",
        "eager",
        "trust_manifest",
    ] = "none",
    prioritization_threshold: float | None = None,
    allow_synthetic_fixture: bool = False,
    storage_options: Mapping[str, Any] | None = None,
    connection: Connection | None = None,
    **unknown: Any,
) -> Self

Build the source from run spec options, defaulting to Hugging Face songlab/gpn-star-scores.

annotation_contract classmethod

annotation_contract() -> AnnotationContract

Return GPNSTAR_ANNOTATIONS, which every GPN-Star source implements, so tooling can list it unbuilt.

annotation_columns

annotation_columns() -> list[AnnotationColumn]

Declare allele scores together with their complete provenance.

identity

Declare GPNSTAR_ANNOTATIONS for the asset's score set, upstream release, and genome build.

prioritize_predicate

prioritize_predicate() -> Predicate | None

Return Ge(Col('gpnstar_abs_llr_calibrated'), Lit(threshold)) when configured, else None.

annotate async

annotate(
    variant_ids: Sequence[str],
) -> dict[str, dict[str, object]]

Look up scores, omitting missing or unscorable variants rather than zero-filling.

hf_dataset_uri

hf_dataset_uri(
    score_set: str = DEFAULT_SCORE_SET,
    *,
    revision: str = CANONICAL_PARQUET_REVISION,
) -> str

Return the pinned Hugging Face dataset root URI for score_set after validating the score set name.


altar_e2g_atlas

altar-e2g-atlas — importer and link source for ENCODE-rE2G and scE2G predictions. Full scientific details, outputs, and CLI examples are on the ENCODE E2G Atlases (altar_e2g_atlas) integration page.

Symbol Description
E2G_ATLAS_DATASET Public export.
ENCODE_RE2G_COLUMNS Public export.
SCE2G_V1_3_COLUMNS Public export.
AtlasImportLedger Durable raw-import progress independent of canonical evidence storage.
AtlasIngestor Normalize released atlas rows and stage them in a generic evidence store.
AtlasRecord Canonical loss-minimizing element-to-gene record.
AtlasSource Released atlas formats supported by this binding.
E2GAtlasAnnotationSource The genes each variant may regulate, from imported ENCODE-rE2G and scE2G atlases.
E2GAtlasOptions The options of a run spec's e2g_atlas source, as altar sources e2g_atlas lists them.
E2GAtlasSource Query released ENCODE-rE2G and scE2G evidence from any compliant store.
EncodeRE2GFeatures Typed fields in the released ENCODE DCC rE2G BED3+ schema.
ImportConfig Validated release manifest supplied alongside a source TSV.
ImportReport Durable counts and checksum for one import attempt.
InMemoryAtlasImportLedger Small checkpoint ledger for tests and ephemeral imports.
RejectedRow One source row rejected without storing an unvalidated payload.
SQLiteAtlasImportLedger SQLite checkpoint ledger containing no scientific evidence rows.
ScE2GFeatures Typed fields in the scE2G v1.3 multiome prediction schema.

Versioned ENCODE-rE2G and scE2G atlas lookup for Altar.

E2G_ATLAS_DATASET module-attribute

E2G_ATLAS_DATASET = VariantGeneLinkDatasetRef(
    namespace="org.kundajelab",
    name="e2g-atlas",
    version="1",
)

ENCODE_RE2G_COLUMNS module-attribute

ENCODE_RE2G_COLUMNS = (
    "#chr",
    "start",
    "end",
    "name",
    "class",
    "TargetGene",
    "TargetGeneEnsemblID",
    "TargetGeneTSS",
    "isSelfPromoter",
    "CellType",
    "distanceToTSS.Feature",
    "normalizedDNase_prom.Feature",
    "3DContact.Feature",
    "ABC.Score.Feature",
    "numCandidateEnhGene.Feature",
    "numTSSEnhGene.Feature",
    "sumNearbyEnhancers.Feature",
    "ubiquitousExpressedGene.Feature",
    "Score",
)

SCE2G_V1_3_COLUMNS module-attribute

SCE2G_V1_3_COLUMNS = (
    "chr",
    "start",
    "end",
    "name",
    "class",
    "TargetGene",
    "TargetGeneTSS",
    "TargetGeneIsExpressed",
    "TargetGeneEnsembl_ID",
    "isSelfPromoter",
    "CellType",
    "distance",
    "normalizedATAC_prom",
    "ABC.Score",
    "normalizedATAC_enh",
    "numCandidateEnhGene",
    "numTSSEnhGene",
    "numNearbyEnhancers",
    "ubiqExpressed",
    "RNA_meanLogNorm",
    "RNA_pseudobulkTPM",
    "RNA_percentCellsDetected",
    "Kendall",
    "ARC.E2G.Score",
    "E2G.Score",
    "E2G.Score.qnorm",
    "E2G.Score.qnorm.ignoreTPM",
)

AtlasImportLedger

Bases: Protocol

Durable raw-import progress independent of canonical evidence storage.

begin_import

begin_import(
    *,
    import_id: str,
    config_fingerprint: str,
    source_checksum: str,
    config: ImportConfig,
) -> ImportReport

Create or resume one checksum-addressed import.

checkpoint

checkpoint(
    *,
    import_id: str,
    processed_rows: int,
    accepted_rows: int,
    rejections: Sequence[RejectedRow],
) -> ImportReport

Persist progress after the corresponding generic-store batch succeeds.

complete_import

complete_import(import_id: str) -> ImportReport

Mark parsing complete after the store generation is published.

import_report

import_report(import_id: str) -> ImportReport

Return durable progress and counts.

rejected_rows

rejected_rows(import_id: str) -> Sequence[RejectedRow]

Return deterministic rejected-row diagnostics.

AtlasIngestor

AtlasIngestor(
    store: VariantGeneLinkStoreWriter,
    ledger: AtlasImportLedger,
    *,
    dataset: VariantGeneLinkDatasetRef = E2G_ATLAS_DATASET,
    batch_size: int = 10000,
)

Normalize released atlas rows and stage them in a generic evidence store.

ingest async

ingest(
    path: str | Path,
    config: ImportConfig,
    *,
    expected_sha256: str | None = None,
    stop_after_rows: int | None = None,
) -> ImportReport

Ingest or resume path without exposing a partial generation.

AtlasRecord dataclass

AtlasRecord(
    record_id: str,
    source_record_id: str,
    source: AtlasSource,
    source_release: str,
    genome_build: GenomeBuild,
    coordinate_convention: CoordinateConvention,
    chromosome: str,
    start: int,
    end: int,
    source_element_id: str,
    gene_id: str,
    gene_identifier_version: int | None,
    gene_namespace: str,
    gene_namespace_version: str | None,
    gene_symbol: str,
    context_id: str | None,
    context_name: str,
    context_namespace: str | None,
    method: str,
    model: str,
    score_name: str,
    score: float,
    score_threshold: float | None,
    threshold_rule: ThresholdRule | None,
    threshold_applied: bool | None,
    threshold_interpretation: str | None,
    source_uri: str | None,
    source_checksum: str,
    source_row_number: int,
    features: SourceFeatures,
)

Canonical loss-minimizing element-to-gene record.

to_evidence_record

to_evidence_record() -> VariantGeneEvidenceRecord

Normalize this source row into Altar's storage-neutral evidence record.

AtlasSource

Bases: StrEnum

Released atlas formats supported by this binding.

E2GAtlasAnnotationSource

Bases: VariantGeneLinkAnnotationSource

The genes each variant may regulate, from imported ENCODE-rE2G and scE2G atlases.

Reads either a SQLite link store populated by altar-e2g-atlas-ingest (sqlite_path + release, targeting E2G_ATLAS_DATASET) or a Parquet link dataset (dataset), projecting overlapping links into VARIANT_GENE_LINK_ANNOTATION_CONTRACT.

annotation_contract classmethod

annotation_contract() -> AnnotationContract

Return VARIANT_GENE_LINK_ANNOTATION_CONTRACT for altar sources e2g_atlas.

from_keywords classmethod

from_keywords(
    *,
    sqlite_path: str | PathLike[str] | None = None,
    dataset: str | PathLike[str] | None = None,
    release: str | None = None,
    genome_build: str = "hg38",
    filters: Mapping[str, Any]
    | VariantGeneLinkFilters
    | None = None,
    column_prefix: str | None = None,
    name: str | None = None,
    prioritize_predicate: Predicate | None = None,
    storage_options: Mapping[str, Any] | None = None,
    connection: Connection | None = None,
    **unknown: object,
) -> Self

Build E2GAtlasAnnotationSource from run spec options over sqlite_path or a Parquet dataset.

E2GAtlasOptions

Bases: BaseModel

The options of a run spec's e2g_atlas source, as altar sources e2g_atlas lists them.

E2GAtlasSource

Bases: StoredVariantGeneLinkSource

Query released ENCODE-rE2G and scE2G evidence from any compliant store.

decode_record

decode_record(
    record: VariantGeneEvidenceRecord, locus: VariantLocus
) -> VariantGeneLink

Restore the binding's typed source features after generic JSON-safe persistence.

EncodeRE2GFeatures dataclass

EncodeRE2GFeatures(
    element_class: str,
    target_gene_tss: int,
    is_self_promoter: bool,
    distance_to_tss: float,
    normalized_dnase_promoter: float,
    contact_3d: float,
    abc_score: float,
    candidate_enhancer_gene_count: int,
    tss_enhancer_gene_count: int,
    nearby_enhancer_sum: float,
    ubiquitous_expressed_gene: bool,
)

Typed fields in the released ENCODE DCC rE2G BED3+ schema.

ImportConfig dataclass

ImportConfig(
    source: AtlasSource,
    source_release: str,
    genome_build: GenomeBuild,
    method: str,
    model: str,
    source_uri: str | None = None,
    gene_namespace_version: str | None = None,
    context_id: str | None = None,
    context_name: str | None = None,
    context_namespace: str | None = None,
    score_threshold: float | None = None,
    threshold_applied: bool | None = None,
    threshold_rule: ThresholdRule | None = None,
    threshold_interpretation: str | None = None,
    coordinate_convention: CoordinateConvention = "0-based-half-open",
)

Validated release manifest supplied alongside a source TSV.

ImportReport dataclass

ImportReport(
    import_id: str,
    source: AtlasSource,
    source_release: str,
    source_checksum: str,
    total_rows: int | None,
    processed_rows: int,
    accepted_rows: int,
    rejected_rows: int,
    status: Literal["in_progress", "complete"],
    idempotent: bool,
)

Durable counts and checksum for one import attempt.

InMemoryAtlasImportLedger

InMemoryAtlasImportLedger()

Small checkpoint ledger for tests and ephemeral imports.

RejectedRow dataclass

RejectedRow(source_row_number: int, reason: str)

One source row rejected without storing an unvalidated payload.

SQLiteAtlasImportLedger

SQLiteAtlasImportLedger(path: str | Path)

SQLite checkpoint ledger containing no scientific evidence rows.

ScE2GFeatures dataclass

ScE2GFeatures(
    element_class: str,
    target_gene_tss: int,
    target_gene_is_expressed: bool,
    is_self_promoter: bool,
    distance_to_tss: float,
    normalized_atac_promoter: float,
    abc_score: float,
    normalized_atac_enhancer: float,
    candidate_enhancer_gene_count: int,
    tss_enhancer_gene_count: int,
    nearby_enhancer_count: int,
    ubiquitous_expressed_gene: bool,
    rna_mean_log_normalized: float,
    rna_pseudobulk_tpm: float,
    rna_percent_cells_detected: float,
    kendall: float,
    arc_e2g_score: float,
    raw_e2g_score: float,
    qnorm_e2g_score: float,
    qnorm_e2g_score_ignore_tpm: float,
)

Typed fields in the scE2G v1.3 multiome prediction schema.