ppALIGN API documentation

DriverSampling Class Reference

#include <sampling.hpp>

Inheritance diagram for DriverSampling:
PartitionDriverBase

List of all members.

Classes

struct  AlignPath

Public Member Functions

 DriverSampling (DRand48 &_rng)
void SetNumber (size_t n)
size_t GetNumber ()
virtual void OnMarkovChain (PartitionWorkspace::ForwardBackwardInfo &fb_info, Workspace< PartitionWorkspace::Transition >::const_iterator curr_markov, const xdouble &row_z)
virtual bool NeedMarkovChain ()
virtual void BeforeComputation ()
virtual void AfterComputation ()

Detailed Description

This driver can be used to sample alignments from the posterior distribution. Register an instance of this driver (PartitionWorkspace::AddDriver) to retrieve a set of sampled alignments.

 #include <partitionworkspace.hpp>
...
DRand48 rng(1);
...
PartitionWorkspace pws(100000);
DriverSampling     sampling(rng);
sampling.SetNumber(10);
pws.AddDriver(sampling);
...
pws.PartitionFunction(seq1,
                      seq2,
                      weight);
cout << "sampled alignments" << endl;
for(vector<Align>::iterator itr = sampling.alternative_alignments.begin();
    itr != sampling.alternative_alignments.end();
    ++itr) 
   {
     cout << *itr << endl;
   }
Examples:

alternative_alignments.cpp.

Definition at line 51 of file sampling.hpp.


Constructor & Destructor Documentation

DriverSampling::DriverSampling ( DRand48 _rng  ) 

Constructor.

Parameters:
_rng reference to a random number generator

Member Function Documentation

virtual void DriverSampling::AfterComputation (  )  [virtual]

An event that is thrown when the complete computation has been finished, forward and evtl. backward if required.

Reimplemented from PartitionDriverBase.

virtual void DriverSampling::BeforeComputation (  )  [virtual]

An event that is thrown before the acutal computation begins.

Reimplemented from PartitionDriverBase.

size_t DriverSampling::GetNumber (  ) 

Get the number of alignments to be sampled.

virtual bool DriverSampling::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 from PartitionDriverBase.

Definition at line 72 of file sampling.hpp.

virtual void DriverSampling::OnMarkovChain ( PartitionWorkspace::ForwardBackwardInfo fb_info,
Workspace< PartitionWorkspace::Transition >::const_iterator  curr_markov,
const xdouble row_z 
) [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 from PartitionDriverBase.

void DriverSampling::SetNumber ( size_t  n  ) 

Set the number of alignments to be sampled.

Examples:
alternative_alignments.cpp.

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