pulsatrix 1.1.0
Loading...
Searching...
No Matches
protein_structure.hpp
Go to the documentation of this file.
1
6#pragma once
7
8#include <cstdint>
9#include <map>
10#include <optional>
11#include <string>
12#include <string_view>
13#include <vector>
14
15namespace pulsatrix {
16
18struct Point3 {
19 double x = 0, y = 0, z = 0;
20};
21
25 std::string name;
28 char code = 'X';
30 int64_t number = 0;
31 char insertion_code = ' ';
33 std::map<std::string, Point3> atoms;
34
35 [[nodiscard]] std::optional<Point3> atom(const std::string& atom_name) const;
36};
37
41 std::string id;
42 std::vector<StructureResidue> residues;
43
46 [[nodiscard]] std::string sequence() const;
47};
48
51 std::vector<StructureChain> chains;
52
54 [[nodiscard]] const StructureChain& chain(std::string_view id) const;
55};
56
65[[nodiscard]] ProteinStructure ParsePdb(std::string_view text);
66
74[[nodiscard]] ProteinStructure ParseMmcif(std::string_view text);
75
81[[nodiscard]] ProteinStructure ReadStructure(const std::string& path);
82
85struct ContactMap {
86 int64_t length = 0;
87 std::vector<float> values;
88
89 [[nodiscard]] float at(int64_t i, int64_t j) const { return values[static_cast<size_t>(i * length + j)]; }
90};
91
93enum class ContactAtom {
95 Beta,
97 Alpha,
103};
104
110
115[[nodiscard]] ContactMap TrueContacts(const StructureChain& chain, double threshold = 8.0, ContactAtom atom = ContactAtom::Beta);
116
117} // namespace pulsatrix
Definition acquisition_functions.hpp:16
ProteinStructure ParsePdb(std::string_view text)
Reads PDB-format text: the ATOM records, and the HETATM records of selenomethionine,...
ProteinStructure ParseMmcif(std::string_view text)
Reads mmCIF text: the _atom_site loop, with the same choices as ParsePdb. Chains and residue numbers ...
ContactAtom
Which atom stands for a residue in residue distances.
Definition protein_structure.hpp:93
@ Beta
Cβ, or Cα for glycine (CASP's definition).
@ VirtualBeta
A Cβ placed from the backbone (N, Cα, C) with ideal geometry, for every residue, glycine included....
ContactMap TrueContacts(const StructureChain &chain, double threshold=8.0, ContactAtom atom=ContactAtom::Beta)
True contacts: 1 where two residues are closer than threshold (8 Å by convention),...
ProteinStructure ReadStructure(const std::string &path)
Reads a structure file: mmCIF for .cif or .mmcif, PDB format otherwise (.pdb, .ent).
ContactMap ResidueDistances(const StructureChain &chain, ContactAtom atom=ContactAtom::Beta)
Distances between the residues of chain, in Ångström, L x L for its L residues. A residue missing the...
A square matrix over a sequence's residue pairs, row-major: predicted contact probabilities,...
Definition protein_structure.hpp:85
int64_t length
Definition protein_structure.hpp:86
float at(int64_t i, int64_t j) const
Definition protein_structure.hpp:89
std::vector< float > values
Definition protein_structure.hpp:87
A position in Ångström.
Definition protein_structure.hpp:18
double z
Definition protein_structure.hpp:19
double x
Definition protein_structure.hpp:19
double y
Definition protein_structure.hpp:19
The protein chains of a structure's first model.
Definition protein_structure.hpp:50
const StructureChain & chain(std::string_view id) const
std::vector< StructureChain > chains
Definition protein_structure.hpp:51
A chain's residues, in file order.
Definition protein_structure.hpp:39
std::string id
The author's chain id (auth_asym_id), as in a PDB file.
Definition protein_structure.hpp:41
std::vector< StructureResidue > residues
Definition protein_structure.hpp:42
std::string sequence() const
The residues' one-letter codes. Residues without coordinates in the file aren't here,...
One residue of a chain and its atoms.
Definition protein_structure.hpp:23
int64_t number
The author's residue number (auth_seq_id), and its insertion code, or ' '.
Definition protein_structure.hpp:30
char insertion_code
Definition protein_structure.hpp:31
std::optional< Point3 > atom(const std::string &atom_name) const
std::string name
The three-letter name, such as ALA or MSE.
Definition protein_structure.hpp:25
std::map< std::string, Point3 > atoms
Atoms by name (CA, CB, ...). With alternate locations, the first one listed.
Definition protein_structure.hpp:33
char code
The one-letter code: the 20 standard amino acids, M for selenomethionine (MSE), U and O for selenocys...
Definition protein_structure.hpp:28