bpp-seq  2.2.0
bpp::SequenceMask Class Reference

#include <Bpp/Seq/SequenceWithAnnotationTools.h>

+ Inheritance diagram for bpp::SequenceMask:
+ Collaboration diagram for bpp::SequenceMask:

Public Member Functions

void init (const Sequence &seq)
 
const std::string & getType () const
 
bool isValidWith (const SequenceWithAnnotation &sequence, bool throwException=true) const
 Test is the annotation is valid for a given sequence. More...
 
bool isRemovable () const
 
bool isShared () const
 
void beforeSequenceChanged (const SymbolListEditionEvent &event)
 
void afterSequenceChanged (const SymbolListEditionEvent &event)
 
void beforeSequenceInserted (const SymbolListInsertionEvent &event)
 
void afterSequenceInserted (const SymbolListInsertionEvent &event)
 
void beforeSequenceDeleted (const SymbolListDeletionEvent &event)
 
void afterSequenceDeleted (const SymbolListDeletionEvent &event)
 
void beforeSequenceSubstituted (const SymbolListSubstitutionEvent &event)
 
void afterSequenceSubstituted (const SymbolListSubstitutionEvent &event)
 
size_t getSize () const
 
const bool operator[] (size_t i) const
 
void setMask (const std::vector< bool > &mask)
 
const std::vector< bool > & getMask () const
 
void setMask (size_t pos, bool mask)
 
void setMask (size_t pos, const std::vector< bool > &mask)
 
bool merge (const SequenceAnnotation &anno)
 Merge the input annotation with the current one. More...
 
SequenceAnnotationgetPartAnnotation (size_t pos, size_t len) const throw (Exception)
 
Constructors
 SequenceMask (size_t size=0, bool removable=true)
 Build a new SequenceMask object. More...
 
 SequenceMask (const std::vector< bool > &mask, bool removable=true)
 Build a new SequenceMask object. More...
 
Destructor
virtual ~SequenceMask ()
 
The Clonable interface
SequenceMaskclone () const
 

Static Public Attributes

static const std::string MASK = "Boolean mask"
 

Private Attributes

bool removable_
 
std::vector< bool > mask_
 

Detailed Description

Definition at line 51 of file SequenceWithAnnotationTools.h.

Constructor & Destructor Documentation

◆ SequenceMask() [1/2]

bpp::SequenceMask::SequenceMask ( size_t  size = 0,
bool  removable = true 
)
inline

Build a new SequenceMask object.

Build a new SequenceMask object and set the mask to false.

Parameters
sizeThe size of the sequence.
removableTell if this listener can be removed by the user.

Definition at line 76 of file SequenceWithAnnotationTools.h.

Referenced by clone(), and getPartAnnotation().

◆ SequenceMask() [2/2]

bpp::SequenceMask::SequenceMask ( const std::vector< bool > &  mask,
bool  removable = true 
)
inline

Build a new SequenceMask object.

Build a new SequenceMask object and set the mask as a vector of bool.

Parameters
maskThe boolean mask
removableTell if this listener can be removed by the user.

Definition at line 90 of file SequenceWithAnnotationTools.h.

◆ ~SequenceMask()

virtual bpp::SequenceMask::~SequenceMask ( )
inlinevirtual

Definition at line 101 of file SequenceWithAnnotationTools.h.

Member Function Documentation

◆ afterSequenceChanged()

void SequenceMask::afterSequenceChanged ( const SymbolListEditionEvent event)
virtual

Implements bpp::SymbolListListener.

Definition at line 50 of file SequenceWithAnnotationTools.cpp.

◆ afterSequenceDeleted()

void SequenceMask::afterSequenceDeleted ( const SymbolListDeletionEvent event)
virtual

Implements bpp::SymbolListListener.

Definition at line 66 of file SequenceWithAnnotationTools.cpp.

◆ afterSequenceInserted()

void SequenceMask::afterSequenceInserted ( const SymbolListInsertionEvent event)
virtual

◆ afterSequenceSubstituted()

void bpp::SequenceMask::afterSequenceSubstituted ( const SymbolListSubstitutionEvent event)
inlinevirtual

Implements bpp::SymbolListListener.

Definition at line 140 of file SequenceWithAnnotationTools.h.

◆ beforeSequenceChanged()

void bpp::SequenceMask::beforeSequenceChanged ( const SymbolListEditionEvent event)
inlinevirtual

Implements bpp::SymbolListListener.

Definition at line 133 of file SequenceWithAnnotationTools.h.

◆ beforeSequenceDeleted()

void bpp::SequenceMask::beforeSequenceDeleted ( const SymbolListDeletionEvent event)
inlinevirtual

Implements bpp::SymbolListListener.

Definition at line 137 of file SequenceWithAnnotationTools.h.

◆ beforeSequenceInserted()

void bpp::SequenceMask::beforeSequenceInserted ( const SymbolListInsertionEvent event)
inlinevirtual

Implements bpp::SymbolListListener.

Definition at line 135 of file SequenceWithAnnotationTools.h.

◆ beforeSequenceSubstituted()

void bpp::SequenceMask::beforeSequenceSubstituted ( const SymbolListSubstitutionEvent event)
inlinevirtual

Implements bpp::SymbolListListener.

Definition at line 139 of file SequenceWithAnnotationTools.h.

◆ clone()

SequenceMask* bpp::SequenceMask::clone ( ) const
inlinevirtual

Implements bpp::SequenceAnnotation.

Definition at line 113 of file SequenceWithAnnotationTools.h.

References SequenceMask().

◆ getMask()

const std::vector<bool>& bpp::SequenceMask::getMask ( ) const
inline
Returns
The mask as a vector.

Definition at line 155 of file SequenceWithAnnotationTools.h.

References mask_.

Referenced by merge().

◆ getPartAnnotation()

SequenceAnnotation* bpp::SequenceMask::getPartAnnotation ( size_t  pos,
size_t  len 
) const
throw (Exception
)
inlinevirtual
Returns
A new annotation corresponding to a part of the sequence. The implementation of this highly depends on the annotation type, and might not be supported.
Parameters
posStarting point of the region.
lenThe length of the region, in number of positions.

Implements bpp::SequenceAnnotation.

Definition at line 179 of file SequenceWithAnnotationTools.h.

References mask_, removable_, and SequenceMask().

◆ getSize()

size_t bpp::SequenceMask::getSize ( ) const
inline

Definition at line 142 of file SequenceWithAnnotationTools.h.

References mask_.

◆ getType()

const std::string& bpp::SequenceMask::getType ( ) const
inlinevirtual
Returns
The type of the annotation. This is used for querying annotations.

Implements bpp::SequenceAnnotation.

Definition at line 123 of file SequenceWithAnnotationTools.h.

References MASK.

◆ init()

void bpp::SequenceMask::init ( const Sequence seq)
inlinevirtual

Creates a default annotation according to a given sequence.

Parameters
seqThe template sequence (typically the one with which the annotation will be attached).

Implements bpp::SequenceAnnotation.

Definition at line 117 of file SequenceWithAnnotationTools.h.

References mask_, and bpp::SymbolList::size().

◆ isRemovable()

bool bpp::SequenceMask::isRemovable ( ) const
inlinevirtual

Implements bpp::SymbolListListener.

Definition at line 131 of file SequenceWithAnnotationTools.h.

References removable_.

◆ isShared()

bool bpp::SequenceMask::isShared ( ) const
inlinevirtual

Implements bpp::SymbolListListener.

Definition at line 132 of file SequenceWithAnnotationTools.h.

◆ isValidWith()

bool bpp::SequenceMask::isValidWith ( const SequenceWithAnnotation sequence,
bool  throwException = true 
) const
inlinevirtual

Test is the annotation is valid for a given sequence.

Parameters
sequenceThe sequence to be validated against.
throwExceptionIf set to yes, throw an exception if the sequence is not valid.
Returns
true if this annotation is complient with the given sequence.

Implements bpp::SequenceAnnotation.

Definition at line 125 of file SequenceWithAnnotationTools.h.

References mask_, and bpp::EdSymbolList::size().

◆ merge()

bool bpp::SequenceMask::merge ( const SequenceAnnotation anno)
inlinevirtual

Merge the input annotation with the current one.

Parameters
annoThe annotation to fuse.
Returns
true if the fusion was possible and succesful.

Implements bpp::SequenceAnnotation.

Definition at line 169 of file SequenceWithAnnotationTools.h.

References getMask(), and mask_.

◆ operator[]()

const bool bpp::SequenceMask::operator[] ( size_t  i) const
inline

Definition at line 144 of file SequenceWithAnnotationTools.h.

References mask_.

◆ setMask() [1/3]

void bpp::SequenceMask::setMask ( const std::vector< bool > &  mask)
inline

Definition at line 146 of file SequenceWithAnnotationTools.h.

References mask_.

◆ setMask() [2/3]

void bpp::SequenceMask::setMask ( size_t  pos,
bool  mask 
)
inline

Definition at line 157 of file SequenceWithAnnotationTools.h.

References mask_.

◆ setMask() [3/3]

void bpp::SequenceMask::setMask ( size_t  pos,
const std::vector< bool > &  mask 
)
inline

Definition at line 163 of file SequenceWithAnnotationTools.h.

References mask_.

Member Data Documentation

◆ MASK

const string SequenceMask::MASK = "Boolean mask"
static

Definition at line 59 of file SequenceWithAnnotationTools.h.

Referenced by getType().

◆ mask_

std::vector<bool> bpp::SequenceMask::mask_
private

◆ removable_

bool bpp::SequenceMask::removable_
private

Definition at line 55 of file SequenceWithAnnotationTools.h.

Referenced by getPartAnnotation(), and isRemovable().


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