Skip to content

Model bindings API

Public Python classes, configuration models, run-input schemas, and resource helpers exported by Altar's seven model binding distributions. Install only the bindings your environment uses; see Install Altar.

Packages

Module Integration Public exports
altar_alphagenome AlphaGenome ALPHAGENOME_SDK_VERSION, DEFAULT_SEQUENCE_LENGTH, AlphaGenomeConfiguration, AlphaGenomePlugin, AlphaGenomeRunInputs …
altar_borzoi Borzoi DEFAULT_IMAGE, GTEX_TARGET_COUNT, GTEX_TARGET_MAX, GTEX_TARGET_MIN, KIND_SCORING …
altar_cherimoya Cherimoya CATV1_FOLD_COUNT, CATV1_REPOSITORY, CATV1_REVISION, COUNTS_TARGET, DEFAULT_IMAGE …
altar_chrombpnet ChromBPNet CHROMBPNET_DEFAULT_IMAGE, CONTRIBUTION_SCORES, COUNTS_TARGET, DEEPSHAP_COUNTS, FINEMO_HITS …
altar_enformer Enformer DEFAULT_IMAGE, HUMAN_TRACK_COUNT, KIND_SCORING, OUTPUT_BINS, OUTPUT_BIN_SIZE …
altar_legnet LegNet CONTEXT_LENGTH, DEFAULT_IMAGE, KIND_SCORING, MODEL_INPUT_LENGTH, LegNetConfiguration …
altar_sei Sei CHROMATIN_PROFILE_COUNT, DEFAULT_IMAGE, KIND_SCORING, MANIFEST_FILENAME, PROFILE_EFFECTS …

altar_alphagenome

altar-alphagenome — hosted multi-modal API model binding and per-track detail reducer. Full scientific details, outputs, and CLI examples are on the AlphaGenome integration page.

Symbol Description
ALPHAGENOME_SDK_VERSION Public export.
DEFAULT_SEQUENCE_LENGTH Public export.
AlphaGenomeConfiguration Durable hosted-model selection and credential reference for AlphaGenome.
AlphaGenomePlugin Predicts how a variant changes the tracks you select, such as ATAC, DNase or RNA-seq, through a hosted API.
AlphaGenomeRunInputs Per-run variants and genome build for AlphaGenome scoring.
AlphaGenomeRuntime Non-durable injected scorer or secret resolver used by inline execution.
AlphaGenomeVariant One fully specified variant sent to the hosted AlphaGenome API.
ScoreVariantFn Public export.
detail_track_score Normalize one SDK tidy-score row into AlphaGenome's versioned detail schema.
reduce_variant_scores Reduce AlphaGenome's tidy per-track records for one variant into this plugin's fixed score row.

AlphaGenome hosted-model binding for Altar.

ALPHAGENOME_SDK_VERSION module-attribute

ALPHAGENOME_SDK_VERSION = '0.9.0'

DEFAULT_SEQUENCE_LENGTH module-attribute

DEFAULT_SEQUENCE_LENGTH = 2 ** 20

ScoreVariantFn module-attribute

ScoreVariantFn = Callable[
    [Mapping[str, Any]], list[dict[str, Any]]
]

AlphaGenomeConfiguration

Bases: ModelConfiguration

Durable hosted-model selection and credential reference for AlphaGenome.

ontology_terms and scorers are stored sorted and without repeats, so their order never changes the model instance. scorers must name keys of the SDK's RECOMMENDED_VARIANT_SCORERS, and sequence_length must be one of the SDK's supported lengths.

AlphaGenomePlugin

Bases: ModelPlugin

Predicts how a variant changes the tracks you select, such as ATAC, DNase or RNA-seq, through a hosted API.

build_scoring_plan returns an InlineScoringPlan rather than a container spec, so there are no shards to run. The manifest declares the reduced headline schema, from which the inherited score_columns builds the columns, and the store builds the model_scores entry from the same schema; prioritize_predicate is the prioritize rule over it.

supports_genome_build

supports_genome_build(
    genome_build: str,
    configuration: ConfigurationModel | None = None,
) -> bool

Return whether AlphaGenome supports genome_build (and matches configuration.organism when given).

with_run_variants

with_run_variants(
    request: ScoringRequest, variants: Sequence[VariantKey]
) -> ScoringRequest

Carry exactly variants in the request's run inputs; the genome build and subject are kept.

run_variant_ids

run_variant_ids(
    run_inputs: ModelRunInputs,
) -> Sequence[str]

Return the variant_id of each variant the run inputs carry, in order.

scoring_runtime_identities

scoring_runtime_identities(
    runtimes: Mapping[str, str],
) -> dict[str, str]

Record the hosted model and client SDK, which a run cannot select; any override is refused.

build_scoring_plan

build_scoring_plan(
    request: ScoringRequest,
) -> InlineScoringPlan

Build a JSON-durable descriptor; runtime injection happens only in execute_inline.

execute_inline async

execute_inline(
    plan: InlineScoringPlan,
    runtime: RuntimeContext | None = None,
) -> InlineScoringResult

Run a durable AlphaGenome plan with a separately supplied non-durable runtime context.

AlphaGenomeRunInputs

Bases: ModelRunInputs

Per-run variants and genome build for AlphaGenome scoring.

variants defaults to empty, so a run spec can name only the genome build. prepare_scoring_batches binds each batch's variants through AlphaGenomePlugin.with_run_variants.

The hosted model accepts the reference assembly of either supported organism; which one a run needs depends on the configuration's organism, so the plan builder checks that pairing.

AlphaGenomeRuntime

AlphaGenomeRuntime(
    *,
    score_variant_fn: ScoreVariantFn | None = None,
    secret_resolver: SecretResolver | None = None,
    max_concurrency: int = 4,
)

Bases: RuntimeContext

Non-durable injected scorer or secret resolver used by inline execution.

max_concurrency bounds how many variants are in flight against the API at once. Each call blocks a thread, so this is also the number of worker threads a plan occupies. It is an operational setting, not a scientific one: it never changes a result or the run identity.

AlphaGenomeVariant

Bases: ModelConfiguration

One fully specified variant sent to the hosted AlphaGenome API.

detail_track_score

detail_track_score(
    variant_id: str, record: Mapping[str, Any]
) -> dict[str, object]

Normalize one SDK tidy-score row into AlphaGenome's versioned detail schema.

reduce_variant_scores

reduce_variant_scores(
    variant_id: str, records: Sequence[Mapping[str, Any]]
) -> dict[str, Any]

Reduce AlphaGenome's tidy per-track records for one variant into this plugin's fixed score row.

The API returns one row per output modality and track; the results schema needs a small finite set of scalars. The headline track is the one with the largest absolute raw score, and is present whenever any track scored. top_track_abs_quantile_score comes from that same headline track, while max_abs_quantile_score remains the largest calibrated magnitude across all tracks for descriptive use. A variant with no scorable track (every raw_score missing) yields an all-None row with n_tracks_scored=0.

This function does no I/O, so the real and injected scorers share it and it can be tested against synthetic records. Its output keys are exactly the score_columns() names plus variant_id.


altar_borzoi

altar-borzoi — RNA-seq and regulatory track sequence model binding and resource helpers. Full scientific details, outputs, and CLI examples are on the Borzoi integration page.

Symbol Description
DEFAULT_IMAGE Public export.
GTEX_TARGET_COUNT Public export.
GTEX_TARGET_MAX Public export.
GTEX_TARGET_MIN Public export.
KIND_SCORING Public export.
OUTPUT_BINS Public export.
OUTPUT_BIN_SIZE Public export.
SEQUENCE_LENGTH Public export.
BorzoiConfiguration Immutable official Borzoi ensemble and gene-expression scoring settings.
BorzoiPlugin Predicts how a variant changes the RNA-seq coverage of nearby genes in the tracks you select (logSED).
BorzoiRunInputs Per-run Borzoi inputs, restricted to the published human assembly.
BorzoiShardKind Stable execution kind emitted by BorzoiPlugin.

