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}
23
24/// Can be used to specify output resolution of SASA computation for convenience.
25#[derive(clap::ValueEnum, Clone, Default, Debug)]
26pub enum SASALevel {
27    Atom,
28    #[default]
29    Residue,
30    Chain,
31    Protein,
32}
33
34#[derive(Debug, PartialEq, Serialize)]
35pub struct ChainResult {
36    /// Chain name
37    pub name: String,
38    /// Chain SASA value
39    pub value: f32,
40}
41
42#[derive(Debug, PartialEq, Serialize)]
43pub struct ResidueResult {
44    /// Residue serial number
45    pub serial_number: isize,
46    /// SASA value for residue
47    pub value: f32,
48    //// The name of the residue
49    pub name: String,
50    /// Wether the residue is polar
51    pub is_polar: bool,
52    /// Chain ID
53    pub chain_id: String,
54}
55
56#[derive(Debug, PartialEq, Serialize)]
57pub struct ProteinResult {
58    /// The total SASA value for the entire protein
59    pub global_total: f32,
60    /// The total polar SASA value for the entire protein
61    pub polar_total: f32,
62    /// The total *non*-polar SASA value for the entire protein
63    pub non_polar_total: f32,
64}
65
66#[derive(Debug, PartialEq, Serialize)]
67pub enum SASAResult {
68    Atom(Vec<f32>),
69    Residue(Vec<ResidueResult>),
70    Chain(Vec<ChainResult>),
71    Protein(ProteinResult),
72}