Interfaces
Decodable
An interface for models that can be decoded by algorithms that conform to the search interface.
decode(sequence)
abstractmethod
Map sequences of indices to residues using the model's residue vocabulary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
LongTensor
|
The sequence of residue indices to be mapped to the corresponding residue strings. |
required |
Source code in instanovo/inference/interfaces.py
get_empty_index()
abstractmethod
get_eos_index()
abstractmethod
get_residue_masses(mass_scale)
abstractmethod
Get residue masses for the model's residue vocabulary.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mass_scale |
int
|
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. |
required |
Source code in instanovo/inference/interfaces.py
init(spectra, precursors, *args, **kwargs)
abstractmethod
Initialize the search state.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
spectra |
FloatTensor
|
The spectra to be sequenced. |
required |
precursors |
torch.FloatTensor[batch size, 3]
|
The precursor mass, charge and mass-to-charge ratio. |
required |
Source code in instanovo/inference/interfaces.py
score_candidates(sequences, precursor_mass_charge, *args, **kwargs)
abstractmethod
Generate and score the next set of candidates.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequences |
LongTensor
|
Partial residue sequences in generated the course of decoding. |
required |
precursor_mass_charge |
torch.FloatTensor[batch size, 3]
|
The precursor mass, charge and mass-to-charge ratio. |
required |
Source code in instanovo/inference/interfaces.py
Decoder(model)
A class that implements some search algorithm for decoding from a model that conforms to the Decodable
interface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model |
Decodable
|
The model to predict residue sequences from using the implemented search algorithm. |
required |
Source code in instanovo/inference/interfaces.py
decode(spectra, precursors, *args, **kwargs)
abstractmethod
Generate the predicted residue sequence using the decoder's search algorithm.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
spectra |
FloatTensor
|
The spectra to be sequenced. |
required |
precursors |
FloatTensor
|
The precursor mass, charge and mass-to-charge ratio. |
required |