pub struct AtomCollection { /* private fields */ }Expand description
Atom Collection
The core data structure of ferritin-core.
it strives to be simple, high performance, and extensible using traits.
Implementations§
Source§impl AtomCollection
impl AtomCollection
pub fn new( size: usize, coords: Vec<[f32; 3]>, res_ids: Vec<i32>, res_names: Vec<String>, is_hetero: Vec<bool>, elements: Vec<Element>, atom_names: Vec<String>, chain_ids: Vec<String>, bonds: Option<Vec<Bond>>, ) -> Self
Sourcepub fn with_b_factor(self, values: Vec<f32>) -> Self
pub fn with_b_factor(self, values: Vec<f32>) -> Self
Attach per-atom B-factor (crystallographic) or pLDDT confidence values.
Used by the Uncertainty and PlddtConfidence color themes.
§Panics
Panics if values.len() != self.get_size().
Sourcepub fn with_occupancy(self, values: Vec<f32>) -> Self
pub fn with_occupancy(self, values: Vec<f32>) -> Self
Attach per-atom occupancy values (0.0-1.0). Used by the Occupancy color theme.
§Panics
Panics if values.len() != self.get_size().
pub fn get_b_factor(&self, idx: usize) -> Option<f32>
pub fn get_b_factors(&self) -> Option<&[f32]>
pub fn get_occupancy(&self, idx: usize) -> Option<f32>
pub fn get_occupancies(&self) -> Option<&[f32]>
pub fn calculate_chain_indices(&mut self)
pub fn connect_via_residue_names(&mut self)
pub fn get_size(&self) -> usize
pub fn get_atom_name(&self, idx: usize) -> &str
pub fn get_bonds(&self) -> Option<&Vec<Bond>>
pub fn get_chain_id(&self, idx: usize) -> &str
pub fn get_coord(&self, idx: usize) -> &[f32; 3]
pub fn get_coords(&self) -> &Vec<[f32; 3]>
pub fn get_element(&self, idx: usize) -> &Element
pub fn get_elements(&self) -> &Vec<Element>
pub fn get_is_hetero(&self, idx: usize) -> bool
pub fn get_resnames(&self) -> &[CompactString]
pub fn get_res_id(&self, idx: usize) -> &i32
pub fn get_resids(&self) -> &Vec<i32>
pub fn get_res_name(&self, idx: usize) -> &str
pub fn get_residue_start_indices(&self) -> Option<&Vec<usize>>
Sourcepub fn filter(&self, mask: &[bool]) -> AtomCollection
pub fn filter(&self, mask: &[bool]) -> AtomCollection
Filter atoms using a boolean mask, returning a new AtomCollection.
Bonds are remapped — only bonds where both endpoints survive the mask are kept, with indices adjusted to the new compact numbering.
§Panics
Panics if mask.len() != self.size.
Sourcepub fn select_chain(&self, chain_id: &str) -> Vec<bool>
pub fn select_chain(&self, chain_id: &str) -> Vec<bool>
Build a boolean mask selecting atoms belonging to chain_id.
Sourcepub fn select_hetero(&self) -> Vec<bool>
pub fn select_hetero(&self) -> Vec<bool>
Build a boolean mask selecting hetero atoms (ligands, solvent, etc.).
Sourcepub fn select_water(&self) -> Vec<bool>
pub fn select_water(&self) -> Vec<bool>
Build a boolean mask selecting solvent atoms (HOH, WAT, H2O).
Sourcepub fn select_ion(&self) -> Vec<bool>
pub fn select_ion(&self) -> Vec<bool>
Build a boolean mask selecting single-atom hetero residues that are not water (ions).
Sourcepub fn select_backbone(&self) -> Vec<bool>
pub fn select_backbone(&self) -> Vec<bool>
Build a boolean mask selecting backbone atoms (N, CA, C, O).
Sourcepub fn select_atom_name(&self, atom_name: &str) -> Vec<bool>
pub fn select_atom_name(&self, atom_name: &str) -> Vec<bool>
Build a boolean mask selecting atoms with atom_name.
Sourcepub fn select_residue_name(&self, res_name: &str) -> Vec<bool>
pub fn select_residue_name(&self, res_name: &str) -> Vec<bool>
Build a boolean mask selecting residues with res_name (e.g. "ALA").
pub fn iter_coords_and_elements( &self, ) -> impl Iterator<Item = (&[f32; 3], &Element)>
pub fn iter_chains(&self) -> impl Iterator<Item = ChainView<'_>>
pub fn iter_residues(&self) -> impl Iterator<Item = ResidueView<'_>>
Sourcepub fn iter_residues_aminoacid(&self) -> impl Iterator<Item = ResidueView<'_>>
pub fn iter_residues_aminoacid(&self) -> impl Iterator<Item = ResidueView<'_>>
Iterates over amino acid residues in the collection
Returns a filtered iterator that only includes standard amino acid residues
Trait Implementations§
Source§impl Clone for AtomCollection
impl Clone for AtomCollection
Source§fn clone(&self) -> AtomCollection
fn clone(&self) -> AtomCollection
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AtomCollection
impl RefUnwindSafe for AtomCollection
impl Send for AtomCollection
impl Sync for AtomCollection
impl Unpin for AtomCollection
impl UnsafeUnpin for AtomCollection
impl UnwindSafe for AtomCollection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more