Samplers

Samplers decide which scenes, frames, molecules, or residues appear in each batch. Summaries below are taken from each class docstring.

Sample one index per frame in the active split partition.

class bioverse.samplers.frame.FrameSampler[source]

Bases: Sampler

Sample one index per frame in the active split partition.

index(toc, mask)[source]

Return row indices for elements in the active split partition.

Parameters:
  • toc – Table-of-contents array describing dataset size at each level.

  • mask – Boolean mask selecting scenes in the current partition.

Returns:

Structured index with fields such as scene, frame, molecule.

Return type:

ak.Array

Sample residue pairs at protein-protein interfaces.

class bioverse.samplers.interface_pair.InterfacePairSampler[source]

Bases: Sampler

Sample residue pairs at protein-protein interfaces.

index(toc, mask)[source]

Return row indices for elements in the active split partition.

Parameters:
  • toc – Table-of-contents array describing dataset size at each level.

  • mask – Boolean mask selecting scenes in the current partition.

Returns:

Structured index with fields such as scene, frame, molecule.

Return type:

ak.Array

Sample one index per molecule in the active split.

class bioverse.samplers.molecule.MoleculeSampler[source]

Bases: Sampler

Sample one index per molecule in the active split.

index(toc, mask)[source]

Return row indices for elements in the active split partition.

Parameters:
  • toc – Table-of-contents array describing dataset size at each level.

  • mask – Boolean mask selecting scenes in the current partition.

Returns:

Structured index with fields such as scene, frame, molecule.

Return type:

ak.Array

Sample indices at the mutation level for mutational scans.

class bioverse.samplers.mutation.MutationSampler(group_scenes=False)[source]

Bases: Sampler

Sample indices at the mutation level for mutational scans.

Each yielded index points at the same scene/frame/molecule and a different mutation entry, so loaders reuse one structure while varying mutation annotations.

group_scenes=True keeps mutations of one protein contiguous after shuffle so live graphs and the encoder run once per structure in a batch. Leave it false for MEROPS contrastive batches that need mixed enzymes.

index(toc, mask)[source]

Return row indices for elements in the active split partition.

Parameters:
  • toc – Table-of-contents array describing dataset size at each level.

  • mask – Boolean mask selecting scenes in the current partition.

Returns:

Structured index with fields such as scene, frame, molecule.

Return type:

ak.Array

Sample ordered pairs of molecules for pairwise tasks.

class bioverse.samplers.pairwise.PairwiseSampler[source]

Bases: Sampler

Sample ordered pairs of molecules for pairwise tasks.

index(toc, mask)[source]

Return row indices for elements in the active split partition.

Parameters:
  • toc – Table-of-contents array describing dataset size at each level.

  • mask – Boolean mask selecting scenes in the current partition.

Returns:

Structured index with fields such as scene, frame, molecule.

Return type:

ak.Array

Sample one index per residue in the active split.

class bioverse.samplers.residue.ResidueSampler(num_residues: int | float = 1)[source]

Bases: Sampler

Sample one index per residue in the active split.

index(toc, mask)[source]

Return row indices for elements in the active split partition.

Parameters:
  • toc – Table-of-contents array describing dataset size at each level.

  • mask – Boolean mask selecting scenes in the current partition.

Returns:

Structured index with fields such as scene, frame, molecule.

Return type:

ak.Array