Skip to content

Offline BioMart mode only skips ID lookup, not per-variant sequence fetches #347

Description

@jonasscheid

Description of the bug

The --biomart_dump_path parameter (added in #316) is documented as enabling offline BioMart usage, but it only partially works offline. The dump file provides transcript→protein ID mappings, which skips the initial get_protein_ids_from_transcripts() call (epaa.py L1135-1137).

However, the main performance bottleneck — the per-variant loop at L607-611 — still uses the live martsadapter to call generator.generate_transcripts_from_variants() for every variant. This function fetches actual transcript/protein sequences from Ensembl BioMart to compute mutated peptides, and it runs once per variant (O(N) network calls).

This means:

  • "Offline" mode still requires internet access for the sequence lookup step
  • CI tests using VCF input take 4-6 hours due to per-variant BioMart queries, even with the dump file
  • Tests are non-deterministic — when BioMart is flaky, some variants produce no peptides, leading to snapshot mismatches

Relevant code

# L1135-1137: This is the ONLY part skipped by --biomart_dump (ID mapping)
if args.biomart_dump:
    transcriptProteinTable = get_protein_ids_from_transcripts_offline(transcripts, args.biomart_dump)

# L607-611: This still hits BioMart live for every variant (sequence fetches)
for v in variants:
    try:
        transcripts.extend(generator.generate_transcripts_from_variants([v], martsadapter, ID_SYSTEM_USED, db=ensembl_dataset))
    except Exception:
        logger.warning(f"Could not generate transcripts for variant {v}. Skipping.")

Upstream epytope issues

Fixing this properly likely requires changes in the epytope library to support offline/cached sequence lookups in generate_transcripts_from_variants. Relevant upstream issues:

Impact

  • test_offline config advertises offline support but the pipeline still requires live BioMart access
  • All VCF-based CI tests (8 out of 12) are slow and flaky due to this dependency
  • Users in air-gapped environments cannot actually run the pipeline offline with VCF input

System information

  • Observed on current dev branch (dc0107e)
  • Affects all VCF-based test profiles

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions