The proto-Nucleic-Acid Builder (pNAB)
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PNAB::Chain Class Reference

A class for building nucleic acid strands and evaluating their energies. More...

#include <Chain.h>

Public Member Functions

 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. More...
 
 ~Chain ()
 Destructor for the chain class. More...
 
PNAB::ConformerData generateConformerData (double *xyz, PNAB::HelicalParameters &hp, std::vector< double > energy_filter)
 Generate structure and energy data for nucleic acid conformers. More...
 

Private Member Functions

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 thresholds. More...
 
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. More...
 
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, and torsional energies. More...
 
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. More...
 
void orderResidues (OpenBabel::OBMol *molecule)
 Orders the residues in the molecules correctly. More...
 

Private Attributes

std::vector< OpenBabel::OBMol > v_chain_ = std::vector<OpenBabel::OBMol>(6)
 A vector of OpenBabel::OBMol containing the molecules for each strand in the system. More...
 
OpenBabel::OBMol combined_chain_
 An OpenBabel::OBMol molecule containing the structure of the whole system. More...
 
std::vector< std::vector< unsigned > > v_new_bond_ids_ = std::vector<std::vector<unsigned>>(6)
 a vector containing a vector of the IDs of the atoms forming new bonds between the nucleotides in each strand More...
 
std::vector< std::vector< unsigned > > v_deleted_atoms_ids_ = std::vector<std::vector<unsigned>>(6)
 A vector containing a vector of the IDs of the atoms deleted in each strand because of the formation of new bonds. More...
 
std::vector< std::vector< unsigned > > v_num_bu_A_mol_atoms_ = std::vector<std::vector<unsigned>>(6)
 A vector containing a vector of the number of atoms in each BaseUnit for each strand. More...
 
std::vector< std::vector< std::vector< unsigned > > > v_fixed_bonds = std::vector<std::vector<std::vector<unsigned>>>(6)
 A vector containing the indices of fixed rotatable bonds for each strad. More...
 
std::vector< std::vector< double * > > v_base_coords_vec_ = std::vector<std::vector<double*>>(6)
 A vector containing a vector the coordinates of each nucleotide in each strand. More...
 
unsigned chain_length_
 The number of nucleotides in the strand. More...
 
unsigned n_chains_
 The number of strands in the system. More...
 
bool isKCAL_
 Whether the energy computed by openbabel is in kcal/mol. More...
 
bool hexad_
 Whether we are building a hexad, RuntimeParameters::is_hexad. More...
 
std::vector< bool > strand_orientation_
 A vector containing the orientation of each strand in the hexad, RuntimeParameters::strand_orientation. More...
 
double glycosidic_bond_distance_
 The distance of the glycosidic bond, RuntimeParameters::glycosidic_bond_distance. More...
 
OpenBabel::OBForceField * pFF_
 The openbabel force field. Used to compute the energy of the system. More...
 
std::array< unsigned, 2 > monomer_bb_index_range_
 Backbone index range for the first nucleotide. More...
 
std::vector< std::vector< unsigned > > v_bb_start_index_ = std::vector<std::vector<unsigned>>(6)
 A vector containing a vector of the starting indices of the backbone atoms in the BaseUnit for each strand. More...
 
std::string ff_type_
 The force field type (e.g. "GAFF"), RuntimeParameters::ff_type. More...
 
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. More...
 
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 energy. More...
 
std::vector< bool > is_fixed_bond
 A vector containing whether the torsional energy term is for a fixed rotatable bond or not. More...
 
std::vector< bool > build_strand_
 A vector containing whether a given strand should be built. More...
 
OpenBabel::OBFFConstraints constraintsBond_
 Setting all atoms not forming the new bond between the first two nucleotides to be ignored during bond energy computation. More...
 
OpenBabel::OBFFConstraints constraintsAng_
 An empty constraint object for angles; Energy groups are used for the angle terms. More...
 
OpenBabel::OBFFConstraints constraintsTor_
 An empty constraint object for torsions; Energy groups are used for the torsion terms. More...
 
OpenBabel::OBFFConstraints constraintsTot_
 An empty constraint object for van der Waals and total energy terms. No ignored atoms in these computations. More...
 

