[][src]Struct pdbtbx::Chain

pub struct Chain { /* fields omitted */ }

A Chain containing multiple Residues

Implementations

impl Chain[src]

pub fn new(id: char) -> Option<Chain>[src]

Create a new Chain

Arguments

  • id - the identifier

Fails

It fails if the identifier is an invalid character.

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

The ID of the Chain

pub fn set_id(&mut self, new_id: char) -> bool[src]

Set the ID of the Chain, returns false if the new id is an invalid character.

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

Get the amount of Residues making up this Chain

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

Get the amount of Atoms making up this Chain

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

Get a specific Residue from list of Residues making up this Chain.

Arguments

  • index - the index of the Residue

Fails

It fails when the index is outside bounds.

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

Get a specific Residue as a mutable reference from list of Residues making up this Chain.

Arguments

  • index - the index of the Residue

Fails

It fails when the index is outside bounds.

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

Get a specific Atom from the Atoms making up this Chain.

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 the Atoms making up this Chain.

Arguments

  • index - the index of the Atom

Fails

It fails when the index is outside bounds.

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

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

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

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

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

Get the list of Atoms making up this Chain. 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 Chain. Double ended so iterating from the end is just as fast as from the start.

pub fn add_atom(
    &mut self,
    new_atom: Atom,
    residue_serial_number: usize,
    residue_name: [char; 3]
)
[src]

Add a new Atom to this Chain. It finds if there already is a Residue with the given serial number if there is it will add this atom to that Residue, otherwise it will create a new Residue and add that to the list of Residues making up this 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.

pub fn add_residue(&mut self, residue: Residue)[src]

Add a Residue to the list of Residues making up this Chain. This does not detect any duplicates of names or serial numbers in the list of Residues.

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

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

Remove all residues matching the given predicate. As this is done in place this is the fastest way to remove Residues from this Chain.

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

Remove the Residue specified.

Arguments

  • index - the index of the Residue to remove

Panics

It panics when the index is outside bounds.

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

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

Arguments

  • serial_number - the serial number of the Residue to remove

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

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

Arguments

  • id - the id of the Residue to remove

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

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

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

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

Trait Implementations

impl Clone for Chain[src]

impl Debug for Chain[src]

impl Display for Chain[src]

impl PartialEq<Chain> for Chain[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.