Enum Record

Source
pub enum Record {
Show 18 variants Anisou(AnisotropicRecord), Atom(AtomRecord), Connect(ConnectRecord), Crystal(CrystalRecord), DBRef(DBRefRecord), Het(HetRecord), Hetatm(AtomRecord), Hetnam(HetnamRecord), Nummdl(NummdlRecord), MtrixN(MtrixN), Model(ModelRecord), Modres(ModresRecord), OrigxN(OrigxN), ScaleN(ScaleN), Seqres(SeqresRecord), Seqadv(SeqAdvRecord), Term(TermRecord), Endmdl(),
}
Expand description

Represents all supported PDB record types.

This enum encompasses all the different types of records that can be found in a PDB file. Each variant contains the specific data structure for that record type.

§Record Types

  • Anisou - Anisotropic temperature factor records
  • Atom - Standard atom coordinate records
  • Connect - Connectivity records showing bonds between atoms
  • Crystal - Crystallographic unit cell parameters
  • DBRef - Database reference records
  • Het - Hetero-compound records
  • Hetatm - Hetero-atom coordinate records (uses same structure as Atom)
  • Hetnam - Hetero-compound name records
  • Nummdl - Number of models in the file
  • MtrixN - Transformation matrix records (N = 1, 2, or 3)
  • Model - Model records for multi-model structures
  • Modres - Modified residue records
  • OrigxN - Original coordinate system transformation (N = 1, 2, or 3)
  • ScaleN - Scale matrix records (N = 1, 2, or 3)
  • Seqres - Residue sequence records
  • Seqadv - Sequence differences from database
  • Term - Chain termination records
  • Endmdl - End of model marker (no associated data)

§Example

use knuckles_parse::records::Record;

let line = "ATOM      1  N   ALA A   1      20.154  16.967  27.462  1.00 11.18           N";
let record = Record::try_from(line).unwrap();

match record {
    Record::Atom(atom) => println!("Found atom: {}", atom.name),
    Record::Hetatm(hetatm) => println!("Found hetatm: {}", hetatm.name),
    _ => println!("Other record type"),
}

Variants§

§

Anisou(AnisotropicRecord)

Anisotropic temperature factor record

§

Atom(AtomRecord)

Standard atom coordinate record

§

Connect(ConnectRecord)

Connectivity record showing bonds between atoms

§

Crystal(CrystalRecord)

Crystallographic unit cell parameters

§

DBRef(DBRefRecord)

Database reference record

§

Het(HetRecord)

Hetero-compound record

§

Hetatm(AtomRecord)

Hetero-atom coordinate record (same structure as Atom)

§

Hetnam(HetnamRecord)

Hetero-compound name record

§

Nummdl(NummdlRecord)

Number of models record

§

MtrixN(MtrixN)

Transformation matrix record (MTRIX1, MTRIX2, or MTRIX3)

§

Model(ModelRecord)

Model record for multi-model structures

§

Modres(ModresRecord)

Modified residue record

§

OrigxN(OrigxN)

Original coordinate system transformation (ORIGX1, ORIGX2, or ORIGX3)

§

ScaleN(ScaleN)

Scale matrix record (SCALE1, SCALE2, or SCALE3)

§

Seqres(SeqresRecord)

Residue sequence record

§

Seqadv(SeqAdvRecord)

Sequence differences from database

§

Term(TermRecord)

Chain termination record

§

Endmdl()

End of model marker

Trait Implementations§

Source§

impl Debug for Record

Source§

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

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

impl Display for Record

Source§

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

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

impl TryFrom<&str> for Record

Source§

fn try_from(line: &str) -> Result<Self, Self::Error>

Parse a PDB line into the appropriate Record variant.

This method examines the first 6 characters of the line to determine the record type and then delegates to the appropriate record-specific parser.

§Arguments
  • line - A single line from a PDB file
§Returns
  • Ok(Record) - Successfully parsed record
  • Err(&'static str) - Error message if parsing failed
§Errors

Returns an error if:

  • The line is shorter than 6 characters
  • The record type is not recognized
  • The line format is invalid for the detected record type
§Example
use knuckles_parse::records::Record;

let line = "ATOM      1  N   ALA A   1      20.154  16.967  27.462  1.00 11.18           N";
let record = Record::try_from(line).unwrap();
Source§

type Error = &'static str

The type returned in the event of a conversion error.

Auto Trait Implementations§

§

impl Freeze for Record

§

impl RefUnwindSafe for Record

§

impl Send for Record

§

impl Sync for Record

§

impl Unpin for Record

§

impl UnwindSafe for Record

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where 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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

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

Source§

fn to_string(&self) -> String

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

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.