RNAstructure Classes  Version 6.1
HybridRNA Class Reference

HybridRNA Class. More...

#include <HybridRNA.h>

Inheritance diagram for HybridRNA:
RNA Thermodynamics

Public Member Functions

 HybridRNA (const char sequence1[], const char sequence2[], const bool IsRNA=true)
 Constructors. More...
 
 HybridRNA (const char filename1[], const int type1, const char filename2[], const int type2, const bool IsRNA=true)
 
 HybridRNA (const char filename1[], const int type1, const char filename2[], const int type2, const char *alphabet)
 
int AccessFold (const double gamma=0.4, const float percent=50, const int maximumstructures=20, const int window=0, const int maxinternalloopsize=30)
 
int FoldBimolecular (const float percent=10, const int maximumstructures=20, const int window=0, const char savefile[]="", const int maxinternalloopsize=30)
 Predict the lowest free energy secondary structure and generate suboptimal structures using a heuristic. More...
 
int FoldDuplex (const float percent=40, const int maximumstructures=10, const int window=0, const int maxinternalloopsize=30)
 Predict the lowest free energy secondary structure for two strands that cannot form intramolecular pairs and generate suboptimal structures using a heuristic. More...
 
int PartitionFunctionBimolecular (const char savefile[]="")
 Predict the bimolecular partition function for a sequence (with no intramolecular pairs). More...
 
RNAGetRNA1 ()
 
RNAGetRNA2 ()
 
int GetErrorCode ()
 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...
 
bool GetForbidIntramolecular ()
 Get whether intramolecular pairs are allowed. More...
 
void SetForbidIntramolecular (const bool forbid)
 Set whether intramolecular pairs are allowed. More...
 
void SetProgress (ProgressHandler &Progress)
 
void StopProgress ()
 
 ~HybridRNA ()
 
- Public Member Functions inherited from RNA
 RNA (const char sequence[], const bool IsRNA=true)
 Constructor - user provides a sequence as a c string. More...
 
 RNA (const char filepathOrSequence[], const RNAInputType fileType, const char *const alphabetName, const bool allowUnknownBases=false, const bool skipThermoTables=false)
 
 RNA (const char filepathOrSequence[], const RNAInputType fileType, const Thermodynamics *copyThermo)
 
 RNA (const char filename[], const RNAInputType fileType, const bool IsRNA=true)
 Constructor - user provides a filename for existing file as a c string. More...
 
 RNA (const bool IsRNA=true)
 
int GetErrorCode () const
 Return an error code, where a return of zero is no error. More...
 
string GetFullErrorMessage () const
 
const string GetErrorDetails () const
 Returns extended details about the last error. (e.g. error messages produced during file read operations that are otherwise lost.) More...
 
void SetErrorDetails (const string &details)
 Set extended details about the last error. (e.g. error messages produced during file read operations that are otherwise lost.) More...
 
void SetSequenceLabel (const string &label)
 Set the name of the sequence. (This must be called before structure prediction for it to affect the resulting structures.) More...
 
string GetErrorMessageString (const int error) const
 Return error messages based on code from GetErrorCode and other error codes. More...
 
void ResetError ()
 
void EnsureStructureCapcacity (const int minimumStructures)
 Ensure that at a minumum number of structures have been created. More...
 
int SpecifyPair (const int i, const int j, const int structurenumber=1)
 Specify a base pair between nucleotides i and j. More...
 
int RemovePairs (const int structurenumber=1, bool removeIfLastStructure=true)
 Remove all the current base pairs in a specified structure. More...
 
int RemoveBasePair (const int i, const int structurenumber=1)
 Remove a specified pair in a specified structure. More...
 
double CalculateFreeEnergy (const int structurenumber=1, const bool UseSimpleMBLoopRules=false)
 Return the predicted Gibb's free energy change for structure # structurenumber, defaulted to 1. More...
 
int WriteThermodynamicDetails (const char filename[], const bool UseSimpleMBLoopRules=false)
 Calculate the folding free energy change for all structures and write the details of the calculation to a file. More...
 
int FoldSingleStrand (const float percent=20, const int maximumstructures=20, const int window=5, const char savefile[]="", const int maxinternalloopsize=30, bool mfeonly=false, bool simple_iloops=true, bool disablecoax=false)
 Predict the lowest free energy secondary structure and generate suboptimal structures using a heuristic. More...
 
int GenerateAllSuboptimalStructures (const float percent=5, const double deltaG=0.6)
 Predict the lowest free energy secondary structure and generate all suboptimal structures. More...
 
int MaximizeExpectedAccuracy (const double maxPercent=20, const int maxStructures=20, const int window=1, const double gamma=1.0)
 Predict the structure with maximum expected accuracy and suboptimal structures. More...
 
int PartitionFunction (const char savefile[]="", double temperature=-10.0, bool disablecoax=false, bool restoreSHAPE=true)
 Predict the partition function for a sequence. More...
 
int Rsample (const vector< double > &experimentalRestraints, RsampleData &refdata, const int randomSeed=0, const char savefile[]="", const double cparam=0.5, const double offset=1.10, const int numsamples=10000)
 
int PredictProbablePairs (const float probability=0)
 Predict structures containing highly probable pairs. More...
 
int ProbKnot (int iterations=1, int MinHelixLength=1)
 Predict maximum expected accuracy structures that contain pseudoknots from either a sequence or a partition function save file. More...
 
int ProbKnotFromSample (int iterations=1, int MinHelixLength=1)
 Predict maximum expected accuracy structures that contain pseudoknots from a file containing ensemble of structures. More...
 
int ReFoldSingleStrand (const float percent=20, const int maximumstructures=20, const int window=5)
 Re-predict the lowest free energy secondary structure and generate suboptimal structures using a heuristic. More...
 
int Stochastic (const int structures=1000, const int seed=1)
 Sample structures from the Boltzman ensemable. More...
 
int ForceDoubleStranded (const int i)
 Force a nucleotide to be double stranded (base paired). More...
 
int ForceFMNCleavage (const int i)
 Indicate a nucleotide that is accessible to FMN cleavage (a U in GU pair). More...
 
int ForceMaximumPairingDistance (const int distance)
 Force a maximum distance between apired nucleotides. More...
 
int ForceModification (const int i)
 Force modification for a nucleotide. More...
 
int ForcePair (const int i, const int j)
 Force a pair between two nucleotides. More...
 
int ForceProhibitPair (const int i, const int j)
 Prohibit a pair between two nucleotides. More...
 
int ForceSingleStranded (const int i)
 Force a nucleotide to be single stranded. More...
 
int GetForcedDoubleStranded (const int constraintnumber)
 Return a nucleotide that is forced double stranded. More...
 
int GetForcedFMNCleavage (const int constraintnumber)
 Return a nucleotide that is accessible to FMN cleavage. More...
 
int GetForcedModification (const int constraintnumber)
 Return a nucleotide that is accessible to modification. More...
 
int GetForcedPair (const int constraintnumber, const bool fiveprime)
 Return a nucleotide in a forced pair. More...
 
int GetForcedProhibitedPair (const int constraintnumber, const bool fiveprime)
 Return a nucleotide in a prohibited pair. More...
 
int GetForcedSingleStranded (const int constraintnumber)
 Return a nucleotide that is forced single stranded. More...
 
int GetMaximumPairingDistance ()
 Return the maximum pairing distance. More...
 
int GetNumberOfForcedDoubleStranded ()
 Return the number of nucletides forced to be paired. More...
 
int GetNumberOfForcedFMNCleavages ()
 Return the number of nucleotides accessible to FMN cleavage. More...
 
int GetNumberOfForcedModifications ()
 Return the number of nucleotides accessible to chemical modification. More...
 
int GetNumberOfForcedPairs ()
 Return the number of forced base pairs. More...
 
int GetNumberOfForcedProhibitedPairs ()
 Return the number of prohibited base pairs. More...
 
int GetNumberOfForcedSingleStranded ()
 Return the number of nucleotides that are not allowed to pair. More...
 
int ReadConstraints (const char filename[])
 Read a set of folding constraints to disk in a plain text file. More...
 
int ReadSHAPE (const char filename[], const double slope, const double intercept, RestraintType modifier=RESTRAINT_SHAPE, const bool IsPseudoEnergy=true)
 Read SHAPE data from disk. More...
 
int ReadSHAPE (const char filename[], const double dsSlope, const double dsIntercept, const double ssSlope, const double ssIntercept, RestraintType modifier=RESTRAINT_SHAPE)
 Read SHAPE data from disk including single-stranded SHAPE pseudo free energys. More...
 
int ReadDMS (const char filename[])
 
int ReadDSO (const char filename[])
 Read double strand offset data from disk. More...
 
int ReadSSO (const char filename[])
 Read single strand offset data from disk. More...
 
int ReadExperimentalPairBonus (const char filename[], double const experimentalOffset, double const experimentalScaling)
 Read experimental pair bonuses from disk. More...
 
void RemoveConstraints ()
 Remove all folding constraints. More...
 
int SetExtrinsic (int i, int j, double k)
 Add extrinsic restraints for partition function calculations. More...
 
int WriteConstraints (const char filename[])
 Write the current set of folding constraints to disk in a plain text file. More...
 
int AddComment (const char comment[], const int structurenumber=1)
 Add a comment associated with a structure. More...
 
int WriteCt (const char filename[], bool append=false, CTCommentProvider &commentProvider=CTComments::Energy) const
 Write a ct file of the structures. More...
 
int WriteDotBracket (const char filename[], const int structurenumber=-1, const DotBracketFormat format=DBN_FMT_MULTI_TITLE, CTCommentProvider &commentProvider=CTComments::Energy) const
 Write dot-bracket file of structures. More...
 
int BreakPseudoknot (const bool minimum_energy=true, const int structurenumber=0, const bool useFastMethod=true)
 Break any pseudoknots that might be in a structure. More...
 
bool ContainsPseudoknot (const int structurenumber)
 Report if there are any pseudoknots in a structure. More...
 
double GetEnsembleEnergy ()
 Get the ensemble folding free energy change. More...
 
double GetEnsembleDefect (const int structurenumber=1)
 Get the ensemble defect of a secondary structure. More...
 
double GetFreeEnergy (const int structurenumber)
 Get the folding free energy change for a predicted structure. More...
 
int GetPair (const int i, const int structurenumber=1)
 Get the nucleotide to which the specified nucleotide is paired. More...
 
double GetPairEnergy (const int i, const int j)
 Get the lowest folding free energy possible for a structure containing pair i-j. More...
 
double GetPairProbability (const int i, const int j)
 Get a base pair probability. More...
 
int GetPairProbabilities (double *arr, const int size)
 
int GetStructureNumber () const
 Get the total number of specified or predicted structures. More...
 
int DetermineDrawingCoordinates (const int height, const int width, const int structurenumber=1)
 Determine the coordinates for drawing a secondary structure. More...
 
std::string GetCommentString (const int structurenumber=1)
 Provide the comment from the ct file as a string. More...
 
int GetNucleotideXCoordinate (const int i)
 Get the X coordinate for nucleotide i for drawing a structure. More...
 
int GetNucleotideYCoordinate (const int i)
 Get the Y coordinate for nucleotide i for drawing a structure. More...
 
int GetLabelXCoordinate (const int i)
 Get the X coordinate for placing the nucleotide index label specified by i. More...
 
int GetLabelYCoordinate (const int i)
 Get the Y coordinate for placing the nucleotide index label specified by i. More...
 
char GetNucleotide (const int i)
 
int GetSequenceLength () const
 Get the total length of the sequence. More...
 
const char * GetSequence () const
 
bool GetBackboneType () const
 Get the backbone type. More...
 
structure * GetStructure ()
 
void SetProgress (ProgressHandler &Progress)
 
void StopProgress ()
 
ProgressHandler * GetProgress ()
 
 ~RNA ()
 Destructor. More...
 
void CopyThermo (Thermodynamics &copy)
 Copy thermodynamic parameters from an instance of an RNA class. More...
 
- Public Member Functions inherited from Thermodynamics
 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 ()
 

Private Member Functions

void commonconstructor (const char fileNameOrsequence1[], const int fileType1, const char fileNameOrsequence2[], const int fileType2)
 
void SetupBimolecular ()
 

Private Attributes

bool forbidunimolecular
 
TwoRNAsequences
 

Additional Inherited Members

- Static Public Member Functions inherited from RNA
static const char * GetErrorMessage (const int error)
 Return error messages based on code from GetErrorCode and other error codes. More...
 
- Public Attributes inherited from Thermodynamics
bool isrna
 
- Protected Member Functions inherited from RNA
int FileReader (const char filename[], const RNAInputType fileType)
 
void init (const char *sequenceOrFileName, const RNAInputType fileType, const bool allowUnknownBases=false, const bool skipThermoTables=false)
 
- Protected Member Functions inherited from Thermodynamics
virtual void CopyThermo (const Thermodynamics &copy)
 Copy thermodynamic parameters from an instance of Thermodynamics class. More...
 
- Protected Attributes inherited from RNA
int ErrorCode
 
ProgressHandler * progress
 
PFPRECISION * w5
 
PFPRECISION * w3
 
PFPRECISION ** wca
 
pfdatatable * pfdata
 
DynProgArray< PFPRECISION > * w
 
DynProgArray< PFPRECISION > * v
 
DynProgArray< PFPRECISION > * wmb
 
DynProgArray< PFPRECISION > * wl
 
DynProgArray< PFPRECISION > * wmbl
 
DynProgArray< PFPRECISION > * wcoax
 
PFPRECISION Q
 
- Protected Attributes inherited from Thermodynamics
datatable * data
 
datatable * enthalpy
 
bool copied
 
double nominal_temperature
 
string nominal_alphabetName
 
bool skipThermoTables
 

Detailed Description

HybridRNA Class.

The HybridRNA class provides an entry point for all the bimolecular structure prediction routines of RNAstructure. The class is inherited from the RNA class and contains an instance of TwoRNA, which itself contains two instances to the class RNA.

Constructor & Destructor Documentation

HybridRNA::HybridRNA ( const char  sequence1[],
const char  sequence2[],
const bool  IsRNA = true 
)

Constructors.

The two constuctors are available to reach the TwoRNA constructors, from which this class is built. Please see the TwoRNA constructor entries for documentation.

HybridRNA::HybridRNA ( const char  filename1[],
const int  type1,
const char  filename2[],
const int  type2,
const bool  IsRNA = true 
)
HybridRNA::HybridRNA ( const char  filename1[],
const int  type1,
const char  filename2[],
const int  type2,
const char *  alphabet 
)
HybridRNA::~HybridRNA ( )

Member Function Documentation

int HybridRNA::AccessFold ( const double  gamma = 0.4,
const float  percent = 50,
const int  maximumstructures = 20,
const int  window = 0,
const int  maxinternalloopsize = 30 
)

Predict the lowest free energy secondary structure for two interacting strands and generate suboptimal structures. This method does not allow intramolecular pairs. It considers accessibility with a heuristic that uses the partition function. If the temperature has not been specified using the RNA base class SetTemperature and no free energies have been calculated, the thermodynamic parameters have not been read and therefore they will be read by this function call. The parameter files should be located in the directory specified by the environment variable $DATAPATH of the pwd. In case of error, the function returns a non-zero that can be parsed by GetErrorMessage() or GetErrorMessageString().

Parameters
gammais a scaling factor that weights accessibility. The defaults is 0.4
percentis the maximum % difference in free energy in suboptimal structures from the lowest free energy structure. The default is 50.
maximumstructuresis the maximum number of suboptimal structures to generate. The fefault is 20.
windowis a parameter that specifies how different the suboptimal structures should be from each other (0=no restriction and larger integers require structures to be more different). The default is 0.
maxinternalloopsizeis the maximum number of unpaired nucleotides in bulge and internal loops. This is used to accelerate the prediction speed. The default is 30.
Returns
An int that indicates an error code (0 = no error, 5 = error reading thermodynamic parameter files, 14 = traceback error).
void HybridRNA::commonconstructor ( const char  fileNameOrsequence1[],
const int  fileType1,
const char  fileNameOrsequence2[],
const int  fileType2 
)
private
int HybridRNA::FoldBimolecular ( const float  percent = 10,
const int  maximumstructures = 20,
const int  window = 0,
const char  savefile[] = "",
const int  maxinternalloopsize = 30 
)

Predict the lowest free energy secondary structure and generate suboptimal structures using a heuristic.

This function predicts the lowest free energy structure and suboptimal structures. If the temperature has not been specified using the RNA base class SetTemperature and no free energies have been calculated, the thermodynamic parameters have not been read and therefore they will be read by this function call. The parameter files should be located in the directory specified by the environment variable $DATAPATH of the pwd. In case of error, the function returns a non-zero that can be parsed by GetErrorMessage() or GetErrorMessageString().

Parameters
percentis the maximum % difference in free energy in suboptimal structures from the lowest free energy structure. The default is 10.
maximumstructuresis the maximum number of suboptimal structures to generate. The defaults is 20.
windowis a parameter that specifies how different the suboptimal structures should be from each other (0=no restriction and larger integers require structures to be more different). The default is 0.
savefileis c string containing a file path and name for a savefile (.sav)that can be used to generate energy dot plots and to refold the secondary structure using different suboptimal structure parameters. The default is "", which results in no save file written.
maxinternalloopsizeis the maximum number of unpaired nucleotides in bulge and internal loops. This is used to accelerate the prediction speed. The default is 30.
Returns
An int that indicates an error code (0 = no error, 5 = error reading thermodynamic parameter files, 14 = traceback error).
int HybridRNA::FoldDuplex ( const float  percent = 40,
const int  maximumstructures = 10,
const int  window = 0,
const int  maxinternalloopsize = 30 
)

Predict the lowest free energy secondary structure for two strands that cannot form intramolecular pairs and generate suboptimal structures using a heuristic.

This function predicts the lowest free energy bimolecular structure and suboptimal structures. This function does not allow any folding constraints. If the temperature has not been specified using SetTemperature and no free energies have been calculated, the thermodynamic parameters have not been read and therefore they will be read by this function call. The parameter files should be located in the directory specified by the environment variable $DATAPATH of the pwd. In case of error, the function returns a non-zero that can be parsed by GetErrorMessage() or GetErrorMessageString().

Parameters
percentis the maximum % difference in free energy in suboptimal structures from the lowest free energy structure. The default is 40.
maximumstructuresis the maximum number of suboptimal structures to generate. The default is 10.
windowis a parameter that specifies how different the suboptimal structures should be from each other (0=no restriction and larger integers require structures to be more different). The default is 0.
maxinternalloopsizeis the maximum number of unpaired nucleotides in bulge and internal loops. This is used to accelerate the prediction speed. The default is 30.
Returns
An int that indicates an error code (0 = no error, 5 = error reading thermodynamic parameter files, 14 = traceback error).
int HybridRNA::GetErrorCode ( )

Return an error code, where a return of zero is no error.

This function returns and error flag that is generated during construction by RNA(const char &filename, const int type, const bool IsRNA=true) or from CalculateFreeEnergy(). An error of zero is always no error. Other codes are errors and a c-string can be fetched for the error with GetErrorMessage().

Returns
An integer that provides the error code.
const char * HybridRNA::GetErrorMessage ( const int  error)

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

0 = no error <100 = Error to be fetched from RNA base class. 100-999 = Error associated with bimolecular folding, to be handled here. >=1000 = Errors for underlying sequence, get message from TwoRNA base class.

Parameters
erroris the integer error code provided by GetErrorCode().
Returns
A pointer to a c string that provides an error message or from other functions that return integer error codes.
bool HybridRNA::GetForbidIntramolecular ( )

Get whether intramolecular pairs are allowed.

Returns
A bool that indicates whether intramolecular pairs are forbidden (true = forbidden, false = not).
RNA * HybridRNA::GetRNA1 ( )

Access the underlying RNA class from an instance of TwoRNA. This is provided for use with two sequence methods. Generally, there is no need for end users to use this function.

Returns
A pointer to the underlying RNA class for sequence 1.
RNA * HybridRNA::GetRNA2 ( )

Access the underlying RNA class from an instance of TwoRNA. This is provided for use with two sequence methods. Generally, there is no need for end users to use this function.

Returns
A pointer to the underlying RNA class for sequence 2.
int HybridRNA::PartitionFunctionBimolecular ( const char  savefile[] = "")

Predict the bimolecular partition function for a sequence (with no intramolecular pairs).

This function must be called to predict base pair probabilities, perform stochastic traceback, or for maximizing expected accuracy. This predicts the partition function without intramolecular pairs. If the temperature has not been specified using SetTemperature and no free energies have been calculated, the thermodynamic parameters have not been read and therefore they will be read by this function call. The parameter files should be located in the directory specified by the environment variable $DATAPATH of the pwd. In case of error, the function returns a non-zero that can be parsed by GetErrorMessage() or GetErrorMessageString().

Parameters
savefileis a c string that contains the path and filename for creating a save file. This defaults to "", which indicates no file is to be written.
Returns
An int that indicates an error code (0 = no error, 5 = error reading thermodynamic parameter files).
void HybridRNA::SetForbidIntramolecular ( const bool  forbid)

Set whether intramolecular pairs are allowed.

If true is passed to this function, intramolecular pairs will be forbidden in FoldBimolecular.

Parameters
forbidis a bool that indicates whether intramolecular pairs are forbid.
void HybridRNA::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
Progressis a TProgressDialog class.
void HybridRNA::SetupBimolecular ( )
private
void HybridRNA::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.

Member Data Documentation

bool HybridRNA::forbidunimolecular
private
TwoRNA* HybridRNA::sequences
private

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