pub struct Residue { /* private fields */ }
Expand description
A Residue containing multiple Conformers
Implementations§
source§impl<'a> Residue
impl<'a> Residue
sourcepub fn new(
number: isize,
insertion_code: Option<&str>,
conformer: Option<Conformer>
) -> Option<Self>
pub fn new( number: isize, insertion_code: Option<&str>, conformer: Option<Conformer> ) -> Option<Self>
sourcepub const fn serial_number(&self) -> isize
pub const fn serial_number(&self) -> isize
Get the serial number of the Residue.
sourcepub fn set_serial_number(&mut self, new_number: isize)
pub fn set_serial_number(&mut self, new_number: isize)
Set the serial number of the Residue.
sourcepub fn insertion_code(&self) -> Option<&str>
pub fn insertion_code(&self) -> Option<&str>
Get the insertion code of the Residue.
sourcepub fn set_insertion_code(&mut self, new_code: impl AsRef<str>) -> bool
pub fn set_insertion_code(&mut self, new_code: impl AsRef<str>) -> bool
Set the insertion code of the Residue.
Fails and returns false if the new_code
contains invalid characters
sourcepub fn remove_insertion_code(&mut self)
pub fn remove_insertion_code(&mut self)
Set the insertion code of the Residue to None.
sourcepub fn id(&self) -> (isize, Option<&str>)
pub fn id(&self) -> (isize, Option<&str>)
Returns the uniquely identifying construct for this Residue, consisting of the serial number and the insertion code.
sourcepub fn name(&self) -> Option<&str>
pub fn name(&self) -> Option<&str>
The ID or name of the Residue, it will only give a value if there is only one conformer or if all conformers have the same name
sourcepub fn conformer_count(&self) -> usize
pub fn conformer_count(&self) -> usize
The number of Conformers making up this Residue.
sourcepub fn atom_count(&self) -> usize
pub fn atom_count(&self) -> usize
Get the number of Atoms making up this Residue.
sourcepub fn par_atom_count(&self) -> usize
Available on crate feature rayon
only.
pub fn par_atom_count(&self) -> usize
rayon
only.Get the number of Atoms making up this Residue in parallel.
sourcepub fn conformer_mut(&mut self, index: usize) -> Option<&mut Conformer>
pub fn conformer_mut(&mut self, index: usize) -> Option<&mut Conformer>
sourcepub fn binary_find_atom(
&'a self,
serial_number: usize,
alternative_location: Option<&str>
) -> Option<AtomConformer<'a>>
pub fn binary_find_atom( &'a self, serial_number: usize, alternative_location: Option<&str> ) -> Option<AtomConformer<'a>>
Get A reference to the specified Atom. Its uniqueness is guaranteed by including the
insertion_code
, with its full hierarchy. The algorithm is based
on binary search so it is faster than an exhaustive search, but the
full structure is assumed to be sorted. This assumption can be enforced
by using pdb.full_sort()
.
sourcepub fn binary_find_atom_mut(
&'a mut self,
serial_number: usize,
alternative_location: Option<&str>
) -> Option<AtomConformerMut<'a>>
pub fn binary_find_atom_mut( &'a mut self, serial_number: usize, alternative_location: Option<&str> ) -> Option<AtomConformerMut<'a>>
Get a mutable reference to the specified Atom. Its uniqueness is guaranteed by
including the insertion_code
, with its full hierarchy. The algorithm is based
on binary search so it is faster than an exhaustive search, but the
full structure is assumed to be sorted. This assumption can be enforced
by using pdb.full_sort()
.
sourcepub fn find(
&'a self,
search: Search
) -> impl DoubleEndedIterator<Item = AtomConformer<'a>> + '_
pub fn find( &'a self, search: Search ) -> impl DoubleEndedIterator<Item = AtomConformer<'a>> + '_
Find all hierarchies matching the given search. For more details see Search.
sourcepub fn find_mut(
&'a mut self,
search: Search
) -> impl DoubleEndedIterator<Item = AtomConformerMut<'a>> + '_
pub fn find_mut( &'a mut self, search: Search ) -> impl DoubleEndedIterator<Item = AtomConformerMut<'a>> + '_
Find all hierarchies matching the given search. For more details see Search.
sourcepub fn conformers(&self) -> impl DoubleEndedIterator<Item = &Conformer> + '_
pub fn conformers(&self) -> impl DoubleEndedIterator<Item = &Conformer> + '_
Get an iterator of references to Conformers making up this Model. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_conformers(&self) -> impl ParallelIterator<Item = &Conformer> + '_
Available on crate feature rayon
only.
pub fn par_conformers(&self) -> impl ParallelIterator<Item = &Conformer> + '_
rayon
only.Get a parallel iterator of references to Conformers making up this Model.
sourcepub fn conformers_mut(
&mut self
) -> impl DoubleEndedIterator<Item = &mut Conformer> + '_
pub fn conformers_mut( &mut self ) -> impl DoubleEndedIterator<Item = &mut Conformer> + '_
Get an iterator of mutable references to Conformers making up this Model. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_conformers_mut(
&mut self
) -> impl ParallelIterator<Item = &mut Conformer> + '_
Available on crate feature rayon
only.
pub fn par_conformers_mut( &mut self ) -> impl ParallelIterator<Item = &mut Conformer> + '_
rayon
only.Get a parallel iterator of mutable references to Conformers making up this Model.
sourcepub fn atoms(&self) -> impl DoubleEndedIterator<Item = &Atom> + '_
pub fn atoms(&self) -> impl DoubleEndedIterator<Item = &Atom> + '_
Get an iterator of references to Atoms making up this Model. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_atoms(&self) -> impl ParallelIterator<Item = &Atom> + '_
Available on crate feature rayon
only.
pub fn par_atoms(&self) -> impl ParallelIterator<Item = &Atom> + '_
rayon
only.Get a parallel iterator of references to Atoms making up this Model.
sourcepub fn atoms_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Atom> + '_
pub fn atoms_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Atom> + '_
Get an iterator of mutable references to Atoms making up this Model. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_atoms_mut(&mut self) -> impl ParallelIterator<Item = &mut Atom> + '_
Available on crate feature rayon
only.
pub fn par_atoms_mut(&mut self) -> impl ParallelIterator<Item = &mut Atom> + '_
rayon
only.Get a parallel iterator of mutable references to Atoms making up this Model.
sourcepub fn atoms_with_hierarchy(
&'a self
) -> impl DoubleEndedIterator<Item = AtomConformer<'a>> + '_
pub fn atoms_with_hierarchy( &'a self ) -> impl DoubleEndedIterator<Item = AtomConformer<'a>> + '_
Get an iterator of references to a struct containing all atoms with their hierarchy making up this Model.
sourcepub fn atoms_with_hierarchy_mut(
&'a mut self
) -> impl DoubleEndedIterator<Item = AtomConformerMut<'a>> + '_
pub fn atoms_with_hierarchy_mut( &'a mut self ) -> impl DoubleEndedIterator<Item = AtomConformerMut<'a>> + '_
Get an iterator of mutable references to a struct containing all atoms with their hierarchy making up this Model.
sourcepub fn add_conformer(&mut self, new_conformer: Conformer)
pub fn add_conformer(&mut self, new_conformer: Conformer)
Add a new conformer to the list of conformers making up this Residue.
Arguments
new_conformer
- the new conformer to add
sourcepub fn add_atom(
&mut self,
new_atom: Atom,
conformer_id: (impl AsRef<str>, Option<&str>)
)
pub fn add_atom( &mut self, new_atom: Atom, conformer_id: (impl AsRef<str>, Option<&str>) )
Add a new Atom to this Residue. If a Residue with the given serial number already exists, the Atom will be added to it, otherwise a new Residue is created to hold the created atom and added to the list of Residues in its chain.
Arguments
new_atom
- the new Atom to addresidue_serial_number
- the serial number of the Residue to add the Atom toresidue_name
- the name of the Residue to add the Atom to, only used to create a new Residue if needed
Panics
It panics if the Residue name contains any invalid characters.
sourcepub fn remove_empty(&mut self)
pub fn remove_empty(&mut self)
Remove all empty Conformers from this Residue.
sourcepub fn remove_conformers_by<F>(&mut self, predicate: F)where
F: Fn(&Conformer) -> bool,
pub fn remove_conformers_by<F>(&mut self, predicate: F)where F: Fn(&Conformer) -> bool,
Remove all conformers matching the given predicate. As this is done in place this is the fastest way to remove conformers from this Residue.
sourcepub fn remove_atoms_by<F>(&mut self, predicate: F)where
F: Fn(&Atom) -> bool,
pub fn remove_atoms_by<F>(&mut self, predicate: F)where F: Fn(&Atom) -> bool,
Remove all atoms matching the given predicate. As this is done in place this is the fastest way to remove atoms from this Residue.
sourcepub fn remove_conformer(&mut self, index: usize)
pub fn remove_conformer(&mut self, index: usize)
sourcepub fn par_remove_conformer_by_id(&mut self, id: (&str, Option<&str>)) -> bool
Available on crate feature rayon
only.
pub fn par_remove_conformer_by_id(&mut self, id: (&str, Option<&str>)) -> bool
rayon
only.sourcepub fn apply_transformation(&mut self, transformation: &TransformationMatrix)
pub fn apply_transformation(&mut self, transformation: &TransformationMatrix)
Apply a transformation to the position of all Conformers making up this Residue, the new position is immediately set.
sourcepub fn par_apply_transformation(
&mut self,
transformation: &TransformationMatrix
)
Available on crate feature rayon
only.
pub fn par_apply_transformation( &mut self, transformation: &TransformationMatrix )
rayon
only.Apply a transformation to the position of all Conformers making up this Residue, the new position is immediately set. Done in parallel
Trait Implementations§
source§impl<'de> Deserialize<'de> for Residue
impl<'de> Deserialize<'de> for Residue
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl Extend<Conformer> for Residue
impl Extend<Conformer> for Residue
source§fn extend<T: IntoIterator<Item = Conformer>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Conformer>>(&mut self, iter: T)
Extend the Conformers on this Residue by the given iterator.
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl Extend<Residue> for Chain
impl Extend<Residue> for Chain
source§fn extend<T: IntoIterator<Item = Residue>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Residue>>(&mut self, iter: T)
Extend the Residues on this Chain by the given iterator of Residues.
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl Ord for Residue
impl Ord for Residue
source§impl PartialEq<Residue> for Residue
impl PartialEq<Residue> for Residue
source§impl PartialOrd<Residue> for Residue
impl PartialOrd<Residue> for Residue
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Residue
impl StructuralEq for Residue
impl StructuralPartialEq for Residue
Auto Trait Implementations§
impl RefUnwindSafe for Residue
impl Send for Residue
impl Sync for Residue
impl Unpin for Residue
impl UnwindSafe for Residue
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
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.