bpp-seq-omics  2.4.1
bpp::AlignmentFilterMafIterator Class Reference

Filter maf blocks to remove ambiguously aligned or non-informative regions. More...

#include <Bpp/Seq/Io/Maf/AlignmentFilterMafIterator.h>

+ Inheritance diagram for bpp::AlignmentFilterMafIterator:
+ Collaboration diagram for bpp::AlignmentFilterMafIterator:

Public Member Functions

 AlignmentFilterMafIterator (MafIterator *iterator, const std::vector< std::string > &species, unsigned int windowSize, unsigned int step, unsigned int maxGap, double maxEnt, bool keepTrashedBlocks, bool missingAsGap)
 Create a new AlignmentFilterMafIterator with absolute thresholds. More...
 
 AlignmentFilterMafIterator (MafIterator *iterator, const std::vector< std::string > &species, unsigned int windowSize, unsigned int step, double maxPropGap, double maxEnt, bool keepTrashedBlocks, bool missingAsGap)
 Create a new AlignmentFilterMafIterator with relative thresholds. More...
 
MafBlocknextRemovedBlock ()
 Get the next available removed alignment block. More...
 
void setLogStream (std::shared_ptr< OutputStream > logstream)
 
void addIterationListener (IterationListener *listener)
 
MafBlocknextBlock ()
 Get the next available alignment block. More...
 
bool isVerbose () const
 
void setVerbose (bool yn)
 

Protected Member Functions

virtual void fireIterationStartSignal_ ()
 
virtual void fireIterationMoveSignal_ (const MafBlock &currentBlock)
 
virtual void fireIterationStopSignal_ ()
 

Protected Attributes

MafIteratoriterator_
 
MafBlockcurrentBlock_
 
std::shared_ptr< OutputStreamlogstream_
 
std::vector< IterationListener * > iterationListeners_
 
bool started_
 
bool verbose_
 

Private Member Functions

MafBlockanalyseCurrentBlock_ ()
 

Private Attributes

std::vector< std::string > species_
 
unsigned int windowSize_
 
unsigned int step_
 
unsigned int maxGap_
 
double maxPropGap_
 
double maxEnt_
 
std::deque< MafBlock * > blockBuffer_
 
std::deque< MafBlock * > trashBuffer_
 
std::deque< std::vector< int > > window_
 
bool keepTrashedBlocks_
 
bool missingAsGap_
 
bool relative_
 

Detailed Description

Filter maf blocks to remove ambiguously aligned or non-informative regions.

Regions with a too high proportion of gaps, unknown character or high entropy in a set of species will be removed, and blocks adjusted accordingly.

The total entropy of a window is defined as $ \frac{\sum_i {E(5)}_i}{w} $ where $E(5)_i$ is the shannon entropy of site i, computed using a logarithm of base 5, and w is the window size. As a result, the total entropy is normalized so that it falls between 0 and 1. A logarithm of base 5 is used to account for the fact that gaps are considered as a state.

In case a sequence from the list is missing, it can be either ignored or counted as a full sequence of gaps.

Definition at line 63 of file AlignmentFilterMafIterator.h.

Constructor & Destructor Documentation

◆ AlignmentFilterMafIterator() [1/2]

bpp::AlignmentFilterMafIterator::AlignmentFilterMafIterator ( MafIterator iterator,
const std::vector< std::string > &  species,
unsigned int  windowSize,
unsigned int  step,
unsigned int  maxGap,
double  maxEnt,
bool  keepTrashedBlocks,
bool  missingAsGap 
)
inline

Create a new AlignmentFilterMafIterator with absolute thresholds.

Parameters
iteratorInput iterator
speciesSelection of species on which filtering criteria are applied. Results of filtering will be applied to all species.
windowSizeSize of the sliding window (nt).
stepStep by which windows are moved (nt).
maxGapMaximum number of gaps allowed in the window.
maxEntMaximum entropy allowed in the window.
keepTrashedBlocksRemoved windows are kept as separate blocks.
missingAsGapAdd missing species as gap sequences where needed.

Definition at line 96 of file AlignmentFilterMafIterator.h.

◆ AlignmentFilterMafIterator() [2/2]

bpp::AlignmentFilterMafIterator::AlignmentFilterMafIterator ( MafIterator iterator,
const std::vector< std::string > &  species,
unsigned int  windowSize,
unsigned int  step,
double  maxPropGap,
double  maxEnt,
bool  keepTrashedBlocks,
bool  missingAsGap 
)
inline

Create a new AlignmentFilterMafIterator with relative thresholds.

Parameters
iteratorInput iterator
speciesSelection of species on which filtering criteria are applied. Results of filtering will be applied to all species.
windowSizeSize of the sliding window (nt).
stepStep by which windows are moved (nt).
maxPropGapMaximum proportion of gaps allowed in the window.
maxEntMaximum entropy allowed in the window.
keepTrashedBlocksRemoved windows are kept as separate blocks.
missingAsGapAdd missing species as gap sequences where needed.

Definition at line 132 of file AlignmentFilterMafIterator.h.

Member Function Documentation

◆ addIterationListener()

void bpp::AbstractMafIterator::addIterationListener ( IterationListener listener)
inlinevirtualinherited

Implements bpp::MafIterator.

Definition at line 99 of file MafIterator.h.

References bpp::AbstractMafIterator::iterationListeners_.

◆ analyseCurrentBlock_()

◆ fireIterationMoveSignal_()

void AbstractMafIterator::fireIterationMoveSignal_ ( const MafBlock currentBlock)
protectedvirtualinherited

Definition at line 57 of file MafIterator.cpp.

Referenced by bpp::AbstractMafIterator::nextBlock().

◆ fireIterationStartSignal_()

void AbstractMafIterator::fireIterationStartSignal_ ( )
protectedvirtualinherited

Definition at line 51 of file MafIterator.cpp.

Referenced by bpp::AbstractMafIterator::nextBlock().

◆ fireIterationStopSignal_()

void AbstractMafIterator::fireIterationStopSignal_ ( )
protectedvirtualinherited

Definition at line 63 of file MafIterator.cpp.

Referenced by bpp::AbstractMafIterator::nextBlock().

◆ isVerbose()

bool bpp::AbstractMafIterator::isVerbose ( ) const
inlinevirtualinherited

Implements bpp::MafIterator.

Definition at line 116 of file MafIterator.h.

References bpp::AbstractMafIterator::verbose_.

◆ nextBlock()

MafBlock* bpp::AbstractMafIterator::nextBlock ( )
inlinevirtualinherited

Get the next available alignment block.

Returns
A maf alignment block, or a null pointer if no more block is available.

Implements bpp::MafIterator.

Definition at line 103 of file MafIterator.h.

References bpp::AbstractMafIterator::analyseCurrentBlock_(), bpp::AbstractMafIterator::fireIterationMoveSignal_(), bpp::AbstractMafIterator::fireIterationStartSignal_(), bpp::AbstractMafIterator::fireIterationStopSignal_(), and bpp::AbstractMafIterator::started_.

◆ nextRemovedBlock()

MafBlock* bpp::AlignmentFilterMafIterator::nextRemovedBlock ( )
inlinevirtual

Get the next available removed alignment block.

Returns
A maf alignment block, or a null pointer if no more block is available.

Implements bpp::MafTrashIterator.

Definition at line 157 of file AlignmentFilterMafIterator.h.

References trashBuffer_.

◆ setLogStream()

void bpp::AbstractFilterMafIterator::setLogStream ( std::shared_ptr< OutputStream logstream)
inlineinherited

Definition at line 178 of file MafIterator.h.

References bpp::AbstractFilterMafIterator::logstream_.

◆ setVerbose()

void bpp::AbstractMafIterator::setVerbose ( bool  yn)
inlinevirtualinherited

Implements bpp::MafIterator.

Definition at line 117 of file MafIterator.h.

References bpp::AbstractMafIterator::verbose_.

Member Data Documentation

◆ blockBuffer_

std::deque<MafBlock*> bpp::AlignmentFilterMafIterator::blockBuffer_
private

Definition at line 74 of file AlignmentFilterMafIterator.h.

◆ currentBlock_

◆ iterationListeners_

std::vector<IterationListener*> bpp::AbstractMafIterator::iterationListeners_
protectedinherited

Definition at line 89 of file MafIterator.h.

Referenced by bpp::AbstractMafIterator::addIterationListener().

◆ iterator_

◆ keepTrashedBlocks_

bool bpp::AlignmentFilterMafIterator::keepTrashedBlocks_
private

Definition at line 77 of file AlignmentFilterMafIterator.h.

◆ logstream_

◆ maxEnt_

double bpp::AlignmentFilterMafIterator::maxEnt_
private

Definition at line 73 of file AlignmentFilterMafIterator.h.

◆ maxGap_

unsigned int bpp::AlignmentFilterMafIterator::maxGap_
private

Definition at line 71 of file AlignmentFilterMafIterator.h.

◆ maxPropGap_

double bpp::AlignmentFilterMafIterator::maxPropGap_
private

Definition at line 72 of file AlignmentFilterMafIterator.h.

◆ missingAsGap_

bool bpp::AlignmentFilterMafIterator::missingAsGap_
private

Definition at line 78 of file AlignmentFilterMafIterator.h.

◆ relative_

bool bpp::AlignmentFilterMafIterator::relative_
private

Definition at line 79 of file AlignmentFilterMafIterator.h.

◆ species_

std::vector<std::string> bpp::AlignmentFilterMafIterator::species_
private

Definition at line 68 of file AlignmentFilterMafIterator.h.

◆ started_

bool bpp::AbstractMafIterator::started_
protectedinherited

Definition at line 90 of file MafIterator.h.

Referenced by bpp::AbstractMafIterator::nextBlock().

◆ step_

unsigned int bpp::AlignmentFilterMafIterator::step_
private

Definition at line 70 of file AlignmentFilterMafIterator.h.

◆ trashBuffer_

std::deque<MafBlock*> bpp::AlignmentFilterMafIterator::trashBuffer_
private

Definition at line 75 of file AlignmentFilterMafIterator.h.

Referenced by nextRemovedBlock().

◆ verbose_

bool bpp::AbstractMafIterator::verbose_
protectedinherited

◆ window_

std::deque< std::vector<int> > bpp::AlignmentFilterMafIterator::window_
private

Definition at line 76 of file AlignmentFilterMafIterator.h.

◆ windowSize_

unsigned int bpp::AlignmentFilterMafIterator::windowSize_
private

Definition at line 69 of file AlignmentFilterMafIterator.h.


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