Adapter
An adapter is the entry point for bringing external data into Bioverse. It
knows how to fetch or generate raw files from a repository (AlphaFold, ProteinShake,
PDB, etc.), optionally runs a Processor to parse
structure files, and returns the three objects every downstream component expects:
a stream of Batch shards, a Split
with train/validation/test partitions, and Assets for
auxiliary lookup tables (vocabularies, embeddings, metadata maps).
Adapters are typically invoked once when building or refreshing a
Dataset. See Adapters for
available sources.
- class bioverse.adapter.Adapter[source]
Bases:
ABCDownload raw data from an external source into Bioverse.
Adapters are the entry point of the data pipeline. A concrete adapter fetches or generates files under
raw_path, optionally parses them with aProcessor, and returns the three objects required to build aDataset:an iterator of
Batchshards,a
Splitwith partition assignments, andAssetsfor shared lookup tables.
Implement
download()and register the class in a dataset config (D_*.yaml) or call it fromrelease().Examples
Minimal adapter that wraps a local PDB directory:
from bioverse.adapter import Adapter from bioverse.data import Assets, Batch, Split from bioverse.processors.pdb import PdbProcessor from bioverse.utilities.io import rebatch class MyAdapter(Adapter): def download(self, path="my_structures"): records = PdbProcessor.process(path) batches = rebatch(records) split = Split({"scene_split": ["train"] * len(batches)}) assets = Assets() return batches, split, assets