[][src]Struct pdbtbx::Residue

pub struct Residue { /* fields omitted */ }

A Residue containing multiple atoms

Implementations

impl Residue[src]

pub fn new(
    number: usize,
    name: [char; 3],
    atom: Option<Atom>
) -> Option<Residue>
[src]

Create a new Residue

Arguments

  • number - the serial number
  • name - the name or id
  • atom - if available it can already add an atom

Fails

It fails if any of the characters making up the name are invalid.

pub fn id(&self) -> String[src]

The ID or name of the Residue

pub fn id_array(&self) -> [char; 3][src]

The ID or name of the Residue, as a char array

pub fn set_id(&mut self, new_id: &str) -> Result<(), String>[src]

Set the ID or name of the Residue

Fails

It fails if any of the characters of the new name are invalid. It also fails if the new name is longer than allowed, the max length is 3 characters.

pub fn serial_number(&self) -> usize[src]

The serial number of the Residue

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

Set the serial number of the Residue

pub fn atom_count(&self) -> usize[src]

The amount of atoms making up this Residue

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

Get a specific atom from list of atoms making up this Residue.

Arguments

  • index - the index of the atom

Fails

It fails when the index is outside bounds.

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

Get a specific atom as a mutable reference from list of atoms making up this Residue.

Arguments

  • index - the index of the atom

Fails

It fails when the index is outside bounds.

pub fn atoms(&self) -> impl DoubleEndedIterator<Item = &Atom> + '_[src]

Get the list of atoms making up this Residue. Double ended so iterating from the end is just as fast as from the start.

pub fn atoms_mut(&mut self) -> impl DoubleEndedIterator<Item = &mut Atom> + '_[src]

Get the list of atoms as mutable references making up this Residue. Double ended so iterating from the end is just as fast as from the start.

pub fn add_atom(&mut self, new_atom: Atom)[src]

Add a new atom to the list of atoms making up this Residue.

Arguments

  • new_atom - the new Atom to add

pub fn amino_acid(&self) -> bool[src]

Returns if this Residue is an amino acid

pub fn remove_atoms_by<F>(&mut self, predicate: F) where
    F: Fn(&Atom) -> bool
[src]

Remove all Atoms matching the given predicate. As this is done in place this is the fastest way to remove Atoms from this Residue.

pub fn remove_atom(&mut self, index: usize)[src]

Remove the Atom specified.

Arguments

  • index - the index of the atom to remove

Panics

It panics when the index is outside bounds.

pub fn remove_atom_serial_number(&mut self, serial_number: usize) -> bool[src]

Remove the Atom specified. It returns true if it found a matching Atom and removed it. It removes the first matching Atom from the list.

Arguments

  • serial_number - the serial number of the Atom to remove

Panics

It panics when the index is outside bounds.

pub fn remove_atom_name(&mut self, name: String) -> bool[src]

Remove the Atom specified. It returns true if it found a matching Atom and removed it. It removes the first matching Atom from the list.

Arguments

  • name - the name of the Atom to remove

Panics

It panics when the index is outside bounds.

pub fn apply_transformation(&mut self, transformation: &TransformationMatrix)[src]

Apply a transformation to the position of all atoms making up this Residue, the new position is immediately set.

pub fn join(&mut self, other: Residue)[src]

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

Trait Implementations

impl Clone for Residue[src]

impl Debug for Residue[src]

impl Display for Residue[src]

impl PartialEq<Residue> for Residue[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.