The proto-Nucleic-Acid Builder (pNAB)
Chain.h
Go to the documentation of this file.
1 
5 #ifndef PNAB_CHAIN_H
6 #define PNAB_CHAIN_H
7 
8 #include <algorithm>
9 #include <openbabel/forcefield.h>
10 #include <openbabel/rotor.h>
11 #include <openbabel/generic.h>
12 #include <openbabel/obiter.h>
13 #include "Containers.h"
14 #define KJ_TO_KCAL 0.239006
15 
16 namespace PNAB {
17 
34  class Chain {
35 
36  public:
61  Chain(PNAB::Bases bases, const PNAB::Backbone &backbone, std::vector<std::string> strand,
62  std::string ff_type, std::array<unsigned, 2> &range, bool hexad,
63  std::vector<bool> build_strand = {true, false, false, false, false, false},
64  std::vector<bool> strand_orientation = {true, true, true, true, true, true},
65  double glycosidic_bond_distance = 0.0);
66 
70  ~Chain() {
71  for (auto v : v_base_coords_vec_) {
72  for (auto i : v)
73  delete[] i;
74  }
75  }
76 
100  PNAB::ConformerData generateConformerData(double *xyz, PNAB::HelicalParameters &hp, std::vector<double> energy_filter);
101 
102  private:
103  std::vector<OpenBabel::OBMol> v_chain_ = std::vector<OpenBabel::OBMol>(6);
104  OpenBabel::OBMol combined_chain_;
105  std::vector<std::vector<unsigned>> v_new_bond_ids_ = std::vector<std::vector<unsigned>>(6);
108  std::vector<std::vector<unsigned>> v_deleted_atoms_ids_ = std::vector<std::vector<unsigned>>(6);
111  std::vector<std::vector<unsigned>> v_num_bu_A_mol_atoms_ = std::vector<std::vector<unsigned>>(6);
114  std::vector<std::vector<std::vector<unsigned>>> v_fixed_bonds = std::vector<std::vector<std::vector<unsigned>>>(6);
117  std::vector<std::vector<double*>> v_base_coords_vec_ = std::vector<std::vector<double*>>(6);
120  unsigned chain_length_,
122  bool isKCAL_,
124  std::vector<bool> strand_orientation_;
126  OpenBabel::OBForceField *pFF_;
127  std::array<unsigned, 2> monomer_bb_index_range_;
128  std::vector<std::vector<unsigned>> v_bb_start_index_ = std::vector<std::vector<unsigned>>(6);
131  std::string ff_type_;
132  std::vector<std::vector<unsigned int>> all_angles_,
134  std::vector<bool> is_fixed_bond;
135  std::vector<bool> build_strand_;
136 
137  OpenBabel::OBFFConstraints constraintsBond_,
141 
157  void fillConformerEnergyData(double *xyz, PNAB::ConformerData &conf_data, std::vector<double> energy_filter);
158 
178  void setupChain(std::vector<PNAB::Base> &strand, OpenBabel::OBMol &chain, std::vector<unsigned> &new_bond_ids,
179  std::vector<unsigned> &deleted_atoms_ids, std::vector<unsigned> &num_base_unit_atoms,
180  std::vector<unsigned> &bb_start_index, std::vector<double *> &base_coords_vec,
181  std::vector<std::vector<unsigned>> &fixed_bonds_vec, const Backbone &backbone, unsigned chain_index);
206  void setupFFConstraints(OpenBabel::OBMol &chain, std::vector<unsigned> &new_bond_ids, std::vector<std::vector<unsigned>> &fixed_bonds_vec, unsigned offset = 0);
207 
229  void setCoordsForChain(double *xyz, double *conf, PNAB::HelicalParameters &hp, std::vector<unsigned> &num_bu_atoms,
230  std::vector<unsigned> &bb_start_index, std::vector<double *> &base_coords_vec,
231  std::vector<unsigned> &deleted_atoms_ids, unsigned chain_index);
232 
243  void orderResidues(OpenBabel::OBMol* molecule);
244  };
245 
246 }
247 
248 #endif //PNAB_CHAIN_H
jupyter_widgets.backbone
def backbone(param)
Main backbone widget for use in Jupyter notebook.
Definition: jupyter_widgets.py:264
PNAB::Chain::constraintsTot_
OpenBabel::OBFFConstraints constraintsTot_
An empty constraint object for van der Waals and total energy terms. No ignored atoms in these comput...
Definition: Chain.h:140
PNAB::Chain::constraintsAng_
OpenBabel::OBFFConstraints constraintsAng_
An empty constraint object for angles; Energy groups are used for the angle terms.
Definition: Chain.h:138
PNAB::Backbone
Class for holding backbone information.
Definition: Containers.h:333
PNAB::Chain::v_new_bond_ids_
std::vector< std::vector< unsigned > > v_new_bond_ids_
a vector containing a vector of the IDs of the atoms forming new bonds between the nucleotides in eac...
Definition: Chain.h:105
PNAB::Chain::setupChain
void setupChain(std::vector< PNAB::Base > &strand, OpenBabel::OBMol &chain, std::vector< unsigned > &new_bond_ids, std::vector< unsigned > &deleted_atoms_ids, std::vector< unsigned > &num_base_unit_atoms, std::vector< unsigned > &bb_start_index, std::vector< double * > &base_coords_vec, std::vector< std::vector< unsigned >> &fixed_bonds_vec, const Backbone &backbone, unsigned chain_index)
Creates the molecule for each strand in the system.
Definition: Chain.cpp:249
PNAB::Chain::~Chain
~Chain()
Destructor for the chain class.
Definition: Chain.h:70
PNAB::Bases
A class that contains a vector of all the defined bases and a funtion to return a base and the compli...
Definition: Containers.h:562
PNAB::Chain::glycosidic_bond_distance_
double glycosidic_bond_distance_
The distance of the glycosidic bond, RuntimeParameters::glycosidic_bond_distance.
Definition: Chain.h:125
PNAB::Chain::monomer_bb_index_range_
std::array< unsigned, 2 > monomer_bb_index_range_
Backbone index range for the first nucleotide.
Definition: Chain.h:127
PNAB::Chain::orderResidues
void orderResidues(OpenBabel::OBMol *molecule)
Orders the residues in the molecules correctly.
Definition: Chain.cpp:98
PNAB::Chain::strand_orientation_
std::vector< bool > strand_orientation_
A vector containing the orientation of each strand in the hexad, RuntimeParameters::strand_orientatio...
Definition: Chain.h:124
PNAB::Chain::v_num_bu_A_mol_atoms_
std::vector< std::vector< unsigned > > v_num_bu_A_mol_atoms_
A vector containing a vector of the number of atoms in each BaseUnit for each strand.
Definition: Chain.h:111
PNAB::Chain::v_bb_start_index_
std::vector< std::vector< unsigned > > v_bb_start_index_
A vector containing a vector of the starting indices of the backbone atoms in the BaseUnit for each s...
Definition: Chain.h:128
jupyter_widgets.bases
def bases(param)
Bases widget for use in Jupyter notebook.
Definition: jupyter_widgets.py:427
PNAB::Chain::pFF_
OpenBabel::OBForceField * pFF_
The openbabel force field. Used to compute the energy of the system.
Definition: Chain.h:126
PNAB::Chain::setCoordsForChain
void setCoordsForChain(double *xyz, double *conf, PNAB::HelicalParameters &hp, std::vector< unsigned > &num_bu_atoms, std::vector< unsigned > &bb_start_index, std::vector< double * > &base_coords_vec, std::vector< unsigned > &deleted_atoms_ids, unsigned chain_index)
Set the coordinates for each strand in the system.
Definition: Chain.cpp:506
PNAB::Chain::combined_chain_
OpenBabel::OBMol combined_chain_
An OpenBabel::OBMol molecule containing the structure of the whole system.
Definition: Chain.h:104
PNAB::Chain::hexad_
bool hexad_
Whether we are building a hexad, RuntimeParameters::is_hexad.
Definition: Chain.h:123
PNAB::Chain::all_torsions_
std::vector< std::vector< unsigned int > > all_torsions_
A vector of the vector of atom indices forming all the torsions for which we need to compute the ener...
Definition: Chain.h:133
PNAB::HelicalParameters
A class for holding values for all helical parameters.
Definition: Containers.h:171
Containers.h
A file for declaring various classes for defining options.
PNAB::Chain::setupFFConstraints
void setupFFConstraints(OpenBabel::OBMol &chain, std::vector< unsigned > &new_bond_ids, std::vector< std::vector< unsigned >> &fixed_bonds_vec, unsigned offset=0)
Determines the terms that should be ignored during the computation of the bond, angle,...
Definition: Chain.cpp:418
PNAB::Chain::chain_length_
unsigned chain_length_
The number of nucleotides in the strand.
Definition: Chain.h:120
PNAB::Chain::Chain
Chain(PNAB::Bases bases, const PNAB::Backbone &backbone, std::vector< std::string > strand, std::string ff_type, std::array< unsigned, 2 > &range, bool hexad, std::vector< bool > build_strand={true, false, false, false, false, false}, std::vector< bool > strand_orientation={true, true, true, true, true, true}, double glycosidic_bond_distance=0.0)
Constructor for the chain class.
Definition: Chain.cpp:11
PNAB::Chain::v_fixed_bonds
std::vector< std::vector< std::vector< unsigned > > > v_fixed_bonds
A vector containing the indices of fixed rotatable bonds for each strad.
Definition: Chain.h:114
PNAB::Chain::constraintsTor_
OpenBabel::OBFFConstraints constraintsTor_
An empty constraint object for torsions; Energy groups are used for the torsion terms.
Definition: Chain.h:139
PNAB
The PNAB name space contains all the C++ classes and functions for the proto-Nucleic Acid Builder.
Definition: binder.cpp:14
PNAB::ConformerData
Class to contain important information for an individual conformer.
Definition: Containers.h:725
PNAB::Chain::all_angles_
std::vector< std::vector< unsigned int > > all_angles_
A vector of the vector of atom indices forming all the angles for which we need to compute the energy...
Definition: Chain.h:132
PNAB::Chain::v_base_coords_vec_
std::vector< std::vector< double * > > v_base_coords_vec_
A vector containing a vector the coordinates of each nucleotide in each strand.
Definition: Chain.h:117
PNAB::Chain::generateConformerData
PNAB::ConformerData generateConformerData(double *xyz, PNAB::HelicalParameters &hp, std::vector< double > energy_filter)
Generate structure and energy data for nucleic acid conformers.
Definition: Chain.cpp:65
PNAB::Chain::constraintsBond_
OpenBabel::OBFFConstraints constraintsBond_
Setting all atoms not forming the new bond between the first two nucleotides to be ignored during bon...
Definition: Chain.h:137
PNAB::Chain::n_chains_
unsigned n_chains_
The number of strands in the system.
Definition: Chain.h:121
PNAB::Chain
A class for building nucleic acid strands and evaluating their energies.
Definition: Chain.h:34
PNAB::Chain::ff_type_
std::string ff_type_
The force field type (e.g. "GAFF"), RuntimeParameters::ff_type.
Definition: Chain.h:131
PNAB::Chain::is_fixed_bond
std::vector< bool > is_fixed_bond
A vector containing whether the torsional energy term is for a fixed rotatable bond or not.
Definition: Chain.h:134
PNAB::Chain::isKCAL_
bool isKCAL_
Whether the energy computed by openbabel is in kcal/mol.
Definition: Chain.h:122
PNAB::Chain::v_chain_
std::vector< OpenBabel::OBMol > v_chain_
A vector of OpenBabel::OBMol containing the molecules for each strand in the system.
Definition: Chain.h:103
PNAB::Chain::v_deleted_atoms_ids_
std::vector< std::vector< unsigned > > v_deleted_atoms_ids_
A vector containing a vector of the IDs of the atoms deleted in each strand because of the formation ...
Definition: Chain.h:108
PNAB::Chain::build_strand_
std::vector< bool > build_strand_
A vector containing whether a given strand should be built.
Definition: Chain.h:135
PNAB::Chain::fillConformerEnergyData
void fillConformerEnergyData(double *xyz, PNAB::ConformerData &conf_data, std::vector< double > energy_filter)
Computes the energy terms for the candidate system and determines whether it satisfies the energy thr...
Definition: Chain.cpp:130