pub struct Model { /* private fields */ }
Expand description
A Model containing multiple Chains.
Implementations§
source§impl<'a> Model
impl<'a> Model
sourcepub const fn serial_number(&self) -> usize
pub const fn serial_number(&self) -> usize
Get the serial number of this Model.
sourcepub fn set_serial_number(&mut self, new_number: usize)
pub fn set_serial_number(&mut self, new_number: usize)
Set the serial number of this Model.
sourcepub fn chain_count(&self) -> usize
pub fn chain_count(&self) -> usize
Get the number of Chains making up this Model.
sourcepub fn residue_count(&self) -> usize
pub fn residue_count(&self) -> usize
Get the number of Residues making up this Model.
sourcepub fn par_residue_count(&self) -> usize
Available on crate feature rayon
only.
pub fn par_residue_count(&self) -> usize
rayon
only.Get the number of Residues making up this Model in parallel.
sourcepub fn conformer_count(&self) -> usize
pub fn conformer_count(&self) -> usize
Get the number of Conformers making up this Model.
sourcepub fn par_conformer_count(&self) -> usize
Available on crate feature rayon
only.
pub fn par_conformer_count(&self) -> usize
rayon
only.Get the number of Conformers making up this Model in parallel.
sourcepub fn atom_count(&self) -> usize
pub fn atom_count(&self) -> usize
Get the number of Atoms making up this Model.
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 Model in parallel.
sourcepub fn residue_mut(&mut self, index: usize) -> Option<&mut Residue>
pub fn residue_mut(&mut self, index: usize) -> Option<&mut Residue>
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,
insertion_code: Option<&str>
) -> Option<AtomConformerResidueChain<'a>>
pub fn binary_find_atom( &'a self, serial_number: usize, insertion_code: Option<&str> ) -> Option<AtomConformerResidueChain<'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,
insertion_code: Option<&str>
) -> Option<AtomConformerResidueChainMut<'a>>
pub fn binary_find_atom_mut( &'a mut self, serial_number: usize, insertion_code: Option<&str> ) -> Option<AtomConformerResidueChainMut<'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 = AtomConformerResidueChain<'a>> + '_
pub fn find( &'a self, search: Search ) -> impl DoubleEndedIterator<Item = AtomConformerResidueChain<'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 = AtomConformerResidueChainMut<'a>> + '_
pub fn find_mut( &'a mut self, search: Search ) -> impl DoubleEndedIterator<Item = AtomConformerResidueChainMut<'a>> + '_
Find all hierarchies matching the given search. For more details see Search.
sourcepub fn chains(&self) -> impl DoubleEndedIterator<Item = &Chain> + '_
pub fn chains(&self) -> impl DoubleEndedIterator<Item = &Chain> + '_
Get an iterator of references to Chains making up this Model. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_chains(&self) -> impl ParallelIterator<Item = &Chain> + '_
Available on crate feature rayon
only.
pub fn par_chains(&self) -> impl ParallelIterator<Item = &Chain> + '_
rayon
only.Get a parallel iterator of references to Chains making up this Model.
sourcepub fn chains_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Chain> + '_
pub fn chains_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Chain> + '_
Get an iterator of mutable references to Chains making up this Model. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_chains_mut(
&mut self
) -> impl ParallelIterator<Item = &mut Chain> + '_
Available on crate feature rayon
only.
pub fn par_chains_mut( &mut self ) -> impl ParallelIterator<Item = &mut Chain> + '_
rayon
only.Get a parallel iterator of mutable references to Chains making up this Model.
sourcepub fn residues(&self) -> impl DoubleEndedIterator<Item = &Residue> + '_
pub fn residues(&self) -> impl DoubleEndedIterator<Item = &Residue> + '_
Get an iterator of references to Residues making up this Model. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_residues(&self) -> impl ParallelIterator<Item = &Residue> + '_
Available on crate feature rayon
only.
pub fn par_residues(&self) -> impl ParallelIterator<Item = &Residue> + '_
rayon
only.Get a parallel iterator of references to Residues making up this Model.
sourcepub fn residues_mut(
&mut self
) -> impl DoubleEndedIterator<Item = &mut Residue> + '_
pub fn residues_mut( &mut self ) -> impl DoubleEndedIterator<Item = &mut Residue> + '_
Get an iterator of mutable references to Residues making up this Model. Double ended so iterating from the end is just as fast as from the start.
sourcepub fn par_residues_mut(
&mut self
) -> impl ParallelIterator<Item = &mut Residue> + '_
Available on crate feature rayon
only.
pub fn par_residues_mut( &mut self ) -> impl ParallelIterator<Item = &mut Residue> + '_
rayon
only.Get a parallel iterator of mutable references to Residues making up this Model.
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 = AtomConformerResidueChain<'a>> + '_
pub fn atoms_with_hierarchy( &'a self ) -> impl DoubleEndedIterator<Item = AtomConformerResidueChain<'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 = AtomConformerResidueChainMut<'a>> + '_
pub fn atoms_with_hierarchy_mut( &'a mut self ) -> impl DoubleEndedIterator<Item = AtomConformerResidueChainMut<'a>> + '_
Get an iterator of mutable references to a struct containing all atoms with their hierarchy making up this Model.
sourcepub fn add_atom(
&mut self,
new_atom: Atom,
chain_id: impl AsRef<str>,
residue_id: (isize, Option<&str>),
conformer_id: (impl AsRef<str>, Option<&str>)
)
pub fn add_atom( &mut self, new_atom: Atom, chain_id: impl AsRef<str>, residue_id: (isize, Option<&str>), conformer_id: (impl AsRef<str>, Option<&str>) )
Add a new Atom to this Model. It finds if there already is a Chain with the given chain_id
if there is it will add this atom to that Chain, otherwise it will create a new Chain and add that to the list of Chains making up this Model. It does the same for the Residue, so it will create a new one if there does not yet exist a Residue with the given serial number.
Arguments
new_atom
- the new Atom to addchain_id
- the id of the Chain to add the Atom toresidue_id
- the id construct of the Residue to add the Atom toconformer_id
- the id construct of the Conformer to add the Atom to
Panics
It panics if the Chain ID or Residue ID contain any invalid characters.
sourcepub fn add_chain(&mut self, chain: Chain)
pub fn add_chain(&mut self, chain: Chain)
Add a Chain to the list of Chains making up this Model. This does not detect any duplicates of names or serial numbers in the list of Chains.
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 Model.
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 Model.
sourcepub fn remove_residues_by<F>(&mut self, predicate: F)where
F: Fn(&Residue) -> bool,
pub fn remove_residues_by<F>(&mut self, predicate: F)where F: Fn(&Residue) -> bool,
Remove all Residues matching the given predicate. As this is done in place this is the fastest way to remove Residues from this Model.
sourcepub fn remove_chains_by<F>(&mut self, predicate: F)where
F: Fn(&Chain) -> bool,
pub fn remove_chains_by<F>(&mut self, predicate: F)where F: Fn(&Chain) -> bool,
Remove all Chains matching the given predicate. As this is done in place this is the fastest way to remove Chains from this Model.
sourcepub fn remove_chain(&mut self, index: usize) -> Chain
pub fn remove_chain(&mut self, index: usize) -> Chain
sourcepub fn remove_chain_by_id(&mut self, id: impl AsRef<str>) -> bool
pub fn remove_chain_by_id(&mut self, id: impl AsRef<str>) -> bool
Remove the Chain specified. It returns true
if it found a matching Chain and removed it.
It removes the first matching Chain from the list.
Arguments
id
- the id of the Chain to remove
sourcepub fn par_remove_chain_by_id(&mut self, id: impl AsRef<str>) -> bool
Available on crate feature rayon
only.
pub fn par_remove_chain_by_id(&mut self, id: impl AsRef<str>) -> bool
rayon
only.Remove the Chain specified. It returns true
if it found a matching Chain and removed it.
It removes the first matching Chain from the list.
Done in parallel.
Arguments
id
- the id of the Chain to remove
sourcepub fn remove_empty(&mut self)
pub fn remove_empty(&mut self)
Remove all empty Chain from this Model, and all empty Residues from the Chains.
sourcepub fn par_remove_empty(&mut self)
Available on crate feature rayon
only.
pub fn par_remove_empty(&mut self)
rayon
only.Remove all empty Chain from this Model, and all empty Residues from the Chains in parallel.
sourcepub fn apply_transformation(&mut self, transformation: &TransformationMatrix)
pub fn apply_transformation(&mut self, transformation: &TransformationMatrix)
Apply a transformation to the position of all atoms making up this Model, 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 atoms making up this Model, the new position is immediately set. Done in parallel.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Model
impl<'de> Deserialize<'de> for Model
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<Chain> for Model
impl Extend<Chain> for Model
source§fn extend<T: IntoIterator<Item = Chain>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Chain>>(&mut self, iter: T)
Extend the Chains on this Model by the given iterator of Chains.
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<Model> for PDB
impl Extend<Model> for PDB
source§fn extend<T: IntoIterator<Item = Model>>(&mut self, iter: T)
fn extend<T: IntoIterator<Item = Model>>(&mut self, iter: T)
Extend the Models on this PDB by the given iterator of Models.
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 FromIterator<Model> for PDB
impl FromIterator<Model> for PDB
source§impl Ord for Model
impl Ord for Model
source§impl PartialEq<Model> for Model
impl PartialEq<Model> for Model
source§impl PartialOrd<Model> for Model
impl PartialOrd<Model> for Model
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 Model
impl StructuralEq for Model
impl StructuralPartialEq for Model
Auto Trait Implementations§
impl RefUnwindSafe for Model
impl Send for Model
impl Sync for Model
impl Unpin for Model
impl UnwindSafe for Model
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.