Public Borzoi binding exports.

DEFAULT_IMAGE module-attribute

DEFAULT_IMAGE = "riyavsinha/altar-borzoi@sha256:8f0b002dc5a93663b28a031e8c8f5c0dc73d661daa73e21f257304f13417fb54"

GTEX_TARGET_COUNT module-attribute

GTEX_TARGET_COUNT = GTEX_TARGET_MAX - GTEX_TARGET_MIN + 1

GTEX_TARGET_MAX module-attribute

GTEX_TARGET_MAX = 7610

GTEX_TARGET_MIN module-attribute

GTEX_TARGET_MIN = 7522

KIND_SCORING module-attribute

KIND_SCORING = BorzoiShardKind.SCORING

OUTPUT_BINS module-attribute

OUTPUT_BINS = 16352

OUTPUT_BIN_SIZE module-attribute

OUTPUT_BIN_SIZE = 32

SEQUENCE_LENGTH module-attribute

SEQUENCE_LENGTH = 524288

BorzoiConfiguration

Bases: ModelConfiguration

Immutable official Borzoi ensemble and gene-expression scoring settings.

from_resource_manifest classmethod

from_resource_manifest(
    path: str | PathLike[str],
    *,
    base_uri: str | None = None,
    **settings: Any,
) -> BorzoiConfiguration

Build a configuration from the borzoi.resources.json that altar-borzoi-resources wrote.

settings are the remaining configuration fields: target_indices, and the optional reverse_complement and shifts. See :func:altar_borzoi.resources.manifest_resources for how base_uri locates the files.

BorzoiPlugin

Bases: ModelPlugin

Predicts how a variant changes the RNA-seq coverage of nearby genes in the tracks you select (logSED).

BorzoiRunInputs

Bases: ReferenceGenomeRunInputs

Per-run Borzoi inputs, restricted to the published human assembly.

BorzoiShardKind

Bases: StrEnum

Stable execution kind emitted by :class:BorzoiPlugin.


altar_cherimoya

altar-cherimoya — multi-fold BPNet-style accessibility model binding and interpretation support. Full scientific details, outputs, and CLI examples are on the Cherimoya integration page.

Symbol Description
CATV1_FOLD_COUNT The number of folds of one CATv1 experiment, 0 to CATV1_FOLD_COUNT - 1.
CATV1_REPOSITORY The Hugging Face model repository of the CATv1 atlas.
CATV1_REVISION The atlas revision the binding pins: every CATv1 path and URL here is at this commit.
COUNTS_TARGET Public export.
DEFAULT_IMAGE Public export.
DEFAULT_IN_WINDOW Public export.
INTERPRETATION_IMAGE The runtime image that runs ism_counts.
INTERPRETATION_METHODS The methods Cherimoya declares.
ISM_COUNTS Public export.
ISM_SCORES Public export.
ISM_SEQUENCES Public export.
KIND_INTERPRETATION_AVERAGE Public export.
KIND_INTERPRETATION_FOLDS Public export.
KIND_SCORING_FOLDS Public export.
KIND_SCORING_SUMMARIZE Public export.
CherimoyaConfiguration Durable model resources and scientific settings for Cherimoya.
CherimoyaInterpretationLayout Paths for one Cherimoya interpretation run, all under interpretations/{run_id}/{model_id}/.
CherimoyaPlugin Predicts how a variant changes one CATv1 experiment's signal: its counts and its base-resolution profile.
CherimoyaRunInputs Typed biological inputs restricted to CATv1's training assembly.
CherimoyaShardKind Stable task kinds emitted by CherimoyaPlugin.
catv1_checkpoint_path Return one fold's checkpoint path in the CATv1 repository, models/{accession}/cherimoya.fold_{fold}.torch.
catv1_checkpoint_url Return the Hugging Face download URL of one fold's checkpoint at the pinned revision, CATV1_REVISION.
is_catv1_accession Return whether value is a CATv1 experiment accession: ENCSR and six uppercase letters or digits.

Cherimoya model binding for Altar.

CATV1_FOLD_COUNT module-attribute

CATV1_FOLD_COUNT = FOLD_COUNT

The number of folds of one CATv1 experiment, 0 to CATV1_FOLD_COUNT - 1.

CATV1_REPOSITORY module-attribute

CATV1_REPOSITORY = 'programmable-genomics/CATv1'

The Hugging Face model repository of the CATv1 atlas.

CATV1_REVISION module-attribute

CATV1_REVISION = '64a1d0c3e027d8b745e9772c0c770a91b06d3a5f'

The atlas revision the binding pins: every CATv1 path and URL here is at this commit.

COUNTS_TARGET module-attribute

COUNTS_TARGET = 'counts'

DEFAULT_IMAGE module-attribute

DEFAULT_IMAGE = "riyavsinha/altar-cherimoya@sha256:85c754f59ab66150006460ed1bf437f7d209bc955f1be45146091387b31446c9"

DEFAULT_IN_WINDOW module-attribute

DEFAULT_IN_WINDOW = 2114

INTERPRETATION_IMAGE module-attribute

INTERPRETATION_IMAGE = "riyavsinha/altar-cherimoya@sha256:85c754f59ab66150006460ed1bf437f7d209bc955f1be45146091387b31446c9"

The runtime image that runs ism_counts.

It is the 9f51da3 image: main-74be08c's runtime plus the interpret and average-interpretations commands, built from the same lock. It is the default of the interpretation_runtime role, and the same image is the scoring default of the model_runtime role; a run selects each role's image separately.

INTERPRETATION_METHODS module-attribute

INTERPRETATION_METHODS = (
    InterpretationMethod(
        name=ISM_COUNTS,
        version="1.0.0",
        description="In-silico saturation mutagenesis of the count head over the central 400 bases of each allele, averaged over the folds.",
        targets=(COUNTS_TARGET,),
        products=(ISM_SCORES, ISM_SEQUENCES),
    ),
)

The methods Cherimoya declares.

ISM_COUNTS module-attribute

ISM_COUNTS = 'ism_counts'

ISM_SCORES module-attribute

ISM_SCORES = ArtifactSchema(
    name="ism_scores",
    version="1.0.0",
    description="Hypothetical saturation mutagenesis scores of the count head, averaged over the folds: for each of the central 400 bases and each base A, C, G, T, the change in predicted log(count + 1) minus the mean change at that position. An N x 4 x 400 float32 array per allele, one row per variant.",
    media_type="application/x-npy",
)

ISM_SEQUENCES module-attribute

ISM_SEQUENCES = ArtifactSchema(
    name="ism_sequences",
    version="1.0.0",
    description="The one-hot sequence of each allele's 400 mutated bases, bases A, C, G, T: an N x 4 x 400 int8 array per allele, one row per variant.",
    media_type="application/x-npy",
)

KIND_INTERPRETATION_AVERAGE module-attribute

KIND_INTERPRETATION_AVERAGE = (
    CherimoyaShardKind.INTERPRETATION_AVERAGE
)

KIND_INTERPRETATION_FOLDS module-attribute

KIND_INTERPRETATION_FOLDS = (
    CherimoyaShardKind.INTERPRETATION_FOLDS
)

KIND_SCORING_FOLDS module-attribute

KIND_SCORING_FOLDS = CherimoyaShardKind.SCORING_FOLDS

