Struct pdbtbx::Residue

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

A Residue containing multiple Conformers

Implementations§

source§

impl<'a> Residue

source

pub fn new( number: isize, insertion_code: Option<&str>, conformer: Option<Conformer> ) -> Option<Self>

Create a new Residue

Arguments
  • number - the serial number
  • insertion_code - the insertion code
  • conformer - if available it can already add an conformer
Fails

It fails and returns None if any of the characters making up the insertion_code are invalid.

source

pub const fn serial_number(&self) -> isize

Get the serial number of the Residue.

source

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

Set the serial number of the Residue.

source

pub fn insertion_code(&self) -> Option<&str>

Get the insertion code of the Residue.

source

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

source

pub fn remove_insertion_code(&mut self)

Set the insertion code of the Residue to None.

source

pub fn id(&self) -> (isize, Option<&str>)

Returns the uniquely identifying construct for this Residue, consisting of the serial number and the insertion code.

source

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

source

pub fn conformer_count(&self) -> usize

The number of Conformers making up this Residue.

source

pub fn atom_count(&self) -> usize

Get the number of Atoms making up this Residue.

source

pub fn par_atom_count(&self) -> usize

Available on crate feature rayon only.

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

source

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

Get a reference to a specific Conformer from the list of Conformers making up this Residue.

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 list of Conformers making up this Residue.

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 list of Conformers making up this Residue.

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 list of Conformers making up this Residue.

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

source

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

source

pub fn find( &'a self, search: Search ) -> impl DoubleEndedIterator<Item = AtomConformer<'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 = AtomConformerMut<'a>> + '_

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

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 = AtomConformer<'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 = AtomConformerMut<'a>> + '_

Get an iterator of mutable references to a struct containing all atoms with their hierarchy making up this Model.

source

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
source

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 add
  • residue_serial_number - the serial number of the Residue to add the Atom to
  • residue_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.

source

pub fn remove_empty(&mut self)

Remove all empty Conformers from this Residue.

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 Residue.

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 Residue.

source

pub fn remove_conformer(&mut self, index: usize)

Remove the specified conformer.

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

Panics when the index is outside bounds.

source

pub fn remove_conformer_by_id(&mut self, id: (&str, Option<&str>)) -> bool

Remove the specified conformer. Returns true if a matching Conformer was found and removed. Removes the first matching Conformer from the list.

Arguments
  • id - the identifying construct of the Conformer to remove
Panics

Panics when the index is outside bounds.

source

pub fn par_remove_conformer_by_id(&mut self, id: (&str, Option<&str>)) -> bool

Available on crate feature rayon only.

Remove the specified Conformer. Returns true if a matching Conformer was found and removed. It removes the first matching Conformer from the list. Searching is done in parallel.

Arguments
  • id - the identifying construct of the Conformer to remove
Panics

Panics when the index is outside bounds.

source

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.

source

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

Available on crate feature rayon only.

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

source

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

Join this Residue with another Residue, this moves all Conformers from the other Residue to this Residue. All other (meta) data of this Residue will stay the same.

source

pub fn sort(&mut self)

Sort the Conformers of this Residue

source

pub fn par_sort(&mut self)

Available on crate feature rayon only.

Sort the Conformers of this Residue in parallel

Trait Implementations§

source§

impl Clone for Residue

source§

fn clone(&self) -> Residue

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 Residue

source§

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

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

impl<'de> Deserialize<'de> for Residue

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 Residue

source§

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

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

impl Extend<Conformer> for Residue

source§

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)

🔬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<Residue> for Chain

source§

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)

🔬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 Ord for Residue

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<Residue> for Residue

source§

fn eq(&self, other: &Residue) -> 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<Residue> for Residue

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 Residue

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 Residue

source§

impl StructuralEq for Residue

source§

impl StructuralPartialEq for Residue

Auto Trait Implementations§

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>,