ppALIGN API documentation
PartitionDriverBase Class Reference
#include <partitionworkspace.hpp>
Public Member Functions | |
| PartitionDriverBase () | |
| virtual | ~PartitionDriverBase () |
| const std::string & | Name () const |
| virtual bool | ProvideAlternativePosteriorProb () |
| void | LocalDangling (bool dang) |
| void | ComputePosterior (bool doit) |
Information for the kind of computation that is needed for the driver. | |
| virtual bool | NeedInitStrip () |
| virtual bool | NeedFirstBackward () |
| virtual bool | NeedBackward () |
| virtual bool | NeedForward () |
| virtual bool | NeedForwardBackward () |
| virtual bool | NeedMarkovChain () |
events | |
| virtual void | BeforeComputation () |
| virtual void | OnForward (long i, const PartitionWorkspace::RowInfo &last_row, const PartitionWorkspace::RowInfo &curr_row, const PartitionWorkspace::const_iterator last, const PartitionWorkspace::const_iterator curr) |
| virtual void | OnBackward (long i, const PartitionWorkspace::RowInfo &last_row, const PartitionWorkspace::RowInfo &curr_row, const PartitionWorkspace::const_iterator last, const PartitionWorkspace::const_iterator curr) |
| virtual void | OnForwardBackward (PartitionWorkspace::ForwardBackwardInfo &fb_info) |
| virtual void | OnMarkovChain (PartitionWorkspace::ForwardBackwardInfo &fb_info, Workspace< PartitionWorkspace::Transition >::const_iterator curr_markov, const xdouble &row_z) |
| virtual void | ForwardDone () |
| virtual void | AfterComputation () |
Public Attributes | |
| std::vector< Align > | alternative_alignments |
Protected Member Functions | |
| virtual void | SetWorkspace (PartitionWorkspace *ws) |
Protected Attributes | |
| bool | do_add_dangling |
| bool | do_compute_posterior |
| std::string | driver_name |
| PartitionWorkspace * | ws |
Friends | |
| class | PartitionWorkspace |
| class | Program |
Detailed Description
A base class to handle customized computation. Information from the main computation defined in class PartitionWorkpsace can be used for this purpose.
Each driver is embedded in the PartitionWorkspace where the main computation is performed. Add a new driver via PartitionWorkspace::AddDriver(). The driver need to tell the PartitionWorkpspace which particular computation is needed.
To develop own drivers that perform computation based on the forward/backward quantities overwrite the virtual methods.
To tell the main algorithm which kind of quantities are required for your computation overwrite the methods
- NeedInitStrip(),
- NeedFirstBackward(),
- NeedBackward(),
- NeedForward(),
- NeedForwardBackward(),
- NeedMarkovChain()
The computation itself is realized in virtual methods which are called for each row (index corresponds to the position in the first sequence) from the main algorithm PartitionWorkspace. These events are
For example, if your algorithm only requires forward variables overwrite the method OnFirstForward(). If your algorithm requires both, backward and forward variables at the same time overwrite the method OnBackward()
- Examples:
Definition at line 706 of file partitionworkspace.hpp.
Constructor & Destructor Documentation
| PartitionDriverBase::PartitionDriverBase | ( | ) |
Constructor.
| virtual PartitionDriverBase::~PartitionDriverBase | ( | ) | [inline, virtual] |
Destructor.
Definition at line 716 of file partitionworkspace.hpp.
Member Function Documentation
| virtual void PartitionDriverBase::AfterComputation | ( | ) | [inline, virtual] |
An event that is thrown when the complete computation has been finished, forward and evtl. backward if required.
Reimplemented in DriverFirstMoment, DriverLocalBound, DriverPosterDecode, DriverPosterProb, and DriverSampling.
Definition at line 891 of file partitionworkspace.hpp.
| virtual void PartitionDriverBase::BeforeComputation | ( | ) | [inline, virtual] |
An event that is thrown before the acutal computation begins.
Reimplemented in DriverFirstMoment, DriverLocalBound, DriverPosterDecode, and DriverSampling.
- Examples:
- pairprobmap.cpp.
Definition at line 800 of file partitionworkspace.hpp.
| void PartitionDriverBase::ComputePosterior | ( | bool | doit | ) | [inline] |
Compute posterior probs for sampled alignments. By default the posterior probs are computed
- Parameters:
-
doit compute probs
Definition at line 1220 of file partitionworkspace.hpp.
| virtual void PartitionDriverBase::ForwardDone | ( | ) | [inline, virtual] |
An event that is thrown when the Forward computation is finished.
- Note:
- This event is forwarded from CheckpointDriver::ForwardDone();
Definition at line 886 of file partitionworkspace.hpp.
| void PartitionDriverBase::LocalDangling | ( | bool | dang | ) | [inline] |
Add dangling gaps in the case of local alignment. By default dangling gaps are not added
- Parameters:
-
dang add gaps if true false otherwise
Definition at line 1217 of file partitionworkspace.hpp.
| const std::string& PartitionDriverBase::Name | ( | ) | const |
Name of the driver. To change the name modify the protected field driver_name;
- Examples:
- alternative_alignments.cpp.
| virtual bool PartitionDriverBase::NeedBackward | ( | ) | [inline, virtual] |
Tell the main algorithm that a callback of OnBackward() for each row is needed. The algorithm provides the current and the last row of the backward computation. These events are emitted as soon as the current and the last row are available for the first time
- Returns:
- true / false
Reimplemented in DriverLocalBound.
Definition at line 754 of file partitionworkspace.hpp.
| virtual bool PartitionDriverBase::NeedFirstBackward | ( | ) | [inline, virtual] |
Tell the main algorithm that a callback for each row is needed when computing it for the first time.
- Returns:
- true if the OnFirstBackward method is to be called for each row once
Definition at line 743 of file partitionworkspace.hpp.
| virtual bool PartitionDriverBase::NeedForward | ( | ) | [inline, virtual] |
Tell the main algorithm that a callback of OnForward() for each row is needed.
- Returns:
- true if the OnForward method is to be called for each row every time the row is (re-)computed
Reimplemented in DriverFirstMoment, and DriverLocalBound.
Definition at line 764 of file partitionworkspace.hpp.
| virtual bool PartitionDriverBase::NeedForwardBackward | ( | ) | [inline, virtual] |
Tell the main algorithm that a callback of OnForwardBackward() for each row is needed when the forward and backward rows are available simulationasly.
- Returns:
- true if the OnForwardBackward() method is to be called for each row every time the row is (re-)computed.
Reimplemented in DriverPosterDecode, and DriverPosterProb.
- Examples:
- pairprobmap.cpp.
Definition at line 774 of file partitionworkspace.hpp.
| virtual bool PartitionDriverBase::NeedInitStrip | ( | ) | [inline, virtual] |
Or'ed bit-field of PartitionWorkspace::AlignmentType. by default 0 is returned.
- Returns:
- the types of alignments the driver is able to handle
- true if the strip size has to be estimated even though the main computation will be computed on the full workspace
Definition at line 735 of file partitionworkspace.hpp.
| virtual bool PartitionDriverBase::NeedMarkovChain | ( | ) | [inline, virtual] |
Tell the main algorithm that a callback of OnMarkovChain() for each row is needed when the forward and backward rows and the markov chain are available simulationasly.
- Returns:
- true if the OnForwardBackward() method is to be called for each row every time the row is (re-)computed.
Reimplemented in DriverSampling.
Definition at line 785 of file partitionworkspace.hpp.
| virtual void PartitionDriverBase::OnBackward | ( | long | i, | |
| const PartitionWorkspace::RowInfo & | last_row, | |||
| const PartitionWorkspace::RowInfo & | curr_row, | |||
| const PartitionWorkspace::const_iterator | last, | |||
| const PartitionWorkspace::const_iterator | curr | |||
| ) | [inline, virtual] |
An event that is emitted whenever the backward partition functions are availiable for row i and row i+1
To obtain the partition functions for row i and column j on has to access the memory via the iterator curr
- Parameters:
-
i row that has been computed (i=-1 ... (length1-1)) last_row information about the last row (the row before the current row) curr_row information (i.e. the strip layout) about the current row (the one that has just be computed) last iterator that points on the begin of the last row (i+1) curr iterator that points on the begin of the current row in the workspace (in the strip layout)
Reimplemented in DriverLocalBound.
Definition at line 849 of file partitionworkspace.hpp.
| virtual void PartitionDriverBase::OnForward | ( | long | i, | |
| const PartitionWorkspace::RowInfo & | last_row, | |||
| const PartitionWorkspace::RowInfo & | curr_row, | |||
| const PartitionWorkspace::const_iterator | last, | |||
| const PartitionWorkspace::const_iterator | curr | |||
| ) | [inline, virtual] |
An event that is emitted whenever the forward partition functions are availiable
To obtain the partition functions for row i and column j on has to access the memory via the iterator curr
xdouble Z_ij = curr[j]
- Parameters:
-
i row that has been computed (i=0 ... (length1-1)) last_row information about the last row (the row before the current row) curr_row information (i.e. the strip layout) about the current row (the one that has just be computed) last iterator that points on the begin of the last row (i-1) curr iterator that points on the begin of the current row in the workspace (in the strip layout)
Reimplemented in DriverFirstMoment, and DriverLocalBound.
Definition at line 825 of file partitionworkspace.hpp.
| virtual void PartitionDriverBase::OnForwardBackward | ( | PartitionWorkspace::ForwardBackwardInfo & | fb_info | ) | [inline, virtual] |
An event that is thrown when both, the forward and the backward sums are available. The the checkpoint method in the main algorithm in PartitionWorkspace assures that each row is available in increasing index i
- Parameters:
-
fb_info forward and backward data
Reimplemented in DriverPosterDecode, and DriverPosterProb.
- Examples:
- pairprobmap.cpp.
Definition at line 865 of file partitionworkspace.hpp.
| virtual void PartitionDriverBase::OnMarkovChain | ( | PartitionWorkspace::ForwardBackwardInfo & | fb_info, | |
| Workspace< PartitionWorkspace::Transition >::const_iterator | curr_markov, | |||
| const xdouble & | row_z | |||
| ) | [inline, virtual] |
An event that is thrown when both, the forward and the backward sums are available. The the checkpoint method in the main algorithm in PartitionWorkspace assures that each row is available in increasing index i
- Parameters:
-
fb_info forward and backward data curr_markov transition matrix for the heteriogenious Markov chain. row_z forward sum of the row for starting an alignment in row i
Reimplemented in DriverSampling.
Definition at line 877 of file partitionworkspace.hpp.
| virtual bool PartitionDriverBase::ProvideAlternativePosteriorProb | ( | ) | [inline, virtual] |
- Returns:
- true, if algorithm produces posterior probs. for alternative alignments
Definition at line 792 of file partitionworkspace.hpp.
| virtual void PartitionDriverBase::SetWorkspace | ( | PartitionWorkspace * | ws | ) | [protected, virtual] |
Set workspace and initalize callback functions
Member Data Documentation
| std::vector<Align> PartitionDriverBase::alternative_alignments |
a vector containing the alternative alignments. Fill this vector with alternative alignments produced by your algorithm. The alignments will be reported by the main program in the XML output. Also the overlap with the optimal alignment is reported in the output.
- Examples:
- alternative_alignments.cpp.
Definition at line 901 of file partitionworkspace.hpp.
std::string PartitionDriverBase::driver_name [protected] |
a name of the driver. Set this variable in the constructor of derived classes.
Definition at line 923 of file partitionworkspace.hpp.
PartitionWorkspace* PartitionDriverBase::ws [protected] |
A reference to the PartitionWorkspace object where the main computation is performed.
Definition at line 928 of file partitionworkspace.hpp.
The documentation for this class was generated from the following file: