bpp-seq3  3.0.0
bpp::SequenceMask Class Referenceabstract

#include <Bpp/Seq/SequenceWithAnnotationTools.h>

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

Public Member Functions

void init (const Sequence &seq) override
 
const std::string & getType () const override
 
bool isValidWith (const SequenceWithAnnotation &sequence, bool throwException=true) const override
 Test is the annotation is valid for a given sequence. More...
 
bool isRemovable () const override
 
bool isShared () const override
 
void beforeSequenceChanged (const IntSymbolListEditionEvent &event) override
 
void afterSequenceChanged (const IntSymbolListEditionEvent &event) override
 
void beforeSequenceInserted (const IntSymbolListInsertionEvent &event) override
 
void afterSequenceInserted (const IntSymbolListInsertionEvent &event) override
 
void beforeSequenceDeleted (const IntSymbolListDeletionEvent &event) override
 
void afterSequenceDeleted (const IntSymbolListDeletionEvent &event) override
 
void beforeSequenceSubstituted (const IntSymbolListSubstitutionEvent &event) override
 
void afterSequenceSubstituted (const IntSymbolListSubstitutionEvent &event) override
 
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) override
 Merge the input annotation with the current one. More...
 
std::unique_ptr< SequenceAnnotationgetPartAnnotation (size_t pos, size_t len) const override
 
virtual void beforeSequenceChanged (const CoreSymbolListEditionEvent< T > &event)=0
 
virtual void afterSequenceChanged (const CoreSymbolListEditionEvent< T > &event)=0
 
virtual void beforeSequenceInserted (const CoreSymbolListInsertionEvent< T > &event)=0
 
virtual void afterSequenceInserted (const CoreSymbolListInsertionEvent< T > &event)=0
 
virtual void beforeSequenceDeleted (const CoreSymbolListDeletionEvent< T > &event)=0
 
virtual void afterSequenceDeleted (const CoreSymbolListDeletionEvent< T > &event)=0
 
virtual void beforeSequenceSubstituted (const CoreSymbolListSubstitutionEvent< T > &event)=0
 
virtual void afterSequenceSubstituted (const CoreSymbolListSubstitutionEvent< T > &event)=0
 
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 override
 

Static Public Attributes

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

Private Attributes

bool removable_
 
std::vector< bool > mask_
 

Detailed Description

Definition at line 16 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 40 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 54 of file SequenceWithAnnotationTools.h.

◆ ~SequenceMask()

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

Definition at line 65 of file SequenceWithAnnotationTools.h.

Member Function Documentation

◆ afterSequenceChanged() [1/2]

template<class T >
virtual void bpp::CoreSymbolListListener< T >::afterSequenceChanged ( const CoreSymbolListEditionEvent< T > &  event)
pure virtualinherited

◆ afterSequenceChanged() [2/2]

void SequenceMask::afterSequenceChanged ( const IntSymbolListEditionEvent event)
override

◆ afterSequenceDeleted() [1/2]

template<class T >
virtual void bpp::CoreSymbolListListener< T >::afterSequenceDeleted ( const CoreSymbolListDeletionEvent< T > &  event)
pure virtualinherited

◆ afterSequenceDeleted() [2/2]

void SequenceMask::afterSequenceDeleted ( const IntSymbolListDeletionEvent event)
override

◆ afterSequenceInserted() [1/2]

template<class T >
virtual void bpp::CoreSymbolListListener< T >::afterSequenceInserted ( const CoreSymbolListInsertionEvent< T > &  event)
pure virtualinherited

◆ afterSequenceInserted() [2/2]

void SequenceMask::afterSequenceInserted ( const IntSymbolListInsertionEvent event)
override

◆ afterSequenceSubstituted() [1/2]

template<class T >
virtual void bpp::CoreSymbolListListener< T >::afterSequenceSubstituted ( const CoreSymbolListSubstitutionEvent< T > &  event)
pure virtualinherited

◆ afterSequenceSubstituted() [2/2]

void bpp::SequenceMask::afterSequenceSubstituted ( const IntSymbolListSubstitutionEvent event)
inlineoverride

Definition at line 99 of file SequenceWithAnnotationTools.h.

◆ beforeSequenceChanged() [1/2]

template<class T >
virtual void bpp::CoreSymbolListListener< T >::beforeSequenceChanged ( const CoreSymbolListEditionEvent< T > &  event)
pure virtualinherited

◆ beforeSequenceChanged() [2/2]

void bpp::SequenceMask::beforeSequenceChanged ( const IntSymbolListEditionEvent event)
inlineoverride

Definition at line 92 of file SequenceWithAnnotationTools.h.

◆ beforeSequenceDeleted() [1/2]

template<class T >
virtual void bpp::CoreSymbolListListener< T >::beforeSequenceDeleted ( const CoreSymbolListDeletionEvent< T > &  event)
pure virtualinherited

◆ beforeSequenceDeleted() [2/2]

void bpp::SequenceMask::beforeSequenceDeleted ( const IntSymbolListDeletionEvent event)
inlineoverride

Definition at line 96 of file SequenceWithAnnotationTools.h.

◆ beforeSequenceInserted() [1/2]

template<class T >
virtual void bpp::CoreSymbolListListener< T >::beforeSequenceInserted ( const CoreSymbolListInsertionEvent< T > &  event)
pure virtualinherited

◆ beforeSequenceInserted() [2/2]

void bpp::SequenceMask::beforeSequenceInserted ( const IntSymbolListInsertionEvent event)
inlineoverride

Definition at line 94 of file SequenceWithAnnotationTools.h.

◆ beforeSequenceSubstituted() [1/2]

template<class T >
virtual void bpp::CoreSymbolListListener< T >::beforeSequenceSubstituted ( const CoreSymbolListSubstitutionEvent< T > &  event)
pure virtualinherited

◆ beforeSequenceSubstituted() [2/2]

void bpp::SequenceMask::beforeSequenceSubstituted ( const IntSymbolListSubstitutionEvent event)
inlineoverride

Definition at line 98 of file SequenceWithAnnotationTools.h.

◆ clone()

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

Implements bpp::SequenceAnnotation.

Definition at line 72 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 115 of file SequenceWithAnnotationTools.h.

References mask_.

Referenced by merge().

◆ getPartAnnotation()

std::unique_ptr<SequenceAnnotation> bpp::SequenceMask::getPartAnnotation ( size_t  pos,
size_t  len 
) const
inlineoverridevirtual
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 145 of file SequenceWithAnnotationTools.h.

References mask_, removable_, and SequenceMask().

◆ getSize()

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

Definition at line 101 of file SequenceWithAnnotationTools.h.

References mask_.

◆ getType()

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

Implements bpp::SequenceAnnotation.

Definition at line 82 of file SequenceWithAnnotationTools.h.

References MASK.

◆ init()

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

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 76 of file SequenceWithAnnotationTools.h.

References mask_, and bpp::AbstractTemplateSymbolList< T >::size().

◆ isRemovable()

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

Implements bpp::CoreSymbolListListener< T >.

Definition at line 90 of file SequenceWithAnnotationTools.h.

References removable_.

◆ isShared()

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

Implements bpp::CoreSymbolListListener< T >.

Definition at line 91 of file SequenceWithAnnotationTools.h.

◆ isValidWith()

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

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 compliant with the given sequence.

Implements bpp::SequenceAnnotation.

Definition at line 84 of file SequenceWithAnnotationTools.h.

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

◆ merge()

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

Merge the input annotation with the current one.

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

Implements bpp::SequenceAnnotation.

Definition at line 131 of file SequenceWithAnnotationTools.h.

References bpp::VectorTools::append(), getMask(), and mask_.

◆ operator[]()

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

Definition at line 103 of file SequenceWithAnnotationTools.h.

References mask_.

◆ setMask() [1/3]

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

Definition at line 105 of file SequenceWithAnnotationTools.h.

References mask_.

◆ setMask() [2/3]

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

Definition at line 117 of file SequenceWithAnnotationTools.h.

References mask_, and bpp::TextTools::toString().

◆ setMask() [3/3]

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

Definition at line 124 of file SequenceWithAnnotationTools.h.

References mask_, and bpp::TextTools::toString().

Member Data Documentation

◆ MASK

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

Definition at line 24 of file SequenceWithAnnotationTools.h.

Referenced by getType().

◆ mask_

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

◆ removable_

bool bpp::SequenceMask::removable_
private

Definition at line 20 of file SequenceWithAnnotationTools.h.

Referenced by getPartAnnotation(), and isRemovable().


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