Skip to content

Interfaces

interfaces

ScoredSequence(sequence: list[str], mass_error: float, sequence_log_probability: float, token_log_probabilities: list[float]) dataclass

This class holds a residue sequence and its log probability.

sequence: list[str] instance-attribute

mass_error: float instance-attribute

sequence_log_probability: float instance-attribute

token_log_probabilities: list[float] instance-attribute

Decodable

An interface for models that can be decoded.

Algorithms should conform to the search interface.

residue_set: ResidueSet abstractmethod property

Every model must have a residue_set attribute.

init(spectra: Float[Spectrum, ' batch'], precursors: Float[PrecursorFeatures, ' batch'], *args, **kwargs) -> Any abstractmethod

Initialize the search state.

PARAMETER DESCRIPTION
spectra

The spectra to be sequenced.

TYPE: FloatTensor

precursors

The precursor mass, charge and mass-to-charge ratio.

TYPE: torch.FloatTensor[batch size, 3]

score_candidates(sequences: Integer[Peptide, '...'], precursor_mass_charge: Float[PrecursorFeatures, '...'], *args, **kwargs) -> torch.FloatTensor abstractmethod

Generate and score the next set of candidates.

PARAMETER DESCRIPTION
sequences

Partial residue sequences in generated the course of decoding.

TYPE: LongTensor

precursor_mass_charge

The precursor mass, charge and mass-to-charge ratio.

TYPE: torch.FloatTensor[batch size, 3]

get_residue_masses(mass_scale: int) -> torch.LongTensor abstractmethod

Get residue masses for the model's residue vocabulary.

PARAMETER DESCRIPTION
mass_scale

The scale in Daltons at which masses are calculated and rounded off. For example, a scale of 10000 would represent masses at a scale of 1e4 Da.

TYPE: int

decode(sequence: Integer[Peptide, '...']) -> list[str] abstractmethod

Map sequences of indices to residues using the model's residue vocabulary.

PARAMETER DESCRIPTION
sequence

The sequence of residue indices to be mapped to the corresponding residue strings.

TYPE: LongTensor

get_eos_index() -> int abstractmethod

Get the end of sequence token's index in the model's residue vocabulary.

get_empty_index() -> int abstractmethod

Get the empty token's index in the model's residue vocabulary.

Decoder(model: Decodable)

A class that implements some search algorithm for decoding.

Model should conform to the Decodable interface.

PARAMETER DESCRIPTION
model

The model to predict residue sequences from using the implemented search algorithm.

TYPE: Decodable

model = model instance-attribute

decode(spectra: Float[Spectrum, '...'], precursors: Float[PrecursorFeatures, '...'], *args, **kwargs) -> dict[str, Any] abstractmethod

Generate the predicted residue sequence using the decoder's search algorithm.

PARAMETER DESCRIPTION
spectra

The spectra to be sequenced.

TYPE: FloatTensor

precursors

The precursor mass, charge and mass-to-charge ratio.

TYPE: FloatTensor

RETURNS DESCRIPTION
dict[str, Any]

dict[str, Any]: Required keys: - "sequence": list[str] - "mass_error": float - "sequence_log_probability": float - "token_log_probabilities": list[float] - "encoder_output": list[float] (optional) Example additional keys: - "sequence_beam_0": list[str]