| RNAstructure Classes Version 6.2

Public Member Functions | Private Member Functions | Private Attributes | List of all members
Dynalign_object Class Reference

Dynalign_object Class. More...

`#include <Dynalign_object.h>`

Inheritance diagram for Dynalign_object:

## Public Member Functions
| Dynalign_object ()
| Dynalign_object (const char sequence1[], const char sequence2[], const bool IsRNA=true)
| Dynalign_object (const char filename1[], const RNAInputType type1, const char filename2[], const RNAInputType type2, const bool IsRNA=true)
| Constructor. More...
| Dynalign_object (const char filename1[], const RNAInputType type1, const char filename2[], const RNAInputType type2, const Thermodynamics *thermo1)
| Dynalign_object (const char filename[])
| Constructor. More...
| Dynalign_object (const char *filename, const short maxtrace, const short bpwin, const short awin, const short percent)
int | Dynalign (const short int maxtrace=20, const short int bpwin=5, const short int awin=1, const short int percent=20, const short int imaxseparation=-99, const float gap=0.4, const bool singleinsert=true, const char savefile[]=NULL, const bool optimalonly=false, const short int singlefold_subopt_percent=30, const bool local=false, const short int numProcessors=1, const int maxpairs=-1)
| Predict the lowest free energy structure common to two sequences and suboptimal solutions with the Dynalign algorithm. More...
void | WriteAlignment (const char filename[])
| Write the alignment to disk. More...
int | ForceAlignment (const int i, const int k)
| Force an alignment during a Dynalign calculation). More...
int | GetForcedAlignment (const int i, const int seq)
| Get an alignment constraint. More...
int | ReadAlignmentConstraints (const char filename[])
| Read alignment constraints from disk. More...
int | Templatefromct (const char ctfilename[])
| Read a ct file to determine what pairs will be allowed for sequence 1 in a subsequent dynalign calculation. More...
int | Templatefromdsv (const char dsvfilename[], const float maxdsvchange)
double | GetBestPairEnergy (const int sequence, const int i, const int j)
| Report the best energy for pair i-j from sequence number sequence (1 or 2). More...
double | GetLowestEnergy ()
| Report the lowest total free energy change from a Dynalign calculation. More...
const char * | GetErrorMessage (const int error)
| Return error messages based on code from GetErrorCode and other error codes. More...
void | SetProgress (ProgressHandler &Progress)
void | StopProgress ()
| ~Dynalign_object ()
Public Member Functions inherited from TwoRNA
| TwoRNA (const char sequence1[], const char sequence2[], bool IsRNA=true)
| Constructor - user provides a sequences as c strings. More...
| TwoRNA (const char filename1[], const RNAInputType type1, const char filename2[], const RNAInputType type2, bool IsRNA=true)
| Constructor - user provides a filenames for existing files as a c string. More...
| TwoRNA (const char filename1[], const RNAInputType type1, const char filename2[], const RNAInputType type2, const Thermodynamics *copyThermo)
| TwoRNA ()
int | SetTemperature (double temperature)
| Set the temperature at which the calculation will be performed in K. More...
double | GetTemperature () const
| Get the current folding temperature in K. More...
int | GetErrorCode () const
| Return an error code, where a return of zero is no error. More...
const char * | GetErrorMessage (const int error)
| Return error messages based on code from GetErrorCode and other error codes. More...
const string | GetErrorDetails () const
void | SetErrorDetails (const string &details)
std::string | GetErrorMessageString (const int error)
| Return error messages based on code from GetErrorCode and other error codes. More...
void | ResetError ()
| Reset the underlying RNA objects internal error code, after an error is handled. More...
RNA * | GetRNA1 ()
| return A pointer to the underlying structure class for sequence 1. More...
RNA * | GetRNA2 ()
| return A pointer to the underlying structure class for sequence 2. More...
| ~TwoRNA ()
| Destructor. More...

## Private Member Functions
void | CommonConstructor ()
void | AllocateForceAlign ()
void | storetemplatefilename (const char *name)

## Private Attributes
short ** | align
short ** | forcealign
bool | dsv_templated
bool | ct_templated
char * | templatefilename
float | MAXDSV
int | modificationflag
dynalignarray * | w
dynalignarray * | vmod
varray * | v
wendarray * | w5
wendarray * | w3
short * | lowend
short * | highend
datatable * | data
short | gap
short | lowest
int | Maxtrace
bool | savefileread
double *** | array

