-
Notifications
You must be signed in to change notification settings - Fork 1
/
Craut.h
160 lines (132 loc) · 3.87 KB
/
Craut.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#pragma once
#include "Linker.h"
struct Helix;
struct Angle;
/**
An abstract base class for running CRAUT. To generate and rank linkers,
another class must extend this class and implement get_weight().
*/
class Craut
{
public:
/**
Given a path to a valid pdb file, and a character indicating
what subunit we want atoms from (e.g. 'A'), loads the given
file, storing the atoms, their names, and finds the N-terminus
and C-terminus. If one of these termini are not found, an
exception will be thrown.
*/
Craut(std::string pdb_filepath, char subunit, std::vector<Helix> helices, std::vector<Angle> angles);
/**
Sorts the generated linkers from lowest weight to greatest weight,
and prints them. If <num_to_print> is not -1, then the <num_to_print>
lowest weight linkers will be printed.
*/
void rank_and_print_linkers(int num_to_print = -1);
protected:
/**
stores atom positions from the pdb file
*/
std::vector<Eigen::Vector3d> atoms;
/**
In index into atoms, pointing to the N-terminus. This will be set
on construction of the class, and will be atoms.size() if it
is not found.
*/
int n_terminus_index;
/**
In index into atoms, pointing to the C-terminus. This will be set
on construction of the class, and will be -1 if it is not found.
*/
int c_terminus_index;
/**
Returns the distance between the N-terminus and the C-terminus
Precondition: the N-terminus and C-terminus were found, i.e.
n_terminus_index != atoms.size(), c_terminus_index != -1
*/
double termini_dist();
/**
The helices that can be used to construct linkers
*/
std::vector<Helix> helices;
/**
The angle segments that can be used to construct linkers
*/
std::vector<Angle> angles;
/**
The weight function used to rank linkers. Must be implemented
by a derived class.
*/
virtual double get_weight(Linker linker) =0;
/**
Returns a string of extra info about the weighing of a linker.
This will be printed right after the linker's sequence, on the same line.
*/
virtual std::string get_weighting_info(Linker linker);
/**
Returns the angle between the two helices in a linker
*/
double get_linker_angle(Linker linker);
/**
Stores the average position of all atoms.
Will be computed in compute_protein_centre(),
after the termini indices are computed.
*/
Eigen::Vector3d protein_centre;
/**
All linkers generated by this program are made with 2 helices.
When connecting the N-Terminus and C-Terminus with the 2 helices,
the linker forms a triangle. This function returns the point of
the triangle other than the termini.
*/
Eigen::Vector3d get_linker_tri_point(Linker linker);
private:
/**
Stores the names of the atoms (e.g. "N", "CA") corresponding
to the the atoms found in <atoms>. Will contain no whitespace.
*/
std::vector<std::string> atom_names;
/**
pdb files have lines containing 80 characters each. add 1 for new line character
*/
const static int PDB_LINE_SIZE = 81;
/**
string length of each of the x,y,z coordinates of an atom.
this totals 24 characters for all 3 coordinates
*/
const static int ATOM_COORD_LENGTH = 8;
/**
Loads all the atoms in a given pdb file into the <atoms> array
Loads only atoms that are in the given subunit
*/
void load_pdb(std::string filepath, char subunit);
/**
A list of linkers generated from all combinations of helices.
*/
std::vector<Linker> linkers;
/**
Used to find the closest angle building block to a given angle
*/
std::vector<double> angle_separators;
/**
Computes the indices in the atoms array for the N-Terminus and C-Terminus
*/
void init_termini();
/**
Initializes the <angle_separators> field
*/
void init_angle_separators();
/**
Generates all valid combinations of linkers, and stores
them in <linkers>
*/
void generate_linkers();
/**
Sorts all linkers by the weight function get_weight()
*/
void rank_linkers();
/**
Initializes the protein_centre field
*/
void compute_protein_centre();
};