KIND_SCORING_SUMMARIZE module-attribute

KIND_SCORING_SUMMARIZE = (
    CherimoyaShardKind.SCORING_SUMMARIZE
)

CherimoyaConfiguration

Bases: ModelConfiguration

Durable model resources and scientific settings for Cherimoya.

The configuration holds no runtime image: a run selects one per runtime role (ScoringRequest.runtimes), among the images the manifest declares compatible. weights contains one provider-neutral, content-addressed resource per fold; its length is the fold count. Storage adapters may retrieve those bytes from any location they support.

from_resource_manifest classmethod

from_resource_manifest(
    path: str | PathLike[str],
    *,
    base_uri: str | None = None,
    **settings: Any,
) -> CherimoyaConfiguration

Build a configuration from the cherimoya.resources.json that altar-cherimoya-resources wrote.

settings are the remaining configuration fields, such as in_window. See :func:altar_cherimoya.resources.manifest_resources for how base_uri locates the checkpoints.

CherimoyaInterpretationLayout dataclass

CherimoyaInterpretationLayout()

Bases: ModelArtifactLayout

Paths for one Cherimoya interpretation run, all under interpretations/{run_id}/{model_id}/.

Inherits the genome and model-file paths from ModelArtifactLayout. Each fold writes four files into its own directory, and the average step writes the four product files into the run directory.

fold_ism_file

fold_ism_file(
    run_id: str, model_id: str, fold: int, allele: str
) -> str

Return one fold's scores for allele, …/fold_0/ref_ism.npy.

fold_sequences_file

fold_sequences_file(
    run_id: str, model_id: str, fold: int, allele: str
) -> str

Return the sequences one fold mutated for allele, …/fold_0/ref_sequences.npy.

average_ism_file

average_ism_file(
    run_id: str, model_id: str, allele: str
) -> str

Return the ism_scores file of allele, …/average_ref_ism.npy.

ism_sequences_file

ism_sequences_file(
    run_id: str, model_id: str, allele: str
) -> str

Return the ism_sequences file of allele, …/ref_ism_sequences.npy.

CherimoyaPlugin

Bases: InterpretableModel

Predicts how a variant changes one CATv1 experiment's signal: its counts and its base-resolution profile.

scoring_runtime_identities

scoring_runtime_identities(
    runtimes: Mapping[str, str],
) -> dict[str, str]

Select the scoring image, model_runtime: an override in runtimes or the default.

build_scoring_plan

build_scoring_plan(
    request: ScoringRequest,
) -> ContainerScoringPlan

Build one score task per fold and a CPU task that averages their outputs.

interpretation_methods

interpretation_methods() -> tuple[
    InterpretationMethod, ...
]

Return ism_counts, saturation mutagenesis of the count head.

interpretation_scientific_dict

interpretation_scientific_dict(
    configuration: ModelConfiguration,
    *,
    method: str,
    target: str,
) -> dict[str, Any]

Return the fold weights, by digest in fold order, and the window and mutated width the commands pass.

Interpretation runs only with the CATv1 input window of 2,114 bases, and refuses any other in_window.

interpretation_runtime_identities

interpretation_runtime_identities(
    runtimes: Mapping[str, str], *, method: str
) -> dict[str, str]

Select the interpretation_runtime image, which runs ism_counts; the scoring image does not.

interpretation_rows

interpretation_rows(
    *,
    method: str,
    product: str,
    variants: Sequence[VariantKey],
) -> tuple[InterpretationRow, ...]

Return one row per variant covering its 400 mutated bases; see altar_cherimoya.interpretation.

interpretation_input_span

interpretation_input_span(
    *, method: str, variant: VariantKey
) -> tuple[int, int]

Return the reference span the runtime reads; preparation refuses one that runs off its contig.

build_interpretation_workflow

build_interpretation_workflow(
    request: InterpretationRequest,
    *,
    selection: InterpretationSelection,
    variants_digest: str,
) -> InterpretationWorkflow

Build one saturation mutagenesis task per fold and a CPU task that averages them.

Each fold task writes its scores and mutated sequences for both alleles. The average task checks that every fold mutated the same sequences and writes the four product files, which are the plan's outputs. Every task stages the variant file with variants_digest.

CherimoyaRunInputs

Bases: ReferenceGenomeRunInputs

Typed biological inputs restricted to CATv1's training assembly.

CherimoyaShardKind

Bases: StrEnum

Stable task kinds emitted by :class:CherimoyaPlugin.

catv1_checkpoint_path

catv1_checkpoint_path(
    experiment_accession: str, fold: int
) -> str

Return one fold's checkpoint path in the CATv1 repository, models/{accession}/cherimoya.fold_{fold}.torch.

Raises ValueError when experiment_accession is not a CATv1 accession or fold is not 0 to 4.

catv1_checkpoint_url

catv1_checkpoint_url(
    experiment_accession: str, fold: int
) -> str

Return the Hugging Face download URL of one fold's checkpoint at the pinned revision, CATV1_REVISION.

Raises ValueError as catv1_checkpoint_path does.

is_catv1_accession

is_catv1_accession(value: str) -> bool

Return whether value is a CATv1 experiment accession: ENCSR and six uppercase letters or digits.

The check is exact: it neither strips whitespace nor changes case.


altar_chrombpnet

altar-chrombpnet — 5-fold chromatin accessibility / TF binding model, peak preparation, and DeepSHAP/FiNeMO interpretation. Full scientific details, outputs, and CLI examples are on the ChromBPNet integration page.

Symbol Description
CHROMBPNET_DEFAULT_IMAGE Public export.
CONTRIBUTION_SCORES Public export.
COUNTS_TARGET Public export.
DEEPSHAP_COUNTS Public export.
FINEMO_HITS Public export.
FINEMO_IMAGE Public export.
INTERPRETATION_METHODS The methods ChromBPNet declares, upstream first.
KIND_INTERPRETATION_AVERAGE Public export.
KIND_INTERPRETATION_FOLDS Public export.
KIND_INTERPRETATION_MOTIF Public export.
KIND_INTERPRETATION_PLOT Public export.
KIND_MODEL_PREPROCESSING Public export.
KIND_SCORING_FOLDS Public export.
KIND_SCORING_SUMMARIZATION Public export.
MOTIF_HITS Public export.
MOTIF_SET_FILENAME Public export.
NUM_FOLDS The folds of a ChromBPNet ensemble.
PEAK_INTERVAL_INDEX_FILENAME Public export.
PREDICTED_PROFILES Public export.
PREPROCESSING_MANIFEST_FILENAME Public export.
PREPROCESSING_MANIFEST_FORMAT The format of a ChromBPNet preprocessing manifest.
PREPROCESSING_OUTPUTS The six files a manifest's outputs record, by name: each fold's peak distribution, then the interval index.
UNRECORDED_PRODUCER_IMAGE Public export.
VARIANT_SUMMARY Public export.
VARIANT_SUMMARY_COLUMNS The header of a variant_summary file, variants_w_interpret_plots.tsv, in order.
ChromBPNetConfiguration Durable ChromBPNet resource identity used by every plan builder.
ChromBPNetInterpretationLayout Paths for a ChromBPNet interpretation run, one method per file or directory the stage commands name.
ChromBPNetPlugin Predicts how a variant changes chromatin accessibility in one cell type: its counts and its profile shape.
ChromBPNetRunInputs Typed biological inputs for one ChromBPNet run.
FoldKind What one fold file holds: a bias-corrected model, a full model with its bias tower, or a bias model alone.
FoldKindError A fold file whose kind cannot be told: not HDF5, no Keras model_config, or layers these rules do not know.
PeaksCompression Compression of the narrowPeak-schema peak set.
PreprocessingManifestError A preprocessing manifest that is unreadable, inconsistent, or does not match its files or expected identity.
ShardKind Container-task kind values for the reference ChromBPNet pipeline.
WeightsFormat Serialized fold-weight formats the ChromBPNet runtime loads.
fold_weights_file Return one fold's staged weights, models/{model_id}/fold_{fold}_model.h5 for weights_format="h5".
genome_index_file Return the staged .fai index of the reference, genomes/{genome_label}/genome.fasta.fai.
kind_of_model_config Return what a parsed Keras model_config holds: absent, included or bias_only.
model_dir Return the directory that holds model-owned files: preparation's -o output directory.
motif_set_file Return the staged TF-MoDISco motif set, models/{model_id}/motifs.h5.
peak_distribution_file Return one fold's derived peak-activity distribution, models/{model_id}/fold_{fold}_peak_distribution.npy.
peak_interval_index_file Return the safe serialized peak interval index used to rebuild the in-memory peak tree.
peaks_file Return the staged raw peak set, models/{model_id}/peaks.bed.gz or .../peaks.bed.
preprocessing_manifest_file Return the optional preparation provenance manifest written beside the derived artifacts.
read_model_config Return the parsed Keras model_config attribute of a fold's .h5, as JSON, without loading its weights.
verify_preprocessing_manifest Check a ChromBPNet preprocessing manifest against the binding's rules, and return it as a JSON object.