Detailed Description

A class for building nucleic acid strands and evaluating their energies.

The class creates the strands by connecting the nucleotides created in the BaseUnit class. It forms bonds between the nucleotides for the given sequence of the nucleobases, and creates duplex or hexad systems if requested. The class also contains functions for computing the energy terms for the system and checking whether the candidates are accepted. Several functions in the class identifies the proper energy terms to be computed for the system (e.g. bond and angle energies).

See also
ConformationSearch
HelicalParameters
RuntimeParameters
BaseUnit
Bases

Constructor & Destructor Documentation

◆ 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.

The constructor performs several tasks. It creates an OpenBabel::ForceField object and check that it works as expected. It identifies whether we are working with the canonical nucleobases or with the hexad. For double-stranded and hexad systems, it checks whether the user provided correct comlimentary bases. After all these checks, it proceeds to setup the requested molecules. The constructor does not put correct coordinates for the molecules, but creates the topology of each strand in the system. The constructor also identifies the atoms that should be ignored when computing the separate energies (e.g. bond energy) for the backbone candidates.

Parameters
basesA vector of the all the defined bases,
backboneThe backbone
strandA vector of the names of all bases in the strand, RuntimeParameters::strand
ff_typeThe force field type, RuntimeParameters::ff_type
rangeBackbone index range for the first nucleotide
hexadDefines whether the 60 degrees rotation for hexads is performed, RuntimeParameters::is_hexad
build_strandDefines whether to build a given strand, RuntimeParameters::build_strand
strand_orientationThe orientation of each strand in the hexad, RuntimeParameters::strand_orientation
glycosidic_bond_distanceThe distance of the glycosidic bond, RuntimeParameters::glycosidic_bond_distance
See also
setupChain
setupFFConstraints

◆ ~Chain()

PNAB::Chain::~Chain ( )
inline

Destructor for the chain class.

Member Function Documentation

◆ fillConformerEnergyData()

void Chain::fillConformerEnergyData ( double *  xyz,
PNAB::ConformerData conf_data,
std::vector< double >  energy_filter 
)
private

Computes the energy terms for the candidate system and determines whether it satisfies the energy thresholds.

This function uses openbabel to compute the energy for the candidate systems. See the description in setupFFConstraints for the bond, angle, and torsional energies terms. The van der Waals and total energy terms of the systems are computed without any constraints. The energy terms are computed sequentially as follows: bond, angle, torsion, van der Waals, and total energies. If any one of the energy terms does not satisfy the energy thresholds defined in RuntimeParameters::energy_filter, then the candidate is rejected, and we do not proceed to compute the additional energy terms.

Parameters
xyzThe coordinates of the whole system
conf_dataAn object that will hold the values of the energy terms, the coordinates, and whether it is accepted.
energy_filterThe energy thresholds for the system, RuntimeParameters::energy_filter
See also
generateConformerData

◆ generateConformerData()

ConformerData Chain::generateConformerData ( double *  xyz,
PNAB::HelicalParameters hp,
std::vector< double >  energy_filter 
)

Generate structure and energy data for nucleic acid conformers.

After the conformation search finds a candidate that satisfies the distance threshold, this function is called with the coordinates of the backbone candidate to build the full system and computes its energy properties.

This function calls Chain::setCoordsForChain and Chain::fillConformerEnergyData to setup the coordinates and compute the energies, respectively.

Parameters
xyzThe coordinates of the backbone candidate that satisfied the distance threshold
hpAn instance of HelicalParameters that contains the helical structure data and functions
energy_filterThe energy thresholds for the system, RuntimeParameters::energy_filter
Returns
The conformer energy data, ConformerData, containing whether the candidate is accepted
See also
setCoordsForChain
fillConformerEnergyData
ConformationSearch::RandomSearch
ConformationSearch::MonteCarloSearch
ConformationSearch::SystematicSearch
ConformationSearch::GeneticAlgorithmSearch

◆ orderResidues()

void Chain::orderResidues ( OpenBabel::OBMol *  molecule)
private

Orders the residues in the molecules correctly.

This function reverses the order of residues in inverted strands.

