pub trait StructureFeatures {
// Required methods
fn decode_amino_acids(&self, device: &Device) -> Result<Tensor>;
fn encode_amino_acids(&self, device: &Device) -> Result<Tensor>;
fn create_cb(&self, device: &Device) -> Result<Tensor>;
fn featurize_lmpnn(&self, device: &Device) -> Result<ProteinFeatures>;
fn get_res_index(&self) -> Vec<u32>;
fn to_numeric_backbone_atoms(&self, device: &Device) -> Result<Tensor>;
fn to_numeric_atom37(&self, device: &Device) -> Result<Tensor>;
fn to_numeric_ligand_atoms(
&self,
device: &Device,
) -> Result<(Tensor, Tensor, Tensor)>;
}Expand description
. Trait defining Protein->Tensor utilities useful for Machine Learning
Required Methods§
Sourcefn decode_amino_acids(&self, device: &Device) -> Result<Tensor>
fn decode_amino_acids(&self, device: &Device) -> Result<Tensor>
Convert amino acid sequence to numeric representation
Sourcefn encode_amino_acids(&self, device: &Device) -> Result<Tensor>
fn encode_amino_acids(&self, device: &Device) -> Result<Tensor>
Convert amino acid sequence to numeric representation
Sourcefn create_cb(&self, device: &Device) -> Result<Tensor>
fn create_cb(&self, device: &Device) -> Result<Tensor>
Convert amino acid sequence to numeric representation
Sourcefn featurize_lmpnn(&self, device: &Device) -> Result<ProteinFeatures>
fn featurize_lmpnn(&self, device: &Device) -> Result<ProteinFeatures>
Prepare for ProteinMPNN
Sourcefn get_res_index(&self) -> Vec<u32>
fn get_res_index(&self) -> Vec<u32>
Get residue indices
Sourcefn to_numeric_backbone_atoms(&self, device: &Device) -> Result<Tensor>
fn to_numeric_backbone_atoms(&self, device: &Device) -> Result<Tensor>
Extract backbone atom coordinates (N, CA, C, O)
Sourcefn to_numeric_atom37(&self, device: &Device) -> Result<Tensor>
fn to_numeric_atom37(&self, device: &Device) -> Result<Tensor>
Extract all atom coordinates in standard ordering
Sourcefn to_numeric_ligand_atoms(
&self,
device: &Device,
) -> Result<(Tensor, Tensor, Tensor)>
fn to_numeric_ligand_atoms( &self, device: &Device, ) -> Result<(Tensor, Tensor, Tensor)>
Every ligand (non-amino-acid, non-water) heavy atom in the structure.
Returns (Y, Y_t, Y_m): coordinates (1, M, 3), atomic numbers
(1, M), and validity (1, M), for M ligand atoms across the whole
structure.
These are the raw atoms, not a per-residue context window. Which
ones a given residue sees depends on atom_context_num, a property of
the model checkpoint rather than of the structure, so that selection
belongs to the model’s featurizer — see
get_nearest_neighbours.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl StructureFeatures for AtomCollection
impl StructureFeatures for AtomCollection
Source§fn decode_amino_acids(&self, device: &Device) -> Result<Tensor>
fn decode_amino_acids(&self, device: &Device) -> Result<Tensor>
Decode amino acid integer indices back to one-letter codes as ASCII bytes.
This is the inverse of encode_amino_acids. It iterates over the amino acid
residues in the structure, converts each three-letter residue name to a
one-letter code, then encodes it as an integer via aa1to_int, decodes it
back via int_to_aa1, and returns the ASCII byte values in a tensor of
shape [1, n] where n is the number of amino acid residues.
Unknown residues map to the sentinel index 20, which decodes to 'X' (ASCII 88).
Source§fn encode_amino_acids(&self, device: &Device) -> Result<Tensor>
fn encode_amino_acids(&self, device: &Device) -> Result<Tensor>
Convert amino acid sequence to numeric representation
Source§fn get_res_index(&self) -> Vec<u32>
fn get_res_index(&self) -> Vec<u32>
Get residue indices
Source§fn to_numeric_backbone_atoms(&self, device: &Device) -> Result<Tensor>
fn to_numeric_backbone_atoms(&self, device: &Device) -> Result<Tensor>
create numeric Tensor of shape [1, sequence_length, 4, 3] where the 4 is N/CA/C/O
Source§fn to_numeric_atom37(&self, device: &Device) -> Result<Tensor>
fn to_numeric_atom37(&self, device: &Device) -> Result<Tensor>
create numeric Tensor of shape [1, sequence_length, 37, 3]
Source§fn to_numeric_ligand_atoms(
&self,
device: &Device,
) -> Result<(Tensor, Tensor, Tensor)>
fn to_numeric_ligand_atoms( &self, device: &Device, ) -> Result<(Tensor, Tensor, Tensor)>
Every ligand heavy atom in the structure, as raw per-atom tensors.
Waters are excluded, matching the reference featurizer: for 1BC8 this yields the 18-nucleotide DNA duplex plus two zinc ions — 406 atoms — and not the 161 crystallographic waters.
fn featurize_lmpnn(&self, device: &Device) -> Result<ProteinFeatures>
Source§impl StructureFeatures for Model
Delegate all StructureFeatures methods to an AtomCollection adapter.
impl StructureFeatures for Model
Delegate all StructureFeatures methods to an AtomCollection adapter.
This lets callers pass a &Model directly to ML featurisation routines
without manually calling AtomCollection::from(&model) at every call site.