## Additional Inherited Members
Public Attributes inherited from TwoRNA
char | compoundmessage [COMPOUNDMESSAGELENGTH]
| Provide facility for storing and accessing error messages. More...
Protected Attributes inherited from TwoRNA
int | ErrorCodeTwo

## Detailed Description

Dynalign_object Class.

The Dynalign_object class provides an entry point for the Dynalign algorithm. The class is inherited from the TwoRNA class, which itself contains two instances to the class RNA.

## Constructor & Destructor Documentation

## ◆ Dynalign_object() [1/6]

Dynalign_object::Dynalign_object | ( |  | ) |

Constructor This is a default constructor that calls the TwoRNA default constructor.

## ◆ Dynalign_object() [2/6]

Dynalign_object::Dynalign_object | ( | const char | sequence1[],
|  | const char | sequence2[],
|  | const bool | IsRNA = `true`
| ) |  |

This constuctor is available to reach the TwoRNA constructors, from which this class is inherited. This constructor uses two cstrings to provide sequences. IsRNA is true for RNA folding and flase for DNA. Constructor
This constuctor is available to reach the TwoRNA constructors, from which this class is inherited. This constructor uses two cstrings to provide sequences. IsRNA is true for RNA folding and false for DNA. Input sequences should contain A,C,G,T,U,a,c,g,t,u,x,X. Capitalization makes no difference. T=t=u=U. If IsRNA is true, the backbone is RNA, so U is assumed. If IsRNA is false, the backbone is DNA, so T is assumed. x=X= nucleotide that neither stacks nor pairs. For now, any unknown nuc is considered 'X'. Both sequences are passed to underlying RNA classes for each sequence.

Parameters

  sequence1 | is a NULL terminated c string for sequence 1.
  sequence2 | is a NULL terminated c string for sequence 2.
  IsRNA | is a bool that indicates whether these sequences are RNA or DNA. true=RNA. false=DNA. Default is true. Both sequences must have the same backbone.

## ◆ Dynalign_object() [3/6]

Dynalign_object::Dynalign_object | ( | const char | filename1[],
|  | const RNAInputType | type1,
|  | const char | filename2[],
|  | const RNAInputType | type2,
|  | const bool | IsRNA = `true`
| ) |  |

Constructor.

This constuctor is available to reach the TwoRNA constructors, from which this class is inherited. This constructor uses two ctsirngs as filenames, accompanied by integers to set the file type. IsRNA is true for RNA folding and false for DNA.
The existing files, specified by filenames, can either be a ct file, a sequence, or an RNAstructure save file. Therefore, the user provides a flag for the file type: type = 1 => .ct file, type = 2 => .seq file, type = 3 => partition function save (.pfs) file, type = 4 => folding save file (.sav). The file opening is performed by the constructors for the RNA classes that underlie each sequence. This constructor generates internal error codes that can be accessed by GetErrorCode() after the constructor is called. 0 = no error. The errorcode can be resolved to a c string using GetErrorMessage.
Note that the contructor needs to be explicitly told, via IsRNA, what the backbone is because files do not store this information. Note also that save files explicitly store the thermodynamic parameters, therefore changing the backbone type as compaared to the original calculation will not change structure predictions.

Parameters

  filename1 | is a null terminated c string and refers to sequence 1.
  filename2 | is a null terminated c string and refers to sequence 2.
  type1 | is an integer that indicates the file type for sequence 1.
  type2 | is an integer that indicates the file type for sequence 2.
  IsRNA | is a bool that indicates whether these sequences are RNA or DNA. true=RNA. false=DNA. Default is true. Only one backbone is allowed for both sequences.

## ◆ Dynalign_object() [4/6]

Dynalign_object::Dynalign_object | ( | const char | filename1[],
|  | const RNAInputType | type1,
|  | const char | filename2[],
|  | const RNAInputType | type2,
|  | const Thermodynamics * | thermo1
| ) |  |

Constructor Constructor that copies thermodynamic parameter tables from an existing Thermodynamics (or RNA etc) instance. The file opening is performed by the constructors for the RNA classes that underlie each sequence. This constructor generates internal error codes that can be accessed by GetErrorCode() after the constructor is called. 0 = no error. The errorcode can be resolved to a c string using GetErrorMessage.

Parameters

  filename1 | is a null terminated c string and refers to sequence 1.
  filename2 | is a null terminated c string and refers to sequence 2.
  type1 | is an integer that indicates the file type for sequence 1.
  type2 | is an integer that indicates the file type for sequence 2.
  thermo1 | is a pointer to the Thermodynamics object to copy. The internal datatables object is stored by reference, so subsequence changes made to it WILL affect this object.

## ◆ Dynalign_object() [5/6]

Dynalign_object::Dynalign_object | ( | const char | filename[] | ) |

Constructor.

This constructor allows the user to read a dynalign save file (.dsv) to get base pairing information. This constructor generates internal error codes that can be accessed by GetErrorCode() after the constructor is called. 0 = no error. The errorcode can be resolved to a c string using GetErrorMessage.

Parameters

  filename[] | is a cstring that indicates the filename of a .dsv file.

## ◆ Dynalign_object() [6/6]

Dynalign_object::Dynalign_object | ( | const char * | filename,
|  | const short | maxtrace,
|  | const short | bpwin,
|  | const short | awin,
|  | const short | percent
| ) |  |

Constructor This constructor is used to perform Dynaligh refolding. This does not allow any changes in constraints, but does allow the creation of different set of suboptimal structures. This constructor generates internal error codes that can be accessed by GetErrorCode() after the constructor is called. 0 = no error. The errorcode can be resolved to a c string using GetErrorMessage.

Parameters

  filename | is the name of a Dynalign save file name (.dsv).
  maxtrace | is the maximum number of common structures to be determined. The recommended default is 20.
  bpwin | the the base pair window parameter, where 0 allows the structures to have similar pairs and larger windows make the structures more diverse. The recommended default is 5.
  awin | is the alignment window parameter, where 0 allows the alignments to be similar and larger values make the alignments more diverse. The recommended default is 1.
  percent | is the maximum percent difference in total folding free energy change above the lowest for suboptimal common structures. The recommended default is 20.

## ◆ ~Dynalign_object()

Dynalign_object::~Dynalign_object | ( |  | ) |

## Member Function Documentation

## ◆ AllocateForceAlign()

void Dynalign_object::AllocateForceAlign | ( |  | ) |
| private

## ◆ CommonConstructor()

void Dynalign_object::CommonConstructor | ( |  | ) |
| private

## ◆ Dynalign()

int Dynalign_object::Dynalign | ( | const short int | maxtrace = `20`,
|  | const short int | bpwin = `5`,
|  | const short int | awin = `1`,
|  | const short int | percent = `20`,
|  | const short int | imaxseparation = `-99`,
|  | const float | gap = `0.4`,
|  | const bool | singleinsert = `true`,
|  | const char | savefile[] = `NULL`,
|  | const bool | optimalonly = `false`,
|  | const short int | singlefold_subopt_percent = `30`,
|  | const bool | local = `false`,
|  | const short int | numProcessors = `1`,
|  | const int | maxpairs = `-1`
| ) |  |

Predict the lowest free energy structure common to two sequences and suboptimal solutions with the Dynalign algorithm.

In case of error, the function returns a non-zero that can be parsed by GetErrorMessage() or GetErrorMessageString().

Parameters

  maxtrace | is the maximum number of common structures to be determined. The defaults is 20.
  bpwin | the the base pair window parameter, where 0 allows the structures to have similar pairs and larger windows make the structures more diverse. The default is 5.
  awin | is the alignment window parameter, where 0 allows the alignments to be similar and larger values make the alignments more diverse. The default is 1.
  percent | is the maximum percent difference in total folding free energy change above the lowest for suboptimal common structures. The defaults is 20.
  imaxseparation | is the maximum separation between aligned nucleotides. Values >= 0 are the traditional parameter, those below zero trigger the HMM alignment method, which is now prefered.
  gap | is the cost of adding gap nucleotides in the alignment in kcal/mol.
  singleinsert | is whether single basepair inserts are allowed in one sequence vs the other.
  savefile | is c-string with the name of a dynalign savefile (*.dsv) to be created.
  optimalonly | can be used to turn on a calculation of only the energy (when true) and not the structures.
  singlefold_subopt_percent | is the maximum % difference of folding energy above the lowest free energy structure for pairs in single sequence folding that will be allowed in the dynalign calculation.
  local | is whether Dynalign is being run in local (true) or global mode (false).
  numProcessors | is the number of processors to use for the calculation. This requires a compilation for SMP.
  maxpairs | is under development for multiple sequence folding. Use -1 (default) for now.

Returns
  An int that indicates an error code (0 = no error, non-zero = error occurred).

## ◆ ForceAlignment()

int Dynalign_object::ForceAlignment | ( | const int | i,
|  | const int | k
| ) |  |

Force an alignment during a Dynalign calculation).

Nucleotide i from sequence 1 will be aligned to nucleotide k in sequence 2 in subsequent Dynalign calculation.
The function returns 0 with no error and a non-zero otherwise that can be parsed by GetErrorMessage() or GetErrorMessageString().

Parameters

  i | is the index of nucleotide from sequence 1.
  k | is the index of nucleotide from sequence 2.

Returns
  An integer that indicates an error code (0 = no error, 100 = nucleotide i out of range, 101 = nucleotide k out of range).

## ◆ GetBestPairEnergy()

double Dynalign_object::GetBestPairEnergy | ( | const int | sequence,
|  | const int | i,
|  | const int | j
| ) |  |

Report the best energy for pair i-j from sequence number sequence (1 or 2).

This function reports the lowest ffolding free energy for any pairs between i-j in sequence number sequence (1 or 2). This requires a search over all possible pairs in the second sequence. NOTE: This function ONLY works after reading a Dynalign save file (.dsv) using the constructor. This is because the Dynalign energies are not normally stored after calling Dynalign. This function generates internal error codes that can be accessed by GetErrorCode() after the constructor is called. 0 = no error, 107 = Data not available, 108 = nucleotide out of range. The errorcode can be resolved to a c string using GetErrorMessage.

Parameters

  sequence | is an integer indicating the sequence # (must be 1 or 2).
  i | is the 5' nucleotide in a pair.
  j | is the 3' nucleotide in a pair.

Returns
  A double that gives an energy in kcal/mol.

## ◆ GetErrorMessage()

const char * Dynalign_object::GetErrorMessage | ( | const int | error | ) |

Return error messages based on code from GetErrorCode and other error codes.

0 = no error 100-999 = Error associated with Dynalign, to be handled here. >=1000 = Errors for underlying sequence, get message from TwoRNA base class. Current errors handled here are: 100 "Nucleotide from sequence 1 is out of range.\n"; 101 "Nucleotide from sequence 2 is out of range.\n"; 102 "Alignment constraint file not found.\n"; 103 "Error reading alignment constraint file.\n"; 104 "CT file not found.\n"; 105 "A template has already been specified; only one is allowed.\n"; 106 "DSV file not found.\n"; 107 "Data not available to calculate energy.\n" 108 "Nucleotide out of range.\n"; 109 "Value of maxpairs is too large to be achievable.\n" 110 "Error reading thermodynamic parameters."

Parameters

  error | is the integer error code provided by GetErrorCode() or by a call to a function that returns an error.

Returns
  A pointer to a c string that provides an error message or from other functions that return integer error codes.

## ◆ GetForcedAlignment()

int Dynalign_object::GetForcedAlignment | ( | const int | i,
|  | const int | seq
| ) |  |

Get an alignment constraint.

Parameters

  i | is the nucleotide number.
  seq | is the sequence (1 or 2) from which i is derived.

Returns
  An integer that indicates the nucleotide to which i is forced to be aligned, where 0 indicates no alignment.

## ◆ GetLowestEnergy()

double Dynalign_object::GetLowestEnergy | ( |  | ) |

Report the lowest total free energy change from a Dynalign calculation.

NOTE: This function ONLY works after reading a Dynalign save file (.dsv) using the constructor. This is because the Dynalign energies are not normally stored after calling Dynalign. This function generates internal error codes that can be accessed by GetErrorCode() after the constructor is called. 0 = no error, 107 = Data not available, 108 = nucleotide out of range. The errorcode can be resolved to a c string using GetErrorMessage.

Returns
  a double that gives an energy in kcal/mol.

## ◆ ReadAlignmentConstraints()

int Dynalign_object::ReadAlignmentConstraints | ( | const char | filename[] | ) |

Read alignment constraints from disk.

The file format is: i1 k1 i2 k2 -1 -1 Where each line gives a aligned pair (i from sequence 1 and k from sequence 2). The file terminates with -1 -1 to indicate the file end. The function returns 0 with no error and a non-zero otherwise that can be parsed by GetErrorMessage() or GetErrorMessageString().

Parameters

  filename | is a c string that is the file name to be read.

Returns
  An integer that indicates an error code (0 = no error, 102 = file not found, 103 = error reading constraint file).

## ◆ SetProgress()

void Dynalign_object::SetProgress | ( | ProgressHandler & | Progress | ) |

Provide a TProgressDialog for following calculation progress. A TProgressDialog class has a public function void update(int percent) that indicates the progress of a long calculation.

Parameters

  Progress | is a TProgressDialog class.

## ◆ StopProgress()

void Dynalign_object::StopProgress | ( |  | ) |

Provide a means to stop using a TProgressDialog. StopProgress tells the RNA class to no longer follow progress. This should be called if the TProgressDialog is deleted, so that this class does not make reference to it.

## ◆ storetemplatefilename()

void Dynalign_object::storetemplatefilename | ( | const char * | name | ) |
| private

## ◆ Templatefromct()

int Dynalign_object::Templatefromct | ( | const char | ctfilename[] | ) |

Read a ct file to determine what pairs will be allowed for sequence 1 in a subsequent dynalign calculation.

This results in all pairs but those in the ct being disallowed.

Parameters

  ctfilename | is the name of the ct file to be read to provide the template.

Returns
  An integer that indicates an error code (0=no error, 104=file not found, 105=template is already specified)

## ◆ Templatefromdsv()

int Dynalign_object::Templatefromdsv | ( | const char | dsvfilename[],
|  | const float | maxdsvchange
| ) |  |

This reads a dsv file and only allows pairs with folding free energy change between the lowest and lowest + maxdsvchange in a subsequent dynalign calculation.

Parameters

  dsvfilename | is the name of the ct file to be read to provide the template.
  maxdsvchange | in a float that gives a percent difference in free energy above the lowest free energy change.

Returns
  An integer that indicates an error code (0=no error, 106=file not found, 105=template is already specified)

## ◆ WriteAlignment()

void Dynalign_object::WriteAlignment | ( | const char | filename[] | ) |

Write the alignment to disk.

This function should be called after loading a dynalign save file or after a dynalign calculation has been performed. This function generates no error flag. Nothing can go wrong...

Parameters

  filename | is the file to which the alignment should be written.

## Member Data Documentation

## ◆ align

short** Dynalign_object::align
| private

## ◆ array

double*** Dynalign_object::array
| private

## ◆ ct_templated

bool Dynalign_object::ct_templated
| private

## ◆ data

datatable* Dynalign_object::data
| private

## ◆ dsv_templated

bool Dynalign_object::dsv_templated
| private

## ◆ forcealign

short** Dynalign_object::forcealign
| private

## ◆ gap

short Dynalign_object::gap
| private

## ◆ highend

short * Dynalign_object::highend
| private

## ◆ lowend

short* Dynalign_object::lowend
| private

## ◆ lowest

short Dynalign_object::lowest
| private

## ◆ MAXDSV

float Dynalign_object::MAXDSV
| private

## ◆ Maxtrace

int Dynalign_object::Maxtrace
| private

## ◆ modificationflag

int Dynalign_object::modificationflag
| private

## ◆ savefileread

bool Dynalign_object::savefileread
| private

## ◆ templatefilename

char* Dynalign_object::templatefilename
| private

## ◆ v

varray* Dynalign_object::v
| private

## ◆ vmod

dynalignarray * Dynalign_object::vmod
| private

## ◆ w

dynalignarray* Dynalign_object::w
| private

## ◆ w3

wendarray * Dynalign_object::w3
| private

## ◆ w5

wendarray* Dynalign_object::w5
| private

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

- RNA_class/Dynalign_object.h
- RNA_class/Dynalign_object.cpp