Skip to content

LegNet

LegNet predicts how a human SNV changes the regulatory activity of a short sequence in a massively parallel reporter assay (lentiMPRA) in one cell type, such as WTC11, K562 or HepG2. It runs on a CPU.

Kind Container model; type = "LEGNET"
Install pip install altar-legnet (PyPI)
Genome builds hg38
Variant classes SNVs
Compute CPU only; up to 4 GB of memory per task
Image riyavsinha/altar-legnet@sha256:43a40005…, pinned by digest. linux/amd64, 273 MB compressed, pulled anonymously from Docker Hub on first use
Validation Upstream parity (CPU) (Validation)
Licence MIT code and weights
Upstream Code, Weights, Paper

When to use it

  • Use LegNet to ask whether an SNV changes the activity of the 200 bases around it as a reporter construct, in the cell type the checkpoint was trained on. The binding fetches the WTC11 checkpoint.
  • It needs no GPU, and its image is 273 MB compressed. The quickstart scores with it.
  • Choose ChromBPNet or Cherimoya to ask how a variant changes chromatin accessibility in its native genome, rather than activity in a reporter. Both also score indels.
  • Choose a multi-track model, such as Enformer, Borzoi or AlphaGenome, to compare many assays or cell types from one model, or to reach gene expression.

Add it to a run

[models.legnet]
resources = "legnet/wtc11"  # altar resources fetch legnet/wtc11

[models.legnet.configuration]
# cell_type = "..."  # required, text, unless the registry entry gives it
  1. Install the binding: pip install altar-legnet.
  2. Fetch the WTC11 checkpoint (10 MB) with its training configuration, and the hg38 genome:

    altar resources fetch legnet/wtc11
    altar resources fetch hg38
    
  3. Name them in the spec. The registry entry gives the model's type and its whole configuration, cell_type included, so the section needs no [models.<name>.configuration]:

    [variants]
    path = "cohort.tsv"
    reference = "hg38"
    
    [models.legnet-wtc11]
    resources = "legnet/wtc11"
    
  4. Give the spec a [backend].

altar models legnet lists the columns, the configuration fields, the default image and the registry entries. Score variants with a model walks through a run. The quickstart runs this model from a fresh install.

Outputs

Column Type Meaning Units and reading
ref_activity float Predicted reference MPRA activity the scale of the checkpoint's training data
alt_activity float Predicted alternate MPRA activity as ref_activity
activity_delta float Signed alternate-minus-reference predicted MPRA activity as ref_activity; positive means the alternate allele raises activity

activity_delta is alt_activity - ref_activity.

Each construct is the published lentiMPRA training oligo around the variant: the 15-base 5′ adapter AGGACCGGATCAACT, 200 bases of genomic context, and the 15-base 3′ adapter CATTGCGTGAACCGA, 230 bases in all. With average_reverse = true, the default, the runtime averages the predictions for the construct and its reverse complement, as the upstream prediction helpers do for checkpoints trained with reverse augmentation.

LegNet has no detail tables or artifacts.

Configuration

Field Type Default Meaning
weights resource required The checkpoint, with a SHA-256 digest. The legnet registry's entry wtc11 names the official one: resources = "legnet/wtc11".
training_config resource required The training configuration that matches the checkpoint, with a SHA-256 digest.
cell_type text required The cell type the checkpoint was trained on, such as WTC11. A label: it does not change scores. A resource manifest gives it.
assay text "LentiMPRA" The assay the checkpoint was trained on. A label: it does not change scores.
average_reverse true or false true Average the predictions for the construct and its reverse complement.
image text "riyavsinha/altar-legnet@sha256:43a40005…" The scoring image, as name@sha256:<digest>. Tags are refused.

Fields go under [models.<name>.configuration]. A registry entry gives every field instead, and the section's fields change it: name the fetched WTC11 checkpoint as resources = "legnet/wtc11" in [models.<name>]. A resource manifest gives weights, training_config and cell_type: name another checkpoint's as resource_manifest.

  • cell_type and assay name the data the checkpoint was trained on. The runtime never reads them (Where it comes from).
  • average_reverse changes the scores. Turning it off stores them under a new identity.
  • image must be a name@sha256:<digest> reference built from runtimes/legnet.

Inputs

  • Genome builds: hg38 only.
  • Variant classes: SNVs only. Batch preparation sets indels and multi-nucleotide variants aside and reports them, and the rest of the cohort scores. The runtime refuses a non-SNV in a batch staged some other way. The official allele-specific evaluation is SNV-based, so Altar defines no indel placement.
  • Window: 200 bases of genomic context, with the SNV at 0-based index 100 (100 bases upstream and 99 downstream).
  • Reference: [variants] reference, such as "hg38", or your own FASTA as reference_fasta.

Where it comes from

A LegNet model instance needs a checkpoint and its matching training configuration, each with a SHA-256 digest. The binding ships the legnet registry, whose entry wtc11 is the WTC11 example published in autosome-ru/human_legnet, at a pinned revision:

altar resources legnet
altar resources fetch legnet/wtc11

The fetch checks both files against the entry's digests and keeps them in Altar's cache. Name the entry in the spec as resources = "legnet/wtc11". The command needs only altar and altar-legnet. Find and fetch models and genomes says where the files go.

A model instance is defined by the checkpoint and configuration digests, average_reverse, the image and the reference's digest. Moving the same files to another location keeps every stored score. The labels cell_type and assay are not part of the identity.

Use another checkpoint

The runtime also accepts the K562 and HepG2 checkpoints and other compatible ones. Package one with the LegNet runtime's legnet-resources package --weights … --model-config … --cell-type … --output-dir …. It loads the checkpoint with PyTorch to check it, so run it in the runtime's environment: the default image, or runtimes/legnet in a source checkout. It writes the same manifest. Name it in the spec as resource_manifest.

cell_type and assay (default LentiMPRA) name the data a checkpoint was trained on. The runtime never reads them, so two configurations that differ only in these labels reuse each other's stored scores. Altar checks them where a record says what the checkpoint is:

  • the official weights, entry legnet/wtc11, are the WTC11 lentiMPRA checkpoint, and a configuration that labels them otherwise is refused;
  • a resource manifest records the checkpoint's cell_type, and a run spec that gives another one is refused.

For a custom checkpoint, give the cell type its publisher states, or unknown.

Compute and scale

  • CPU only: each task asks for up to 4 GB of memory and no GPU. An earlier build of the runtime scored about 138 variants per second on one CPU host, with a peak of 1.8 GB of memory.
  • Scale: Altar splits the cohort into batches, and each batch is one retryable container task. The runtime predicts in batches of 1,024 variants and streams rows to its output.
  • Image: linux/amd64, 273 MB compressed. It runs PyTorch 2.6 (CPU) on Python 3.11.

Prioritization

A variant is prioritized when abs(activity_delta) >= 0.5. This is a screening rule, not a calibrated threshold. What prioritized means explains how rules combine.

Validation

Validation label: Upstream parity (CPU). On a CPU, the runtime's construct for a fixture variant reproduces the published WTC11 training oligo exactly (datasets/original/WTC11.tsv, row seq10002_R, at human_legnet a20dbc7). Record: cpu-wtc11-semantics-1.1.json. The default image's scores for three hg38 SNVs are byte-identical to that run's. Record: cpu-wtc11-main-74be08c.json.

Not validated:

  • the K562 and HepG2 checkpoints, and any custom checkpoint;
  • indels, which the binding does not score.

The validation status table lists every model.

Limits

  • hg38 SNVs only.
  • Activity is predicted for a 230-base reporter construct, not for the variant in its native chromatin.
  • The construct differs from the upstream repository's separate allele-specific-binding helper, which uses a bare 231-base genomic window and shift ensembling.
  • The prioritization rule is a screening rule, not a calibrated threshold.

Cite and licence

Cite the paper that trained the human lentiMPRA models, and the LegNet architecture:

@article{agarwal2025lentimpra,
  author = {Agarwal, Vikram and Inoue, Fumitaka and Schubach, Max and Penzar, Dmitry and Martin, Beth K. and
    Dash, Pyaree Mohan and Keukeleire, Pia and Zhang, Zicong and Sohota, Ajuni and Zhao, Jingjing and
    Georgakopoulos-Soares, Ilias and Noble, William S. and Yard{\i}mc{\i}, Galip G{\"u}rkan and
    Kulakovskiy, Ivan V. and Kircher, Martin and Shendure, Jay and Ahituv, Nadav},
  title = {Massively parallel characterization of transcriptional regulatory elements},
  journal = {Nature},
  volume = {639},
  number = {8054},
  pages = {411--420},
  year = {2025},
  doi = {10.1038/s41586-024-08430-9}
}

@article{penzar2023legnet,
  author = {Penzar, Dmitry and Nogina, Daria and Noskova, Elizaveta and Zinkevich, Arsenii and
    Meshcheryakov, Georgy and Lando, Andrey and Rafi, Abdul Muntakim and de Boer, Carl and
    Kulakovskiy, Ivan V.},
  title = {{LegNet}: a best-in-class deep learning model for short {DNA} regulatory regions},
  journal = {Bioinformatics},
  volume = {39},
  number = {8},
  pages = {btad457},
  year = {2023},
  doi = {10.1093/bioinformatics/btad457}
}
  • Code and weights: autosome-ru/human_legnet, which holds the WTC11 example checkpoint, and autosome-ru/LegNet are MIT-licensed.
  • Runtime image: built from runtimes/legnet in the Altar repository (MIT) on a Python 3.11 base image. The runtime implements the published PyTorch architecture itself. It bundles PyTorch and other third-party packages under their own licences. It contains no weights.
  • Binding: altar-legnet is MIT-licensed.

Python and extension

LegNetConfiguration holds weights, training_config, cell_type, assay, average_reverse and image. LegNetConfiguration.from_resource_manifest reads the manifest the runtime's legnet-resources writes. altar_legnet.resources ships the legnet registry, registry.json, as LegNetRegistry, and pins the official files as OFFICIAL_FILES. Models and plans is the API reference for the model interface it implements.

The scoring plan has one CPU task per batch.