Struct pdbtbx::Model

source ·
pub struct Model { /* private fields */ }
Expand description

A Model containing multiple Chains.

Implementations§

source§

impl<'a> Model

source

pub const fn new(serial_number: usize) -> Model

Create a new Model.

Arguments
  • serial_number - the serial number
source

pub fn from_iter( serial_number: usize, chains: impl Iterator<Item = Chain> ) -> Model

Create a new Model.

Arguments
  • serial_number - the serial number
source

pub const fn serial_number(&self) -> usize

Get the serial number of this Model.

source

pub fn set_serial_number(&mut self, new_number: usize)

Set the serial number of this Model.

source

pub fn chain_count(&self) -> usize

Get the number of Chains making up this Model.

source

pub fn residue_count(&self) -> usize

Get the number of Residues making up this Model.

source

pub fn par_residue_count(&self) -> usize

Available on crate feature rayon only.

Get the number of Residues making up this Model in parallel.

source

pub fn conformer_count(&self) -> usize

Get the number of Conformers making up this Model.

source

pub fn par_conformer_count(&self) -> usize

Available on crate feature rayon only.

Get the number of Conformers making up this Model in parallel.

source

pub fn atom_count(&self) -> usize

Get the number of Atoms making up this Model.

source

pub fn par_atom_count(&self) -> usize

Available on crate feature rayon only.

Get the number of Atoms making up this Model in parallel.

source

pub fn chain(&self, index: usize) -> Option<&Chain>

Get a reference to a specific Chain from list of Chains making up this Model.

Arguments
  • index - the index of the Chain
Fails

Returns None if the index is out of bounds.

source

pub fn chain_mut(&mut self, index: usize) -> Option<&mut Chain>

Get a mutable reference to a specific Chain reference from list of Chains making up this Model.

Arguments
  • index - the index of the Chain
Fails

Returns None if the index is out of bounds.

source

pub fn residue(&self, index: usize) -> Option<&Residue>

Get a reference to a specific Residue from the Residues making up this Model.

Arguments
  • index - the index of the Residue
Fails

Returns None if the index is out of bounds.

source

pub fn residue_mut(&mut self, index: usize) -> Option<&mut Residue>

Get a mutable reference to a specific Residue from the Residues making up this Model.

Arguments
  • index - the index of the Residue
Fails

Returns None if the index is out of bounds.

source

pub fn conformer(&self, index: usize) -> Option<&Conformer>

Get a reference to a specific Conformer from the Conformers making up this Model.

Arguments
  • index - the index of the Conformer
Fails

Returns None if the index is out of bounds.

source

pub fn conformer_mut(&mut self, index: usize) -> Option<&mut Conformer>

Get a mutable reference to a specific Conformer from the Conformers making up this Model.

Arguments
  • index - the index of the Conformer
Fails

Returns None if the index is out of bounds.

source

pub fn atom(&self, index: usize) -> Option<&Atom>

Get a reference to a specific Atom from the Atoms making up this Model.

Arguments
  • index - the index of the Atom
Fails

Returns None if the index is out of bounds.

source

pub fn atom_mut(&mut self, index: usize) -> Option<&mut Atom>

Get a mutable reference to a specific Atom from the Atoms making up this Model.

Arguments
  • index - the index of the Atom
Fails

Returns None if the index is out of bounds.

source

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().

source

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().

source

pub fn find( &'a self, search: Search ) -> impl DoubleEndedIterator<Item = AtomConformerResidueChain<'a>> + '_

Find all hierarchies matching the given search. For more details see Search.

source

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.

source

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.

source

pub fn par_chains(&self) -> impl ParallelIterator<Item = &Chain> + '_

Available on crate feature rayon only.

Get a parallel iterator of references to Chains making up this Model.

source

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.

source

pub fn par_chains_mut( &mut self ) -> impl ParallelIterator<Item = &mut Chain> + '_

Available on crate feature rayon only.

Get a parallel iterator of mutable references to Chains making up this Model.

source

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.

source

pub fn par_residues(&self) -> impl ParallelIterator<Item = &Residue> + '_

Available on crate feature rayon only.

Get a parallel iterator of references to Residues making up this Model.

source

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.

source

pub fn par_residues_mut( &mut self ) -> impl ParallelIterator<Item = &mut Residue> + '_

Available on crate feature rayon only.

Get a parallel iterator of mutable references to Residues making up this Model.

source

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.

source

pub fn par_conformers(&self) -> impl ParallelIterator<Item = &Conformer> + '_

Available on crate feature rayon only.

Get a parallel iterator of references to Conformers making up this Model.

source

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.

source

pub fn par_conformers_mut( &mut self ) -> impl ParallelIterator<Item = &mut Conformer> + '_

Available on crate feature rayon only.

Get a parallel iterator of mutable references to Conformers making up this Model.

source

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.

source

pub fn par_atoms(&self) -> impl ParallelIterator<Item = &Atom> + '_

Available on crate feature rayon only.

Get a parallel iterator of references to Atoms making up this Model.

source

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.

source

pub fn par_atoms_mut(&mut self) -> impl ParallelIterator<Item = &mut Atom> + '_

Available on crate feature rayon only.

Get a parallel iterator of mutable references to Atoms making up this Model.

source

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.

source

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.

source

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 add
  • chain_id - the id of the Chain to add the Atom to
  • residue_id - the id construct of the Residue to add the Atom to
  • conformer_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.

source

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.

source

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.

source

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.

source

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.

source

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.

source

pub fn remove_chain(&mut self, index: usize) -> Chain

Remove the Chain specified.

Arguments
  • index - the index of the Chain to remove
Panics

Panics if the index is out of bounds.

source

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
source

pub fn par_remove_chain_by_id(&mut self, id: impl AsRef<str>) -> bool

Available on crate feature 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
source

pub fn remove_empty(&mut self)

Remove all empty Chain from this Model, and all empty Residues from the Chains.

source

pub fn par_remove_empty(&mut self)

Available on crate feature rayon only.

Remove all empty Chain from this Model, and all empty Residues from the Chains in parallel.

source

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.

source

pub fn par_apply_transformation( &mut self, transformation: &TransformationMatrix )

Available on crate feature rayon only.

Apply a transformation to the position of all atoms making up this Model, the new position is immediately set. Done in parallel.

source

pub fn join(&mut self, other: Model)

Join this Model with another Model, this moves all atoms from the other Model to this Model. All other (meta) data of this Model will stay the same. It will add new Chains and Residues as defined in the other model.

source

pub fn sort(&mut self)

Sort the Chains of this Model.

source

pub fn par_sort(&mut self)

Available on crate feature rayon only.

Sort the Chains of this Model in parallel.

Trait Implementations§

source§

impl Clone for Model

source§

fn clone(&self) -> Model

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Model

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<'de> Deserialize<'de> for Model

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Display for Model

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Extend<Chain> for Model

source§

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)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl Extend<Model> for PDB

source§

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)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl FromIterator<Model> for PDB

source§

fn from_iter<T: IntoIterator<Item = Model>>(iter: T) -> Self

Creates a value from an iterator. Read more
source§

impl Ord for Model

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl PartialEq<Model> for Model

source§

fn eq(&self, other: &Model) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd<Model> for Model

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Serialize for Model

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for Model

source§

impl StructuralEq for Model

source§

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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<Q, K> Comparable<K> for Qwhere Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,