Skip to main content

molframe_pdb/mmtf/
model.rs

1//! MMTF-only metadata that the normalized structure model cannot express.
2
3/// Stable extension key for metadata required by lossless MMTF writing.
4pub const MMTF_METADATA_EXTENSION: &str = "molframe.mmtf.metadata.v1";
5
6/// Chemistry fields for one MMTF group dictionary entry.
7#[derive(Clone, Debug, PartialEq, Eq)]
8pub struct MmtfGroupMetadata {
9    /// Component identifier.
10    pub name: Box<str>,
11    /// Atom names used to verify that this dictionary entry still applies.
12    pub atom_names: Vec<Box<str>>,
13    /// Deposited element symbols, or absence of the complete optional list.
14    pub elements: Option<Vec<Box<str>>>,
15    /// Deposited one-letter code.
16    pub single_letter_code: Box<str>,
17    /// Deposited `PDBx` chemical component type.
18    pub chem_comp_type: Box<str>,
19}
20
21/// Metadata for one MMTF entity entry.
22#[derive(Clone, Debug, PartialEq, Eq)]
23pub struct MmtfEntityMetadata {
24    /// Description, including an explicitly empty description.
25    pub description: Box<str>,
26    /// Deposited MMTF entity type.
27    pub kind: Box<str>,
28    /// Deposited one-letter entity sequence.
29    pub sequence: Box<str>,
30}
31
32/// Source fields retained for faithful MMTF re-encoding.
33#[derive(Clone, Debug, Default, PartialEq, Eq)]
34pub struct MmtfMetadata {
35    /// Deposited space-group name.
36    pub space_group: Option<Box<str>>,
37    /// Group dictionary chemistry in source order.
38    pub groups: Vec<MmtfGroupMetadata>,
39    /// Entity metadata in source order.
40    pub entities: Vec<MmtfEntityMetadata>,
41    /// Optional columns present in the source document.
42    pub optional_fields: std::collections::BTreeSet<MmtfOptionalField>,
43}
44
45/// One optional top-level MMTF column.
46#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)]
47pub enum MmtfOptionalField {
48    /// Per-atom B factors.
49    BFactor,
50    /// Per-atom occupancies.
51    Occupancy,
52    /// Per-atom source identifiers.
53    AtomId,
54    /// Per-atom alternate locations.
55    AltLoc,
56    /// Per-group insertion codes.
57    InsCode,
58    /// Per-group canonical sequence indices.
59    SequenceIndex,
60    /// Per-chain author names.
61    ChainName,
62    /// Entity metadata and chain membership.
63    EntityList,
64}