Parameters
moleculeThe OBMol object of the system which will get the correct order
See also
generateConformerData
PNAB::ConformerData

◆ setCoordsForChain()

void Chain::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 
)
private

Set the coordinates for each strand in the system.

This function set the coordinates for each nucleotide in the strand. For DNA- and RNA- like systems, this function can generate anti-parallel strands. For hexad systems, it can generate any combination of the parallel and anti-parallel strands.

Parameters
xyzAn array that will get the coordinates of the strands
confAn array containing the coordinates of one backbone determined by the search algorithms
hpAn instance of HelicalParameters which has the helical parameters and functions to generate the coordinates
num_bu_atomsThe number of atoms in each BaseUnit
bb_start_indexA vector containing the starting indices of the backbone atoms in the BaseUnit
base_coords_vecA vector containing the coordinates of each one of the nucleotides
deleted_atoms_idsA vector containing the indices of the atoms deleted because of the bonding between the nucleotides
chain_indexThe index of the strand in the system
See also
setupChain
generateConformerData
HelicalParameters
ConformationSearch

◆ setupChain()

void Chain::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 
)
private

Creates the molecule for each strand in the system.

This function creates the topology (makes and removes bonds) for each strand in the system. It also determines the indices for all the fixed rotatable bonds in the system.

Parameters
strandThe list of bases in the strand
chainAn empty openbabel molecule to be populated with the topology of the strand
new_bond_idsAn empty vector to be populated with the indices of the atoms forming bonds between the nucleotides
deleted_atoms_idsAn empty vector to be populated with the indices of the atoms deleted because of the bonding between the nucleotides
num_base_unit_atomsAn empty vector to be populated with the number of atoms in each BaseUnit
bb_start_indexAn empty vector to be populated with the starting index of the backbone atoms in the BaseUnit
base_coords_vecAn empty vector to be populated with the coordinates of each one of the nucleotides
fixed_bonds_vecAn empty vector to be populated with the indices of fixed bonds in each one of the nucleotides
backboneAn instance of the Backbone class
chain_indexThe index of the chain
See also
Chain::Chain

◆ setupFFConstraints()

void Chain::setupFFConstraints ( OpenBabel::OBMol &  chain,
std::vector< unsigned > &  new_bond_ids,
std::vector< std::vector< unsigned >> &  fixed_bonds_vec,
unsigned  offset = 0 
)
private

Determines the terms that should be ignored during the computation of the bond, angle, and torsional energies.

For the bond energy, we consider only the one new bond that is formed between the first and second nucleobases in the system. This bond energy is the same for all new bonds, so we do not need to compute it for all of them.

For the angle energy, we consider all the new angles that are formed between the first and second nucleobases in the system. This angle energy is the same for all new bonds, so we do not need to compute it for all of them.

For the torsional energy, we consider all the rotatable bonds in all the nucleobases. There will be some redundant calculations, as some torsional angles will be the same. This code also identifies whether a rotatable torsional angle is fixed or not. For the identified torsional angles, we do not include any torsional angle that runs between the residues, as these are not rotated in the search procedure.

Parameters
chainThe openbabel molecule that contain the topology of the strand
new_bond_idsA vector containing the indices of the atoms forming bonds between the nucleotides
fixed_bonds_vecA vector containing the indices of fixed bonds in each one of the nucleotides
offsetThe number of atoms that have been processed previously. Used to set correct indices for all the strands.
See also
Chain::Chain
setupChain
fillConformerEnergyData

Member Data Documentation

◆ all_angles_

std::vector<std::vector<unsigned int> > PNAB::Chain::all_angles_
private

A vector of the vector of atom indices forming all the angles for which we need to compute the energy.

◆ all_torsions_

std::vector<std::vector<unsigned int> > PNAB::Chain::all_torsions_
private

A vector of the vector of atom indices forming all the torsions for which we need to compute the energy.

◆ build_strand_

std::vector<bool> PNAB::Chain::build_strand_
private

A vector containing whether a given strand should be built.

◆ chain_length_

unsigned PNAB::Chain::chain_length_
private

The number of nucleotides in the strand.

◆ combined_chain_

OpenBabel::OBMol PNAB::Chain::combined_chain_
private

An OpenBabel::OBMol molecule containing the structure of the whole system.

◆ constraintsAng_

OpenBabel::OBFFConstraints PNAB::Chain::constraintsAng_
private

An empty constraint object for angles; Energy groups are used for the angle terms.

◆ constraintsBond_

OpenBabel::OBFFConstraints PNAB::Chain::constraintsBond_
private

Setting all atoms not forming the new bond between the first two nucleotides to be ignored during bond energy computation.

◆ constraintsTor_

OpenBabel::OBFFConstraints PNAB::Chain::constraintsTor_
private

An empty constraint object for torsions; Energy groups are used for the torsion terms.

◆ constraintsTot_

OpenBabel::OBFFConstraints PNAB::Chain::constraintsTot_
private

An empty constraint object for van der Waals and total energy terms. No ignored atoms in these computations.

◆ ff_type_

std::string PNAB::Chain::ff_type_
private

The force field type (e.g. "GAFF"), RuntimeParameters::ff_type.

◆ glycosidic_bond_distance_

double PNAB::Chain::glycosidic_bond_distance_
private

The distance of the glycosidic bond, RuntimeParameters::glycosidic_bond_distance.

◆ hexad_

bool PNAB::Chain::hexad_
private

Whether we are building a hexad, RuntimeParameters::is_hexad.

◆ is_fixed_bond

std::vector<bool> PNAB::Chain::is_fixed_bond
private

A vector containing whether the torsional energy term is for a fixed rotatable bond or not.

◆ isKCAL_

bool PNAB::Chain::isKCAL_
private

Whether the energy computed by openbabel is in kcal/mol.

◆ monomer_bb_index_range_

std::array<unsigned, 2> PNAB::Chain::monomer_bb_index_range_
private

Backbone index range for the first nucleotide.

◆ n_chains_

unsigned PNAB::Chain::n_chains_
private

The number of strands in the system.

◆ pFF_

OpenBabel::OBForceField* PNAB::Chain::pFF_
private

The openbabel force field. Used to compute the energy of the system.

◆ strand_orientation_

std::vector<bool> PNAB::Chain::strand_orientation_
private

A vector containing the orientation of each strand in the hexad, RuntimeParameters::strand_orientation.

◆ v_base_coords_vec_

std::vector<std::vector<double*> > PNAB::Chain::v_base_coords_vec_ = std::vector<std::vector<double*>>(6)
private

A vector containing a vector the coordinates of each nucleotide in each strand.

◆ v_bb_start_index_

std::vector<std::vector<unsigned> > PNAB::Chain::v_bb_start_index_ = std::vector<std::vector<unsigned>>(6)
private

A vector containing a vector of the starting indices of the backbone atoms in the BaseUnit for each strand.

◆ v_chain_

std::vector<OpenBabel::OBMol> PNAB::Chain::v_chain_ = std::vector<OpenBabel::OBMol>(6)
private

A vector of OpenBabel::OBMol containing the molecules for each strand in the system.

◆ v_deleted_atoms_ids_

std::vector<std::vector<unsigned> > PNAB::Chain::v_deleted_atoms_ids_ = std::vector<std::vector<unsigned>>(6)
private

A vector containing a vector of the IDs of the atoms deleted in each strand because of the formation of new bonds.

◆ v_fixed_bonds

std::vector<std::vector<std::vector<unsigned> > > PNAB::Chain::v_fixed_bonds = std::vector<std::vector<std::vector<unsigned>>>(6)
private

A vector containing the indices of fixed rotatable bonds for each strad.

◆ v_new_bond_ids_

std::vector<std::vector<unsigned> > PNAB::Chain::v_new_bond_ids_ = std::vector<std::vector<unsigned>>(6)
private

a vector containing a vector of the IDs of the atoms forming new bonds between the nucleotides in each strand

◆ v_num_bu_A_mol_atoms_

std::vector<std::vector<unsigned> > PNAB::Chain::v_num_bu_A_mol_atoms_ = std::vector<std::vector<unsigned>>(6)
private

A vector containing a vector of the number of atoms in each BaseUnit for each strand.


The documentation for this class was generated from the following files: