RNAstructure Classes  Version 6.2
Thermodynamics Class Reference

Thermodynamics Class. More...

#include <thermodynamics.h>

Inheritance diagram for Thermodynamics:
RNA design HybridRNA Oligowalk_object ProbScan

Public Member Functions

 Thermodynamics (const bool isRNA=true, const char *const alphabetName=NULL, const double temperature=310.15)
 
 Thermodynamics (const Thermodynamics &copyThermo)
 
int SetTemperature (double temperature)
 Set the temperature of folding in K. More...
 
double GetTemperature () const
 
string GetAlphabetName () const
 Get the name of the extended alphabet for which thermodynamic parameters should be loaded. More...
 
int ReadThermodynamic (const char *directory=NULL, const char *alphabet=NULL, const double temperature=-1.0)
 Function to read the thermodynamic parameters. More...
 
int ReloadDataTables (const double new_temperature=-1.0)
 
bool VerifyThermodynamic ()
 Force the datatables to be read if they haven't already. Return true if the tables were already loaded or if the attempt to (re)open them succeded. More...
 
datatable * GetDatatable ()
 
datatable * GetEnthalpyTable (const char *alphabet=NULL)
 
void ClearEnergies ()
 Clear the currently loaded energy datatable and release its resources. More...
 
void ClearEnthalpies ()
 Clear the currently loaded enthalpy datatable and release its resources. More...
 
bool GetEnergyRead () const
 Return whether this instance of Thermodynamics has the paremters populated (either from disk or from another Thermodynamics class). More...
 
bool IsAlphabetRead () const
 
 ~Thermodynamics ()
 

Public Attributes

bool isrna
 

Protected Member Functions

virtual void CopyThermo (const Thermodynamics &copy)
 Copy thermodynamic parameters from an instance of Thermodynamics class. More...
 

Protected Attributes

datatable * data
 
datatable * enthalpy
 
bool copied
 
double nominal_temperature
 
string nominal_alphabetName
 
bool skipThermoTables
 

Detailed Description

Thermodynamics Class.

The RNA class provides an encapsulation of the functions and struct for reading and storing thermodynamic parameters. This includes methods for changing folding temperatures This class is intended for use in inheritance for classes that provide functionality.

Constructor & Destructor Documentation

◆ Thermodynamics() [1/2]

Thermodynamics::Thermodynamics ( const bool  isRNA = true,
const char *const  alphabetName = NULL,
const double  temperature = 310.15 
)

◆ Thermodynamics() [2/2]

Thermodynamics::Thermodynamics ( const Thermodynamics copyThermo)

◆ ~Thermodynamics()

Thermodynamics::~Thermodynamics ( )

Member Function Documentation

◆ ClearEnergies()

void Thermodynamics::ClearEnergies ( )

Clear the currently loaded energy datatable and release its resources.

◆ ClearEnthalpies()

void Thermodynamics::ClearEnthalpies ( )

Clear the currently loaded enthalpy datatable and release its resources.

◆ CopyThermo()

void Thermodynamics::CopyThermo ( const Thermodynamics copy)
protectedvirtual

Copy thermodynamic parameters from an instance of Thermodynamics class.

This is generally not needed because functions automatically populate the parameters from disk. It is helpful, however, when a large number of calculations with be performed because the parameters can then be read from disk only once. Note that the source Thermodynamics class must have been initialized with the "correct" ISRNA value and correct temperature. Return 0 if no error and non-zero errors can be parsed by GetErrorMessage() or GetErrorMessageString().

Parameters
thermois a pointer to Thermodynamics class. That must have already called the ReadThermodynamics() function.

IMPORTANT: CopyThermo should not be used, except possibly in constructors of derived classes. Use the Thermodyanamic(Thermodynamic* copy) constructor instead. Reason: Since the extended alphabet, the datatable is loaded in the RNA class constructor, so copying the datatable must also happen in the constructor to avoid reading a (possibly different) datatable first. This replaces Thermodynamics::CopyThermodynamic

◆ GetAlphabetName()

string Thermodynamics::GetAlphabetName ( ) const

Get the name of the extended alphabet for which thermodynamic parameters should be loaded.

◆ GetDatatable()

datatable * Thermodynamics::GetDatatable ( )

This function is used during inheritance to provide access to the free energy change parameters. This function generates no error codes. (Error checking was done for this during construction).

Returns
A pointer to datatable with free energy change parameters.

◆ GetEnergyRead()

bool Thermodynamics::GetEnergyRead ( ) const

Return whether this instance of Thermodynamics has the paremters populated (either from disk or from another Thermodynamics class).

Returns
A bool that indicates whether the parameters are populated (true = yes).

◆ GetEnthalpyTable()

datatable * Thermodynamics::GetEnthalpyTable ( const char *  alphabet = NULL)

This function is used to provide an enthalpy table. This function will return a NULL pointer if there is an error reading the tables from disk. It is important that programs check the status of the pointer before using it, i.e. make sure it is not NULL.

Parameters
alphabetSpecify which alphabet to use. If this is NULL (the default) the currently loaded alphabet, if there is one, will be used. Otherwise either default RNA or DNA alphabet will be used, depending on the value of isrna.
Returns
A pointer to datatable with the enthalpy change parameters.

◆ GetTemperature()

double Thermodynamics::GetTemperature ( ) const

Get the current folding temperature in K.

Returns
A double that indicates the folding temperature in K.

◆ IsAlphabetRead()

bool Thermodynamics::IsAlphabetRead ( ) const
Returns
A bool that indicates whether the alphabet was populated.

◆ ReadThermodynamic()

int Thermodynamics::ReadThermodynamic ( const char *  directory = NULL,
const char *  alphabet = NULL,
const double  temperature = -1.0 
)

Function to read the thermodynamic parameters.

This function depends on temp, the current temperature, to determine in the folding free energies need to be set to other than those read in files for 310.15 K. Return of zero => no error and a return of non-zero indicates error. Public functions that need the thermodynamic parameters call this function automatically. By default, the path to the thermodynamic paramaters is fetched from the $DATAPATH environment variable. If a specific path is needed, $DATAPATH is overridden by specifying the pathname explicitly here as a parameter.

Returns
An int that indicates whether an error occured.
Parameters
directoryis a pointer to a cstring that indicates the directory that contains the thermodynamnic parameter files. By default, this is NULL and the environment variable $DATAPATH is consulted to get this path.
alphabetis a pointer to a cstring that indicates the name of the nucleic acid alphabet (e.g. "rna", "dna" etc);
temperaturespecify a custom temperature. If this parameter is less than zero it is ignored. Otherwise the free energy parameters are recalculated to apply to the specified temperature.

◆ ReloadDataTables()

int Thermodynamics::ReloadDataTables ( const double  new_temperature = -1.0)

Re-loads the free energy data tables from the original directory and using the original alphabet name.

Parameters
temperaturespecify a custom temperature. If this parameter is less than zero it is ignored. Otherwise the free energy parameters are recalculated to apply to the specified temperature. scaled to the specified temperature.

Re-loads the free energy data tables from original data directory and using the original alphabet name. If new_temperature is less than 0 it is ignored. Otherwise, the data tables will be read in and scaled to the specified temperature.

◆ SetTemperature()

int Thermodynamics::SetTemperature ( double  temperature)

Set the temperature of folding in K.

This function allows the user to specify folding temperatures other than 310.15 K (37 degrees C). This changes folding free energy changes that would be returned for existing structures and would alter the set of structures predicted. When this function is called, the thermodynamic parameter files are immediately read from disk. These include both enthalpy parameters (.dh files) and free energy changes at 310.15 (.dat files). The files must either be at a location indicated by the $DATAPATH environment variable or in pwd. Changing the temperature only alters subsequent calculations. For example, if a structure prediction method has been called, the set of predicted structures are not changed at the time of a call to SetTemperature. Likewise, SetTemperature must be called before calling a structure prediction method if a temperature other than the 310.15 K default is desired. The function returns an error code where 0 is no error and non-zero errors can be parsed by by GetErrorMessage() or GetErrorMessageString() in an inheriting class.

◆ VerifyThermodynamic()

bool Thermodynamics::VerifyThermodynamic ( )

Force the datatables to be read if they haven't already. Return true if the tables were already loaded or if the attempt to (re)open them succeded.

Member Data Documentation

◆ copied

bool Thermodynamics::copied
protected

◆ data

datatable* Thermodynamics::data
protected

◆ enthalpy

datatable* Thermodynamics::enthalpy
protected

◆ isrna

bool Thermodynamics::isrna

◆ nominal_alphabetName

string Thermodynamics::nominal_alphabetName
protected

◆ nominal_temperature

double Thermodynamics::nominal_temperature
protected

◆ skipThermoTables

bool Thermodynamics::skipThermoTables
protected

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