ChromBPNet model binding for Altar.

CHROMBPNET_DEFAULT_IMAGE module-attribute

CHROMBPNET_DEFAULT_IMAGE = "riyavsinha/altar-chrombpnet@sha256:3a4e7eac3c91da8741954ad3ae9b3a4067c78fad79cb4b855fdfc884fdad530c"

CONTRIBUTION_SCORES module-attribute

CONTRIBUTION_SCORES = ArtifactSchema(
    name="contribution_scores",
    version="1.0.0",
    description="DeepSHAP contributions of the counts head, averaged over the five folds and summed over the one-hot channels: an N x 2114 float16 array per allele, one row per variant.",
    media_type="application/x-npy",
)

COUNTS_TARGET module-attribute

COUNTS_TARGET = 'counts'

DEEPSHAP_COUNTS module-attribute

DEEPSHAP_COUNTS = 'deepshap_counts'

FINEMO_HITS module-attribute

FINEMO_HITS = 'finemo_hits'

FINEMO_IMAGE module-attribute

FINEMO_IMAGE = "riyavsinha/altar-finemo@sha256:58f170e9a3bf85ee89226935aa273a74c109b0c19c1562e9ece96f39349fe625"

INTERPRETATION_METHODS module-attribute

INTERPRETATION_METHODS = (
    InterpretationMethod(
        name=DEEPSHAP_COUNTS,
        version="2.0.0",
        description="DeepSHAP contributions of the counts head and predicted profiles, averaged over the folds.",
        targets=(COUNTS_TARGET,),
        products=(CONTRIBUTION_SCORES, PREDICTED_PROFILES),
    ),
    InterpretationMethod(
        name=FINEMO_HITS,
        version="1.0.0",
        description="finemo motif hits on each allele's averaged contributions, and a per-variant summary table.",
        targets=(COUNTS_TARGET,),
        products=(MOTIF_HITS, VARIANT_SUMMARY),
        requires=DEEPSHAP_COUNTS,
    ),
)

The methods ChromBPNet declares, upstream first.

KIND_INTERPRETATION_AVERAGE module-attribute

KIND_INTERPRETATION_AVERAGE = (
    ShardKind.INTERPRETATION_AVERAGE
)

KIND_INTERPRETATION_FOLDS module-attribute

KIND_INTERPRETATION_FOLDS = ShardKind.INTERPRETATION_FOLDS

KIND_INTERPRETATION_MOTIF module-attribute

KIND_INTERPRETATION_MOTIF = ShardKind.INTERPRETATION_MOTIF

KIND_INTERPRETATION_PLOT module-attribute

KIND_INTERPRETATION_PLOT = ShardKind.INTERPRETATION_PLOT

KIND_MODEL_PREPROCESSING module-attribute

KIND_MODEL_PREPROCESSING = ShardKind.MODEL_PREPROCESSING

KIND_SCORING_FOLDS module-attribute

KIND_SCORING_FOLDS = ShardKind.SCORING_FOLDS

KIND_SCORING_SUMMARIZATION module-attribute

KIND_SCORING_SUMMARIZATION = ShardKind.SCORING_SUMMARIZATION

MOTIF_HITS module-attribute

MOTIF_HITS = ArtifactSchema(
    name="motif_hits",
    version="1.0.0",
    description="finemo motif hits on one allele's averaged contributions; peak_id is the variant's row.",
    media_type="text/tab-separated-values",
)

MOTIF_SET_FILENAME module-attribute

MOTIF_SET_FILENAME = 'motifs.h5'

NUM_FOLDS module-attribute

NUM_FOLDS = 5

The folds of a ChromBPNet ensemble. Each has its own weights file and its own peak distribution.

PEAK_INTERVAL_INDEX_FILENAME module-attribute

PEAK_INTERVAL_INDEX_FILENAME = 'peaks.intervals.jsonl'

PREDICTED_PROFILES module-attribute

PREDICTED_PROFILES = ArtifactSchema(
    name="predicted_profiles",
    version="1.0.0",
    description="Fold-averaged predicted profile scaled by predicted counts: an N x 1000 array per allele, one row per variant.",
    media_type="application/x-npy",
)

PREPROCESSING_MANIFEST_FILENAME module-attribute

PREPROCESSING_MANIFEST_FILENAME = (
    "preprocessing.manifest.json"
)

PREPROCESSING_MANIFEST_FORMAT module-attribute

PREPROCESSING_MANIFEST_FORMAT = (
    "altar.chrombpnet.preprocessing-manifest"
)

The format of a ChromBPNet preprocessing manifest.

PREPROCESSING_OUTPUTS module-attribute

PREPROCESSING_OUTPUTS = (
    *(
        f"fold_{fold}_peak_distribution.npy"
        for fold in range(NUM_FOLDS)
    ),
    PEAK_INTERVAL_INDEX_FILENAME,
)

The six files a manifest's outputs record, by name: each fold's peak distribution, then the interval index.

UNRECORDED_PRODUCER_IMAGE module-attribute

UNRECORDED_PRODUCER_IMAGE = 'unrecorded'

VARIANT_SUMMARY module-attribute

VARIANT_SUMMARY = ArtifactSchema(
    name="variant_summary",
    version="1.0.0",
    description="One row per variant with both alleles' central profiles, contributions, sequences and motif hits as text.",
    media_type="text/tab-separated-values",
)

VARIANT_SUMMARY_COLUMNS module-attribute

VARIANT_SUMMARY_COLUMNS = (
    "chr",
    "pos",
    "ref",
    "alt",
    "variant_id",
    "ref_profile",
    "ref_shap_contributions",
    "ref_shap_sequence",
    "ref_all_hits",
    "ref_motifs",
    "alt_profile",
    "alt_shap_contributions",
    "alt_shap_sequence",
    "alt_all_hits",
    "alt_motifs",
)

The header of a variant_summary file, variants_w_interpret_plots.tsv, in order.

The file is tab-separated with this header row, then one row per variant in the order of the staged variant file. chr, pos (1-based), ref, alt and variant_id name the variant. Then, for each allele:

  • {allele}_profile: the fold-averaged predicted profile over the central 1,000 bases, as a bracketed, comma-separated list of numbers;
  • {allele}_shap_contributions: the averaged contributions over the same 1,000 bases, in the same form;
  • {allele}_shap_sequence: those 1,000 bases of the allele's input sequence;
  • {allele}_all_hits: the allele's motif hits with a coefficient of at least 10, as a Python literal list of {"start", "end", "motif_name"} records, start and end being offsets in the 2,114-base input window;
  • {allele}_motifs: the comma-separated names of the hits that overlap the variant, empty when none does.

FoldKind module-attribute

FoldKind = Literal['absent', 'included', 'bias_only']

What one fold file holds: a bias-corrected model, a full model with its bias tower, or a bias model alone.

PeaksCompression module-attribute

PeaksCompression = Literal['gzip', 'none']

Compression of the narrowPeak-schema peak set. The runtime infers decompression from the staged suffix.

WeightsFormat module-attribute

WeightsFormat = Literal['h5']

Serialized fold-weight formats the ChromBPNet runtime loads. Keras loads a single-file model by suffix.

ChromBPNetConfiguration

Bases: TrainingAssemblyConfiguration

Durable ChromBPNet resource identity used by every plan builder.

weights_format and peaks_compression declare how the content-addressed resources are serialized, so staged file names never depend on a resource URI's suffix. motifs is the optional TF-MoDISco motif set (HDF5) that interpretation hit calling reads; scoring and preparation ignore it.

The configuration holds no runtime image: a run selects one per runtime role (ScoringRequest.runtimes), and the binding's manifest declares each role's default and the images compatible with its commands.

reference_seed seeds the shuffled references of the deepshap_counts interpretation. Only interpretation reads it, so it never enters a score identity.

The five fold files are ChromBPNet's bias-corrected chrombpnet_nobias.h5 models. Altar scores, prepares and interprets bias-corrected models only: the runtime refuses a full chrombpnet.h5 model, which keeps its Tn5 or DNase bias tower, and a standalone bias model before loading either.

training_genome_build is the assembly the model and its peaks come from. A model trained on mouse ("mm10") can score human ("hg38") variants: scoring reads the hg38 reference, and in_peak, which tests the variant against the model's own mm10 peaks, is stored as null. Preparation measures the model's activity at its peaks, so it runs on the training assembly's reference.

scientific_dict

scientific_dict() -> dict[str, Any]

Return the score-cache projection: every field but the score-neutral ones.

Serialization formats and the interpretation-only motif set and reference seed cannot change a score, so declaring them never invalidates cached scores. Interpretation adds the motif set and the seed to its own identity.

from_resource_manifest classmethod

from_resource_manifest(
    path: str | PathLike[str],
    *,
    base_uri: str | None = None,
    **settings: Any,
) -> ChromBPNetConfiguration

Build a configuration from the chrombpnet.resources.json that altar-chrombpnet-resources wrote.

settings are the remaining configuration fields, such as motifs or average_reverse. See :func:altar_chrombpnet.resources.manifest_resources for how base_uri locates the files.

ChromBPNetInterpretationLayout dataclass

ChromBPNetInterpretationLayout()

Bases: ModelArtifactLayout

Paths for a ChromBPNet interpretation run, one method per file or directory the stage commands name.

Inherits the shared genome and model-file paths from ModelArtifactLayout. Several outputs are directories rather than single files: a fold's contribution scores, the averaged run directory, and the per-allele hit directories. The model runtime and finemo write a tree of files into each. A plan built for an interpretation operation declares the product files inside them as outputs; the historical interpretation plan does not.

hitcaller_region_file

hitcaller_region_file(
    run_id: str, model_id: str, allele: str
) -> str

Return the per-allele finemo input the average step writes, …/{allele}_finemo_input.npz.

hits_dir

hits_dir(run_id: str, model_id: str, allele: str) -> str

Return the per-allele finemo call-hits output directory, …/ref_hits or …/alt_hits.

average_contributions_file

average_contributions_file(
    run_id: str, model_id: str, allele: str
) -> str

Return one allele's fold-averaged contributions, …/average_ref_shap_contributions.npy.

average_profiles_file

average_profiles_file(
    run_id: str, model_id: str, allele: str
) -> str

Return one allele's fold-averaged predicted profiles, …/average_ref_profiles.npy.

hits_file

hits_file(run_id: str, model_id: str, allele: str) -> str

Return one allele's finemo hit table, …/ref_hits/hits.tsv.

ChromBPNetPlugin

Bases: InterpretableModel

Predicts how a variant changes chromatin accessibility in one cell type: its counts and its profile shape.

num_folds property

num_folds: int

Return how many fold models score each variant, the count every fold shard carries as num_folds.

scoring_result_codec

scoring_result_codec() -> ScoringResultCodec

Map the runtime's historical lfc spelling into the public logfc schema.

The runtime writes scores only: an unscorable variant is a row with null scores, and its reason is in the runtime log.

scoring_runtime_identities

scoring_runtime_identities(
    runtimes: Mapping[str, str],
) -> dict[str, str]

Select the scoring and preparation image, model_runtime: an override in runtimes or the default.

preprocessing_identity

preprocessing_identity(
    configuration: ChromBPNetConfiguration,
    run_inputs: ChromBPNetRunInputs,
) -> str

Identify derived peak artifacts by every scientific parent and preprocessing policy.

run_inputs are the inputs preparation runs with, so their genome is the one preparation read, and its seqcol, run_inputs.genome_sequence_collection, is the genome parent.

scoring_preprocessing_identity

scoring_preprocessing_identity(
    configuration: ChromBPNetConfiguration,
    run_inputs: ChromBPNetRunInputs,
) -> str

Return the preprocessing identity that scoring with run_inputs expects of its derived artifacts.

It is preprocessing_identity for the reference preparation read. That is the run's own genome, or run_inputs.training_genome when the configuration declares another training assembly than the run's, named by its run_inputs.training_genome_sequence_collection. Raises ValueError when a cross-assembly run has no training reference, or when a same-assembly run names a training reference with another seqcol than its genome's.

preprocessing_manifest_body

preprocessing_manifest_body(
    configuration: ChromBPNetConfiguration,
    run_inputs: ChromBPNetRunInputs,
    files: Mapping[str, tuple[str, int]],
    *,
    producer_image: str,
    creation_mode: Literal[
        "computed", "trusted_attestation"
    ] = "trusted_attestation",
) -> dict[str, Any]

Return the preprocessing.manifest.json the runtime writes for these prepared files, as a JSON object.

run_inputs are the inputs preparation ran with, as for preprocessing_identity. files maps each of the six derived files (fold_<k>_peak_distribution.npy and peaks.intervals.jsonl) to its (sha256:<hex> digest, size in bytes). producer_image is the image that made the files and creation_mode how this manifest came to be: the runtime writes computed, and a manifest written again for files prepared earlier is a trusted_attestation. The producer may be an image that can no longer prepare; the manifest names the image that did. Files prepared before any image was recorded are attested with UNRECORDED_PRODUCER_IMAGE.

The object includes manifest_digest. The runtime writes it as json.dumps(body, indent=2, sort_keys=True) + "\n"; altar_chrombpnet.preprocessing describes every key, and verify_preprocessing_manifest checks the result. Raises ValueError when files names other files than the six.

build_preprocessing_plan

build_preprocessing_plan(
    request: PreprocessingRequest,
) -> ModelWorkflowPlan

Build the ChromBPNet model-preprocessing plan as a single runtime task.

Logical paths come from the binding's artifact_layout and are resolved to container paths via request.resolver. Staged input names come from the declared weights_format and peaks_compression, never from resource URIs, so preparation needs no directory glob at runtime.

Preparation predicts the model's activity at its own peaks, whose coordinates are on the training assembly. When the configuration declares training_genome_build, the request's run inputs must name that assembly and its reference; any other assembly raises ValueError. Scoring may then use variants on any assembly.

A declared ChromBPNetRunInputs.genome_index is staged beside the FASTA and passed to the runtime. The reference's seqcol is passed as --genome-sequence-collection, the manifest's genome parent; only an image in _PREPARATION_IMAGES takes it, and selecting another raises RuntimeIdentityError.

The six derived files and the manifest are content-addressed outputs (Transfer.content_addressed) when artifact_layout attests that its model resource paths are derived from the content of the resources they hold (ModelArtifactLayout.content_addressed_model_resources). Under the default models/<model_id>/ layout they are not.

prepared_run_inputs

prepared_run_inputs(
    request: ScoringRequest,
    *,
    preparation_run_inputs: ModelRunInputs,
    published: Mapping[str, Path],
) -> ChromBPNetRunInputs

Turn on verify_preprocessing for files altar prepare published, after checking their manifest.

The published preprocessing.manifest.json must record the weights, peaks, strand policy, preprocessing version and genome parent this configuration expects; a difference raises ValueError naming it. The genome parent is the seqcol of preparation_run_inputs, the reference preparation read, so a manifest that names it by its FASTA file's SHA-256 is refused. For a model trained on another assembly than the run's, training_genome and training_genome_sequence_collection are set to the reference preparation read, unless the run inputs name one.

Run inputs that set verify_preprocessing = false are returned unchanged, with a warning that the published files are scored unchecked.

build_scoring_plan

build_scoring_plan(
    request: ScoringRequest,
) -> ContainerScoringPlan

Build the ChromBPNet scoring plan: one score task per fold plus a predictions fan-in.

Paths come from request.layout as logical paths (ChromBPNet's derived model files are composed from its model_resource_file) and are resolved to container paths via request.resolver. Each task declares its input and output Transfers so a backend that stages files per task (local, modal) can run it unchanged; a backend that shares a volume across pods stages files itself and ignores them. summarize runs once every fold task has finished, and its one output is the plan's primary result file.

With ChromBPNetRunInputs.verify_preprocessing, each fold task and the summary also stage the preprocessing manifest and pass the identity scoring_preprocessing_identity expects, and the runtime refuses derived artifacts whose manifest records another identity. A declared genome_index is staged beside the FASTA for each fold task. Neither changes the plan identity.

interpretation_run_identity

interpretation_run_identity(
    configuration: ChromBPNetConfiguration,
    run_inputs: ChromBPNetRunInputs,
    runtimes: Mapping[str, str] | None = None,
    *,
    motifs: bool = True,
) -> PluginRunIdentity

Identify an interpretation run by its complete scientific configuration and its runtimes.

runtimes overrides the interpretation and motif images, as InterpretationRequest.runtimes does. With motifs the run calls motif hits, so it reads the motif set and runs both images; without it the run stops at the averaged contributions, runs only the interpretation image and records no motif set.

The scoring projection deliberately omits the motif set and the reference seed, which cannot change a score; interpretation reads them, so this identity adds the motif set's scientific identity and the reference sampling settings, seed included, to the scoring projection. The exact configuration_hash already covers the complete saved configuration, motif set included.

interpretation_methods

interpretation_methods() -> tuple[
    InterpretationMethod, ...
]

Return deepshap_counts and finemo_hits, which requires it.

interpretation_scientific_dict

interpretation_scientific_dict(
    configuration: ModelConfiguration,
    *,
    method: str,
    target: str,
) -> dict[str, Any]

Return the resources and command-line constants one method reads.

deepshap_counts reads the fold weights and records its deterministic reference sampling policy, including the configuration's reference_seed. finemo_hits reads the motif set and passes finemo's -b and -l values; the weights reach its ID through the upstream method's. Peaks and the scoring policies are read only by scoring.

interpretation_runtime_identities

interpretation_runtime_identities(
    runtimes: Mapping[str, str], *, method: str
) -> dict[str, str]

Return the model_runtime image for deepshap_counts, and it and the finemo image for finemo_hits.

The contribution, average and plot steps run on model_runtime. Only an image that interprets (_INTERPRETATION_IMAGES) may be selected for them; another compatible scoring image raises RuntimeIdentityError.

interpretation_rows

interpretation_rows(
    *,
    method: str,
    product: str,
    variants: Sequence[VariantKey],
) -> tuple[InterpretationRow, ...]

Return one row per variant; altar_chrombpnet.interpretation gives each product's span.

interpretation_input_span

interpretation_input_span(
    *, method: str, variant: VariantKey
) -> tuple[int, int]

Return the reference span the runtime reads; preparation refuses one that runs off its contig.

interpretation_variant_problem

interpretation_variant_problem(
    *, method: str, variant: VariantKey
) -> str | None

Refuse a variant on a contig the runtime does not interpret: anything but chr1-chr22, chrX and chrY.

interpretation_genome_index

interpretation_genome_index(
    run_inputs: ModelRunInputs,
) -> ResourceReference | None

Return the run's declared genome_index; without one, preparation reads the .fai beside the FASTA.

build_interpretation_workflow

build_interpretation_workflow(
    request: InterpretationRequest,
    *,
    selection: InterpretationSelection,
    variants_digest: str,
) -> InterpretationWorkflow

Build the interpretation stages that selection's chain needs, with every product file.

deepshap_counts runs one contribution-score task per fold and a task that averages the folds; finemo_hits adds one finemo motif hit-calling task per allele (ref and alt) and a final per-variant plot task. The average step's contributions and profiles, finemo's hits.tsv for each allele, and the plot table are terminal outputs. Each fold task, and the plot task, stage the variant file with variants_digest.

Logical paths come from the binding's interpretation_layout and are resolved via request.resolver. Every stage uses the normal-GPU 64Gi profile; any per-stage scheduling difference is a backend decision selected by kind. Named dependencies hold each stage until its prerequisites finish. Fold weights, the genome, and the configured motif set are declared as digest-carrying Transfers via resource_transfer, exactly as scoring declares its resources; the execution backend verifies a transfer's digest before the task reads the bytes. The fold command line is the one the interpretation image's CLI accepts; it has no weight-digest flag, so integrity comes from staging.

ChromBPNetRunInputs

Bases: ReferenceGenomeRunInputs

Typed biological inputs for one ChromBPNet run.

genome_index is the reference's .fai index. When it is given, preparation and fold scoring stage it beside the FASTA and read it as it is. When it is not, the runtime reads an index the host put beside the FASTA, or builds one in a temporary directory when there is none.

verify_preprocessing makes scoring check the derived peak artifacts against their preprocessing manifest (preprocessing.manifest.json), which Altar's preparation plan writes beside them. The fold and summary tasks then refuse artifacts prepared from other weights, peaks, reference or strand policy. Leave it unset for artifacts prepared outside Altar, which have no manifest.

training_genome is the training assembly's reference that preparation read, for a model whose configuration declares a training_genome_build other than this run's, and training_genome_sequence_collection is its seqcol, which the two are given with. Scoring needs them only to check the preprocessing manifest, whose genome parent is that seqcol.

None of these fields enters the score identity.

FoldKindError

Bases: ValueError

A fold file whose kind cannot be told: not HDF5, no Keras model_config, or layers these rules do not know.

read_model_config, kind_of_model_config and inspect_fold_file raise it. It is a ValueError.

PreprocessingManifestError

Bases: ValueError

A preprocessing manifest that is unreadable, inconsistent, or does not match its files or expected identity.

ShardKind

Bases: StrEnum

Container-task kind values for the reference ChromBPNet pipeline.

Every container task a plan produces carries a kind. The step that groups finished tasks to fire a fan-in matches on this exact string, so a task's kind must equal the one that step groups on or its fan-in never runs. ContainerTaskSpec.kind stays a plain str so other architectures can define their own kinds; this enum gives the ChromBPNet pipeline one place to name its own. As a StrEnum, each member equals its string value.

fold_weights_file

fold_weights_file(
    layout: ModelArtifactLayout,
    model_id: str,
    fold: int,
    weights_format: WeightsFormat,
) -> str

Return one fold's staged weights, models/{model_id}/fold_{fold}_model.h5 for weights_format="h5".

genome_index_file

genome_index_file(
    layout: ModelArtifactLayout, genome_label: str
) -> str

Return the staged .fai index of the reference, genomes/{genome_label}/genome.fasta.fai.

It sits beside the FASTA, where pyfaidx and samtools look for an index by default.

kind_of_model_config

kind_of_model_config(config: object) -> FoldKind

Return what a parsed Keras model_config holds: absent, included or bias_only.

absent is a bias-corrected chrombpnet_nobias model, the only kind ChromBPNet scores, prepares or interprets; included is a full model with its bias tower; bias_only is a bias model alone. The module docstring gives the rules. Needs no extra. Raises FoldKindError for a config these rules cannot tell.

model_dir

model_dir(
    layout: ModelArtifactLayout, model_id: str
) -> str

Return the directory that holds model-owned files: preparation's -o output directory.

motif_set_file

motif_set_file(
    layout: ModelArtifactLayout, model_id: str
) -> str

Return the staged TF-MoDISco motif set, models/{model_id}/motifs.h5.

The motif set is a model-owned configured resource, so it lives beside that model's weights rather than at a shared storage-root path that two models could overwrite.

peak_distribution_file

peak_distribution_file(
    layout: ModelArtifactLayout, model_id: str, fold: int
) -> str

Return one fold's derived peak-activity distribution, models/{model_id}/fold_{fold}_peak_distribution.npy.

peak_interval_index_file

peak_interval_index_file(
    layout: ModelArtifactLayout, model_id: str
) -> str

Return the safe serialized peak interval index used to rebuild the in-memory peak tree.

peaks_file

peaks_file(
    layout: ModelArtifactLayout,
    model_id: str,
    compression: PeaksCompression,
) -> str

Return the staged raw peak set, models/{model_id}/peaks.bed.gz or .../peaks.bed.

preprocessing_manifest_file

preprocessing_manifest_file(
    layout: ModelArtifactLayout, model_id: str
) -> str

Return the optional preparation provenance manifest written beside the derived artifacts.

read_model_config

read_model_config(
    path: str | PathLike[str] | IO[bytes] | IOBase,
) -> Any

Return the parsed Keras model_config attribute of a fold's .h5, as JSON, without loading its weights.

path is a local path or a seekable binary file object, which h5py reads through, so a host can read a fold from object storage without downloading the whole file. Pass the result to kind_of_model_config.

Raises FoldKindError when the file is not HDF5, has no model_config, or holds one that is not JSON, and ModuleNotFoundError naming the altar-chrombpnet[inspect] extra when h5py is not installed.

verify_preprocessing_manifest

verify_preprocessing_manifest(
    manifest: bytes | str | Mapping[str, Any],
    *,
    expected_identity: str | None = None,
    files: Mapping[str, tuple[str, int]] | None = None,
) -> dict[str, Any]

Check a ChromBPNet preprocessing manifest against the binding's rules, and return it as a JSON object.

manifest is the file's bytes or text, or an object already parsed from them. The checks:

  • the text is UTF-8 JSON with no repeated key and no NaN or infinity, and is an object with exactly the manifest's keys;
  • format, schema_version and preprocessing_semantics_version are the ones this binding writes;
  • parents names five fold digests, a peaks digest and a genome, and policies sets average_reverse;
  • preprocessing_identity is the hash of the identity keys and, when expected_identity is given, equals it (ChromBPNetPlugin.preprocessing_identity and ChromBPNetPlugin.scoring_preprocessing_identity compute the identity a configuration expects);
  • provenance has a known creation_mode and a producer_runtime_image;
  • outputs records exactly PREPROCESSING_OUTPUTS, each with a sha256: digest and a size in bytes;
  • manifest_digest is the hash of every other key;
  • when files is given, it maps each of the six files to the (digest, size in bytes) the caller measured from the stored file, and every pair equals the manifest's record.

The function reads no file: a host hashes the stored files with its own storage client and passes files. Raises PreprocessingManifestError naming the first rule the manifest breaks.


altar_enformer

altar-enformer — multi-track SAD/SADR sequence model binding and checkpoint preparation. Full scientific details, outputs, and CLI examples are on the Enformer integration page.

Symbol Description
DEFAULT_IMAGE Public export.
HUMAN_TRACK_COUNT Public export.
KIND_SCORING Public export.
OUTPUT_BINS Public export.
OUTPUT_BIN_SIZE Public export.
SEQUENCE_LENGTH Public export.
EnformerConfiguration Immutable Enformer resources and selected human output tracks.
EnformerPlugin Predicts how a variant changes the chromatin, CAGE and TF tracks you select from Enformer's 5,313 (SAD).
EnformerRunInputs Per-run Enformer inputs, currently restricted to its training assembly.
EnformerShardKind Stable execution kind emitted by EnformerPlugin.

Enformer model binding for Altar.

DEFAULT_IMAGE module-attribute

DEFAULT_IMAGE = "riyavsinha/altar-enformer@sha256:f9248f6c6328b1aa47f56c91c5b8575672a7fe7864da32cf4ef40d5cc41496ad"

HUMAN_TRACK_COUNT module-attribute

HUMAN_TRACK_COUNT = 5313

KIND_SCORING module-attribute

KIND_SCORING = EnformerShardKind.SCORING

OUTPUT_BINS module-attribute

OUTPUT_BINS = 896

OUTPUT_BIN_SIZE module-attribute

OUTPUT_BIN_SIZE = 128

SEQUENCE_LENGTH module-attribute

SEQUENCE_LENGTH = 393216

EnformerConfiguration

Bases: ModelConfiguration

Immutable Enformer resources and selected human output tracks.

weights points to a tar archive containing one TensorFlow SavedModel. track_metadata is the official targets_human.txt table whose index column maps output channels to stable identifiers. Track indices are canonicalized by requiring strictly increasing values; equivalent selections therefore cannot acquire different cache identities solely from ordering.

from_resource_manifest classmethod

from_resource_manifest(
    path: str | PathLike[str],
    *,
    base_uri: str | None = None,
    **settings: Any,
) -> EnformerConfiguration

Build a configuration from the enformer.resources.json that altar-enformer-resources wrote.

settings are the remaining configuration fields: track_indices. See :func:altar_enformer.resources.manifest_resources for how base_uri locates the files.

EnformerPlugin

Bases: ModelPlugin

Predicts how a variant changes the chromatin, CAGE and TF tracks you select from Enformer's 5,313 (SAD).

build_scoring_plan

build_scoring_plan(
    request: ScoringRequest,
) -> ContainerScoringPlan

Build one independently retryable task for one deterministic variant batch.

EnformerRunInputs

Bases: ReferenceGenomeRunInputs

Per-run Enformer inputs, currently restricted to its training assembly.

EnformerShardKind

Bases: StrEnum

Stable execution kind emitted by :class:EnformerPlugin.


altar_legnet

altar-legnet — CPU-friendly LentiMPRA regulatory activity model binding and packaged WTC11 registry. Full scientific details, outputs, and CLI examples are on the LegNet integration page.

Symbol Description
CONTEXT_LENGTH Public export.
DEFAULT_IMAGE Public export.
KIND_SCORING Public export.
MODEL_INPUT_LENGTH Public export.
LegNetConfiguration Immutable human LegNet checkpoint and MPRA scoring settings.
LegNetPlugin Predicts how a variant changes MPRA regulatory activity in a human cell type.
LegNetRunInputs Per-run inputs for the published human MPRA checkpoints.
LegNetShardKind Stable execution kind emitted by LegNetPlugin.

LegNet model binding for Altar.

CONTEXT_LENGTH module-attribute

CONTEXT_LENGTH = 200

DEFAULT_IMAGE module-attribute

DEFAULT_IMAGE = "riyavsinha/altar-legnet@sha256:27cd6ade4854217db42e11ac99755b8e5d44ea69f546424d333fbfe1f3535c59"

KIND_SCORING module-attribute

KIND_SCORING = LegNetShardKind.SCORING

MODEL_INPUT_LENGTH module-attribute

MODEL_INPUT_LENGTH = 230

LegNetConfiguration

Bases: ModelConfiguration

Immutable human LegNet checkpoint and MPRA scoring settings.

cell_type and assay name the data the checkpoint was trained on. They label the scores and select nothing: the weights decide what the model predicts, so two configurations that differ only in these labels score identically and reuse each other's scores. Where a trusted record says what a checkpoint is, the labels must agree with it: the official weights, entry legnet/wtc11 of the legnet registry, must be labelled WTC11 and LentiMPRA, and from_resource_manifest refuses a cell_type that contradicts its manifest. Altar cannot check the labels of any other checkpoint, so give the ones it was packaged with.

scientific_dict

scientific_dict() -> dict[str, Any]

Return the score-cache projection: every field but the cell_type and assay labels.

The runtime's score command never reads the labels. A variant's activity depends on the weights, the training configuration and average_reverse (with the reference and the image, which the run identity holds), so a relabelled checkpoint is the same model and reuses its scores.

validate_official_labels

validate_official_labels() -> LegNetConfiguration

Refuse labels that contradict what the official checkpoint was trained on.

from_resource_manifest classmethod

from_resource_manifest(
    path: str | PathLike[str],
    *,
    base_uri: str | None = None,
    **settings: Any,
) -> LegNetConfiguration

Build a configuration from a legnet.resources.json, which the runtime's legnet-resources writes.

legnet-resources package writes one for any checkpoint; the official one is the registry entry legnet/wtc11 instead.

settings are the remaining configuration fields: assay and average_reverse. The cell_type is the one the manifest records for the checkpoint; giving another raises ValueError. See :func:altar_legnet.resources.manifest_resources for how base_uri locates the files.

LegNetPlugin

Bases: ModelPlugin

Predicts how a variant changes MPRA regulatory activity in a human cell type.

LegNetRunInputs

Bases: ReferenceGenomeRunInputs

Per-run inputs for the published human MPRA checkpoints.

LegNetShardKind

Bases: StrEnum

Stable execution kind emitted by :class:LegNetPlugin.


altar_sei

altar-sei — 40-sequence-class scorer and optional 21,907-profile chromatin artifact binding. Full scientific details, outputs, and CLI examples are on the Sei integration page.

Symbol Description
CHROMATIN_PROFILE_COUNT Public export.
DEFAULT_IMAGE Public export.
KIND_SCORING Public export.
MANIFEST_FILENAME Public export.
PROFILE_EFFECTS Public export.
SEQUENCE_CLASS_COUNT Public export.
SEQUENCE_LENGTH Public export.
ManifestResources Location-neutral references read from one sei.resources.json.
SeiConfiguration Immutable official Sei resources.
SeiPlugin Predicts how a variant changes 40 sequence classes of regulatory activity.
SeiRunInputs Per-run reference inputs supported by the official Sei workflow.
SeiShardKind Stable execution kind emitted by SeiPlugin.
manifest_resources Read sei.resources.json into content-addressed ResourceReference values for SeiConfiguration.

Sei model binding for Altar.

CHROMATIN_PROFILE_COUNT module-attribute

CHROMATIN_PROFILE_COUNT = 21907

DEFAULT_IMAGE module-attribute

DEFAULT_IMAGE = "riyavsinha/altar-sei@sha256:423030fb361522f608c0eb36a6c0e6bf6e939530772d3724220dd9e23e4f4c21"

KIND_SCORING module-attribute

KIND_SCORING = SeiShardKind.SCORING

MANIFEST_FILENAME module-attribute

MANIFEST_FILENAME = 'sei.resources.json'

PROFILE_EFFECTS module-attribute

PROFILE_EFFECTS = ArtifactSchema(
    name="chromatin_profile_effects",
    version="0.0.2",
    description="One NumPy .npz archive per scoring batch: variant_ids (str, n), effects (float32, n x 21,907; the strand-averaged alternate-minus-reference prediction of every chromatin profile, before nucleosome adjustment, NaN for a variant the runtime could not score), profile_index (int32, 21,907; the model's output column of each effect), and profile_names (str, 21,907; the published name of each column's chromatin profile: line profile_index + 1 of the official target.names).",
    media_type="application/x-npz",
)

SEQUENCE_CLASS_COUNT module-attribute

SEQUENCE_CLASS_COUNT = 40

SEQUENCE_LENGTH module-attribute

SEQUENCE_LENGTH = 4096

ManifestResources dataclass

ManifestResources(
    weights: ResourceReference,
    projection_vectors: ResourceReference,
    histone_indices: ResourceReference,
    sequence_class_names: ResourceReference,
    target_names: ResourceReference | None = None,
)

Location-neutral references read from one sei.resources.json.

SeiConfiguration

Bases: ModelConfiguration

Immutable official Sei resources.

Strand averaging, the 4,096 bp input, all 21,907 chromatin profiles, all 40 sequence classes, and nucleosome-occupancy adjustment are fixed parts of the published scoring semantics rather than user options. Runs default to :data:DEFAULT_IMAGE, the published runtime validated against the official Sei framework.

target_names is the official archive's target.names, the published name of each of the 21,907 chromatin profiles in model-output order. A run that selects the chromatin_profile_effects artifact requires it, to name the archive's columns. No score reads it, so it is never part of the scientific projection: setting it keeps the score lineage.

scientific_dict

scientific_dict() -> dict[str, JsonValue]

Return the scientific projection, which never includes target_names.

from_resource_manifest classmethod

from_resource_manifest(
    path: str | PathLike[str],
    *,
    base_uri: str | None = None,
    **settings: Any,
) -> SeiConfiguration

Build SeiConfiguration from a sei.resources.json manifest written by altar-sei-resources.

SeiPlugin

Bases: ModelPlugin

Predicts how a variant changes 40 sequence classes of regulatory activity.

profile_effects_output class-attribute instance-attribute

profile_effects_output = OutputSelection(
    outputs=(*default_output.outputs, PROFILE_EFFECTS.name),
    reducer=default_output.reducer,
)

The output selection that also writes the per-batch chromatin_profile_effects artifact.

The default validate_output_selection accepts it, as the default followed by the declared artifact. It requires :attr:SeiConfiguration.target_names, which the runtime copies into the archive as profile_names.

SeiRunInputs

Bases: ReferenceGenomeRunInputs

Per-run reference inputs supported by the official Sei workflow.

SeiShardKind

Bases: StrEnum

Stable execution kind emitted by :class:SeiPlugin.

manifest_resources

manifest_resources(
    path: str | PathLike[str],
    *,
    base_uri: str | None = None,
) -> ManifestResources

Read sei.resources.json into content-addressed ResourceReference values for SeiConfiguration.