Residues
ResidueSet(residue_masses)
A class for managing sets of residues.
Source code in instanovo/utils/residues.py
decode(sequence)
Map a sequence of indices to the corresponding sequence of residues.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
list[int]
|
The sequence of residue indices. |
required |
Returns:
Type | Description |
---|---|
list[str]
|
list[str]: The corresponding sequence of residue strings. |
Source code in instanovo/utils/residues.py
detokenize(sequence)
Joining a list of residues into a string representing the peptide.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
list[str]
|
The sequence of residues. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The string representing the peptide. |
Source code in instanovo/utils/residues.py
encode(sequence, pad_length=None)
Map a sequence of residues to their indices and optionally pad them to a fixed length.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
list[str]
|
The sequence of residues. |
required |
pad_length |
int | None
|
An optional fixed length to pad the encoded sequence to.
If this is |
None
|
Returns:
Type | Description |
---|---|
LongTensor
|
torch.LongTensor: A tensor with the indices of the residues. |
Source code in instanovo/utils/residues.py
get_mass(residue)
Get the mass of a residue.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
residue |
str
|
The residue whose mass to fetch. This residue
must be in the residue set or this will raise
a |
required |
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
The mass of the residue in Daltons. |
Source code in instanovo/utils/residues.py
tokenize(sequence)
Split a peptide represented as a string into a list of residues.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sequence |
str
|
The peptide to be split. |
required |
Returns:
Type | Description |
---|---|
list[str]
|
list[str]: The sequence of residues forming the peptide. |