pub struct AtomRecord {Show 15 fields
pub serial: u32,
pub name: String,
pub alt_loc: Option<char>,
pub res_name: String,
pub chain_id: Option<char>,
pub res_seq: i16,
pub i_code: Option<char>,
pub x: f32,
pub y: f32,
pub z: f32,
pub occupancy: f32,
pub temp_factor: f32,
pub element: Option<String>,
pub charge: Option<String>,
pub entry: Option<String>,
}Expand description
Represents an ATOM or HETATM record from a PDB file.
This structure contains all the information for an atom coordinate record, including position, occupancy, temperature factors, and identification data.
§PDB Format
ATOM records contain atomic coordinate data for standard amino acid and nucleic acid residues. HETATM records contain atomic coordinate data for non-standard residues, water molecules, and other hetero-compounds.
§Fields
serial: Atom serial number (1-99999, or hexadecimal for >99999)name: Atom name (e.g., “CA”, “N”, “O”)alt_loc: Alternative location indicatorres_name: Residue name (e.g., “ALA”, “GLY”, “HOH”)chain_id: Chain identifierres_seq: Residue sequence numberi_code: Insertion code for residuesx,y,z: Atomic coordinates in Ångströmsoccupancy: Occupancy value (0.0-1.0)temp_factor: Temperature factor (B-factor)element: Element symbolcharge: Formal chargeentry: PDB entry identifier
§Example
use knuckles_parse::records::atom::AtomRecord;
let line = "ATOM 1 N ALA A 1 20.154 16.967 27.462 1.00 11.18 N";
let atom = AtomRecord::from(line);
assert_eq!(atom.serial, 1);
assert_eq!(atom.name, "N");
assert_eq!(atom.res_name, "ALA");
assert_eq!(atom.x, 20.154);Fields§
§serial: u32Atom serial number (1-99999, or hexadecimal for larger values)
name: StringAtom name (e.g., “CA”, “N”, “O”)
alt_loc: Option<char>Alternative location indicator
res_name: StringResidue name (e.g., “ALA”, “GLY”, “HOH”)
chain_id: Option<char>Chain identifier
res_seq: i16Residue sequence number
i_code: Option<char>Insertion code for residues
x: f32X coordinate in Ångströms
y: f32Y coordinate in Ångströms
z: f32Z coordinate in Ångströms
occupancy: f32Occupancy value (0.0-1.0)
temp_factor: f32Temperature factor (B-factor)
element: Option<String>Element symbol
charge: Option<String>Formal charge
entry: Option<String>PDB entry identifier
Implementations§
Source§impl AtomRecord
impl AtomRecord
Sourcepub fn new(str: &str) -> AtomRecord
pub fn new(str: &str) -> AtomRecord
Create a new AtomRecord by parsing a PDB ATOM or HETATM line.
This method parses fixed-width fields according to the PDB format specification. It handles both decimal and hexadecimal serial numbers (for atoms > 99999).
§Arguments
str- A single ATOM or HETATM line from a PDB file
§Returns
A new AtomRecord with all fields parsed from the input line.
§Panics
Panics if required numeric fields cannot be parsed (coordinates, occupancy, etc.)
§Example
use knuckles_parse::records::atom::AtomRecord;
let line = "ATOM 1 N ALA A 1 20.154 16.967 27.462 1.00 11.18 N";
let atom = AtomRecord::new(line);
assert_eq!(atom.name, "N");Trait Implementations§
Source§impl Clone for AtomRecord
impl Clone for AtomRecord
Source§fn clone(&self) -> AtomRecord
fn clone(&self) -> AtomRecord
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AtomRecord
impl Debug for AtomRecord
Source§impl From<&str> for AtomRecord
impl From<&str> for AtomRecord
Source§impl PartialEq for AtomRecord
impl PartialEq for AtomRecord
impl StructuralPartialEq for AtomRecord
Auto Trait Implementations§
impl Freeze for AtomRecord
impl RefUnwindSafe for AtomRecord
impl Send for AtomRecord
impl Sync for AtomRecord
impl Unpin for AtomRecord
impl UnwindSafe for AtomRecord
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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