bpp-seq3  3.0.0
bpp::SequenceQuality Class Referenceabstract

The SequenceQuality class. More...

#include <Bpp/Seq/SequenceWithQuality.h>

+ Inheritance diagram for bpp::SequenceQuality:
+ Collaboration diagram for bpp::SequenceQuality:

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 int & operator[] (size_t i) const
 
int & operator[] (size_t i)
 
void setScores (const std::vector< int > &scores)
 
const std::vector< int > & getScores () const
 
void setScore (size_t pos, int score)
 
void setScores (size_t pos, const std::vector< int > &scores)
 
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
 SequenceQuality (size_t size=0, bool removable=true)
 Build a new SequenceQuality object. More...
 
 SequenceQuality (const std::vector< int > &quality, bool removable=true)
 Build a new SequenceQuality object. More...
 
Destructor
virtual ~SequenceQuality ()
 
The Clonable interface
SequenceQualityclone () const override
 

Static Public Attributes

static const std::string QUALITY_SCORE = "Quality score"
 
static const int DEFAULT_QUALITY_VALUE = 20
 

Private Attributes

bool removable_
 
std::vector< int > qualScores_
 

Detailed Description

The SequenceQuality class.

This is a sequence with quality score associated to each element. The score is a signed int value that can represent the phred or the Solexa quality score for nucleic sequence.

Author
Sylvain Gaillard, Vincent Cahais, Julien Dutheil

Definition at line 30 of file SequenceWithQuality.h.

Constructor & Destructor Documentation

◆ SequenceQuality() [1/2]

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

Build a new SequenceQuality object.

Build a new SequenceQuality object and set the quality scores to the default value DEFAULT_QUALITY_VALUE.

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

Definition at line 56 of file SequenceWithQuality.h.

Referenced by clone(), and getPartAnnotation().

◆ SequenceQuality() [2/2]

bpp::SequenceQuality::SequenceQuality ( const std::vector< int > &  quality,
bool  removable = true 
)
inline

Build a new SequenceQuality object.

Build a new SequenceQuality and assign quality scores from a vector of int.

Parameters
qualityThe quality scores
removableTell if this listener can be removed by the user.

Definition at line 70 of file SequenceWithQuality.h.

◆ ~SequenceQuality()

virtual bpp::SequenceQuality::~SequenceQuality ( )
inlinevirtual

Definition at line 81 of file SequenceWithQuality.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 SequenceQuality::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 SequenceQuality::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 SequenceQuality::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::SequenceQuality::afterSequenceSubstituted ( const IntSymbolListSubstitutionEvent event)
inlineoverride

Definition at line 115 of file SequenceWithQuality.h.

◆ beforeSequenceChanged() [1/2]

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

◆ beforeSequenceChanged() [2/2]

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

Definition at line 108 of file SequenceWithQuality.h.

◆ beforeSequenceDeleted() [1/2]

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

◆ beforeSequenceDeleted() [2/2]

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

Definition at line 112 of file SequenceWithQuality.h.

◆ beforeSequenceInserted() [1/2]

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

◆ beforeSequenceInserted() [2/2]

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

Definition at line 110 of file SequenceWithQuality.h.

◆ beforeSequenceSubstituted() [1/2]

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

◆ beforeSequenceSubstituted() [2/2]

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

Definition at line 114 of file SequenceWithQuality.h.

◆ clone()

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

Implements bpp::SequenceAnnotation.

Definition at line 88 of file SequenceWithQuality.h.

References SequenceQuality().

◆ getPartAnnotation()

std::unique_ptr<SequenceAnnotation> bpp::SequenceQuality::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 162 of file SequenceWithQuality.h.

References qualScores_, removable_, and SequenceQuality().

◆ getScores()

const std::vector<int>& bpp::SequenceQuality::getScores ( ) const
inline
Returns
All scores as a vector.

Definition at line 132 of file SequenceWithQuality.h.

References qualScores_.

Referenced by merge().

◆ getSize()

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

Definition at line 117 of file SequenceWithQuality.h.

References qualScores_.

◆ getType()

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

Implements bpp::SequenceAnnotation.

Definition at line 98 of file SequenceWithQuality.h.

References QUALITY_SCORE.

◆ init()

void bpp::SequenceQuality::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 92 of file SequenceWithQuality.h.

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

◆ isRemovable()

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

Implements bpp::CoreSymbolListListener< T >.

Definition at line 106 of file SequenceWithQuality.h.

References removable_.

◆ isShared()

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

Implements bpp::CoreSymbolListListener< T >.

Definition at line 107 of file SequenceWithQuality.h.

◆ isValidWith()

bool bpp::SequenceQuality::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 100 of file SequenceWithQuality.h.

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

◆ merge()

bool bpp::SequenceQuality::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 148 of file SequenceWithQuality.h.

References bpp::VectorTools::append(), getScores(), and qualScores_.

◆ operator[]() [1/2]

int& bpp::SequenceQuality::operator[] ( size_t  i)
inline

Definition at line 120 of file SequenceWithQuality.h.

References qualScores_.

◆ operator[]() [2/2]

const int& bpp::SequenceQuality::operator[] ( size_t  i) const
inline

Definition at line 119 of file SequenceWithQuality.h.

References qualScores_.

◆ setScore()

void bpp::SequenceQuality::setScore ( size_t  pos,
int  score 
)
inline

Definition at line 134 of file SequenceWithQuality.h.

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

◆ setScores() [1/2]

void bpp::SequenceQuality::setScores ( const std::vector< int > &  scores)
inline

Definition at line 122 of file SequenceWithQuality.h.

References qualScores_.

◆ setScores() [2/2]

void bpp::SequenceQuality::setScores ( size_t  pos,
const std::vector< int > &  scores 
)
inline

Definition at line 141 of file SequenceWithQuality.h.

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

Member Data Documentation

◆ DEFAULT_QUALITY_VALUE

const int SequenceQuality::DEFAULT_QUALITY_VALUE = 20
static

Definition at line 39 of file SequenceWithQuality.h.

Referenced by init().

◆ QUALITY_SCORE

const string SequenceQuality::QUALITY_SCORE = "Quality score"
static

◆ qualScores_

std::vector<int> bpp::SequenceQuality::qualScores_
private

◆ removable_

bool bpp::SequenceQuality::removable_
private

Definition at line 34 of file SequenceWithQuality.h.

Referenced by getPartAnnotation(), and isRemovable().


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