rust_sasa/structures/
atomic.rs

1// Copyright (c) 2024 Maxwell Campbell. Licensed under the MIT License.
2#[cfg(feature = "serde")]
3use serde::{Deserialize, Serialize};
4
5#[derive(Clone, Copy)]
6#[repr(C)]
7pub struct NeighborData {
8    pub threshold_squared: f32,
9    pub idx: u32,
10}
11
12/// This struct represents an individual Atom
13#[derive(Clone)]
14#[repr(C)]
15pub struct Atom {
16    /// The 3D position of the atom (12 bytes)
17    pub position: [f32; 3],
18    /// The Van Der Walls radius of the atom (4 bytes)
19    pub radius: f32,
20    /// A unique Id for the atom (8 bytes)
21    pub id: usize,
22    /// Parent Id (8 bytes)
23    pub parent_id: Option<isize>,
24}
25
26#[derive(Debug, PartialEq)]
27#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
28pub struct ChainResult {
29    /// Chain name
30    pub name: String,
31    /// Chain SASA value
32    pub value: f32,
33}
34
35#[derive(Debug, PartialEq)]
36#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
37pub struct ResidueResult {
38    /// Residue serial number
39    pub serial_number: isize,
40    /// SASA value for residue
41    pub value: f32,
42    //// The name of the residue
43    pub name: String,
44    /// Whether the residue is polar
45    pub is_polar: bool,
46    /// Chain ID
47    pub chain_id: String,
48}
49
50#[derive(Debug, PartialEq)]
51#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
52pub struct ProteinResult {
53    /// The total SASA value for the entire protein
54    pub global_total: f32,
55    /// The total polar SASA value for the entire protein
56    pub polar_total: f32,
57    /// The total *non*-polar SASA value for the entire protein
58    pub non_polar_total: f32,
59}
60
61#[derive(Debug, PartialEq)]
62#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
63pub enum SASAResult {
64    Atom(Vec<f32>),
65    Residue(Vec<ResidueResult>),
66    Chain(Vec<ChainResult>),
67    Protein(ProteinResult),
68}