rust_sasa/structures/
atomic.rs

1use nalgebra::Point3;
2use serde::Serialize;
3
4#[repr(C)]
5pub(crate) struct NeighborData {
6    pub(crate) threshold_squared: f32,
7    pub(crate) idx: u32,
8}
9
10/// This struct represents an individual Atom
11#[derive(Clone)]
12#[repr(C)]
13pub struct Atom {
14    /// The 3D position of the atom (12 bytes)
15    pub position: Point3<f32>,
16    /// The Van Der Walls radius of the atom (4 bytes)
17    pub radius: f32,
18    /// A unique Id for the atom (8 bytes)
19    pub id: usize,
20    /// Parent Id (8 bytes)
21    pub parent_id: Option<isize>,
22    /// Whether this atom is a hydrogen atom (1 byte + padding)
23    pub is_hydrogen: bool,
24}
25
26/// Can be used to specify output resolution of SASA computation for convenience.
27#[derive(clap::ValueEnum, Clone, Default, Debug)]
28pub enum SASALevel {
29    Atom,
30    #[default]
31    Residue,
32    Chain,
33    Protein,
34}
35
36#[derive(Debug, PartialEq, Serialize)]
37pub struct ChainResult {
38    /// Chain name
39    pub name: String,
40    /// Chain SASA value
41    pub value: f32,
42}
43
44#[derive(Debug, PartialEq, Serialize)]
45pub struct ResidueResult {
46    /// Residue serial number
47    pub serial_number: isize,
48    /// SASA value for residue
49    pub value: f32,
50    //// The name of the residue
51    pub name: String,
52    /// Whether the residue is polar
53    pub is_polar: bool,
54    /// Chain ID
55    pub chain_id: String,
56}
57
58#[derive(Debug, PartialEq, Serialize)]
59pub struct ProteinResult {
60    /// The total SASA value for the entire protein
61    pub global_total: f32,
62    /// The total polar SASA value for the entire protein
63    pub polar_total: f32,
64    /// The total *non*-polar SASA value for the entire protein
65    pub non_polar_total: f32,
66}
67
68#[derive(Debug, PartialEq, Serialize)]
69pub enum SASAResult {
70    Atom(Vec<f32>),
71    Residue(Vec<ResidueResult>),
72    Chain(Vec<ChainResult>),
73    Protein(ProteinResult),
74}