contextFold.rnaFolding
Class Folder

java.lang.Object
  extended by contextFold.rnaFolding.Folder
All Implemented Interfaces:
Fold

public final class Folder
extends java.lang.Object
implements Fold

An object that implements the (dynamic programming Zuker-like) RNA folding prediction algorithm. The implementation utilizes sparsification techniques, which were presented in: Rolf Backofen, Dekel Tsur, Shay Zakov, and Michal Ziv-Ukelson. Sparse RNA Folding: Time and Space Efficient Algorithms. Journal of Discrete Algorithms, Volume 9, Issue 1, March 2011, Pages 12-31, 20th Anniversary Edition of the Annual Symposium on Combinatorial Pattern Matching (CPM 2009).


Field Summary
 long concatanations
           
 FeatureManager fm
           
 long naivSplits
           
 long[] octPerLength
           
 long[] seqPerLength
           
 boolean sparseByOcts
           
 boolean sparseBySteps
           
 long[] splitsPerLength
           
 
Constructor Summary
Folder()
          Constructs a Folder object.
Folder(FeatureManager featureManager)
          Construct a folder which uses the scoring model of the given feature manager.
Folder(java.lang.String modelPath)
          Construct a folder which uses the scoring model of the given feature manager.
 
Method Summary
 float computeDPTables(StructreElementsScorer es, java.util.List<int[]> optFoldings, int numOfOutputFoldings)
          Fills the dynamic programming scoring tables.
 void initializeTables(int n)
           
static void main(java.lang.String[] args)
           
 long naivSplits(long n)
          Computes the number of split-points needed to be examined in order to find optimal branching structure, in which both subsequence endpoints i and j are paired (not to each other).
 java.lang.String predictFolding(java.lang.String sequence)
           
static void printStructure(int[] S, int[] matchIxs)
           
 void resetCounts()
           
 void setFeatureManager(FeatureManager featureManager)
          A setter to the feature manager of the folder (the scoring model).
 void setFeatureManager(java.lang.String modelPath)
          A setter to the feature manager of the folder (the scoring model).
 java.util.List<RNA> tagMany(java.lang.String listInput)
           
 RNA tagOne(java.lang.String sequence)
          Deprecated. 
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fm

public FeatureManager fm

octPerLength

public long[] octPerLength

splitsPerLength

public long[] splitsPerLength

seqPerLength

public long[] seqPerLength

concatanations

public long concatanations

naivSplits

public long naivSplits

sparseByOcts

public boolean sparseByOcts

sparseBySteps

public boolean sparseBySteps
Constructor Detail

Folder

public Folder()
Constructs a Folder object. Note that this folder will throw exceptions if used before setting a feature manager.


Folder

public Folder(FeatureManager featureManager)
Construct a folder which uses the scoring model of the given feature manager.

Parameters:
featureManager - a FeatureManager object that defines a scoring model.

Folder

public Folder(java.lang.String modelPath)
       throws java.io.IOException,
              java.lang.ClassNotFoundException
Construct a folder which uses the scoring model of the given feature manager.

Parameters:
modelPath - a path to a serialized (trained) FeatureManager object.
Throws:
java.io.IOException - - an I/O error has occurred.
java.lang.ClassNotFoundException - - Class of a serialized object cannot be found.
Method Detail

setFeatureManager

public void setFeatureManager(FeatureManager featureManager)
A setter to the feature manager of the folder (the scoring model).

Parameters:
featureManager - a FeatureManager object.

setFeatureManager

public void setFeatureManager(java.lang.String modelPath)
                       throws java.io.IOException,
                              java.lang.ClassNotFoundException
A setter to the feature manager of the folder (the scoring model).

Parameters:
modelPath - a path to a serialized (trained) FeatureManager object.
Throws:
java.io.IOException - - an I/O error has occurred.
java.lang.ClassNotFoundException - - Class of a serialized object cannot be found.

computeDPTables

public float computeDPTables(StructreElementsScorer es,
                             java.util.List<int[]> optFoldings,
                             int numOfOutputFoldings)
Fills the dynamic programming scoring tables.

Parameters:
es - a StructreElementsScorer object that defines structural element scores (this object wraps the input RNA string).
optFoldings - a handle in which computed optimal solutions are returned. Currently only one optimal solution is computed (might change in the future).
numOfOutputFoldings - CURRENTLY NOT WORKING. In the future: allows to specify the number of returned (sub) optimal foldings.
Returns:
the score of the optimal folding.

initializeTables

public void initializeTables(int n)

printStructure

public static void printStructure(int[] S,
                                  int[] matchIxs)

naivSplits

public long naivSplits(long n)
Computes the number of split-points needed to be examined in order to find optimal branching structure, in which both subsequence endpoints i and j are paired (not to each other).

The minimum split-point index is i+MIN_HAIRPIN_LENGTH+2, and the maximum index is j-MIN_HAIRPIN_LENGTH-1, and thus there are j-i-2*MIN_HAIRPIN_LENGTH-2 split-points to examine (or 0, if j-i < 2*MIN_HAIRPIN_LENGTH+2). The return value of this function is the result of summing the above term for all pairs of indices i,j in the sequence.

Parameters:
n - sequence length.
Returns:
the number of split-points which are examined by the standard algorithm.

tagMany

public java.util.List<RNA> tagMany(java.lang.String listInput)
Specified by:
tagMany in interface Fold

tagOne

@Deprecated
public RNA tagOne(java.lang.String sequence)
Deprecated. 

Specified by:
tagOne in interface Fold

predictFolding

public java.lang.String predictFolding(java.lang.String sequence)
                                throws java.io.IOException,
                                       java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

resetCounts

public void resetCounts()

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException,
                        java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException