bpp-seq  2.2.0
bpp::SequenceQuality Class Reference

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)
 
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 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)
 Merge the input annotation with the current one. More...
 
SequenceQualitygetPartAnnotation (size_t pos, size_t len) const throw (Exception)
 
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
 

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 65 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 92 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 106 of file SequenceWithQuality.h.

◆ ~SequenceQuality()

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

Definition at line 120 of file SequenceWithQuality.h.

Member Function Documentation

◆ afterSequenceChanged()

void SequenceQuality::afterSequenceChanged ( const SymbolListEditionEvent event)
virtual

Implements bpp::SymbolListListener.

Definition at line 55 of file SequenceWithQuality.cpp.

◆ afterSequenceDeleted()

void SequenceQuality::afterSequenceDeleted ( const SymbolListDeletionEvent event)
virtual

Implements bpp::SymbolListListener.

Definition at line 72 of file SequenceWithQuality.cpp.

◆ afterSequenceInserted()

void SequenceQuality::afterSequenceInserted ( const SymbolListInsertionEvent event)
virtual

◆ afterSequenceSubstituted()

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

Implements bpp::SymbolListListener.

Definition at line 159 of file SequenceWithQuality.h.

◆ beforeSequenceChanged()

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

Implements bpp::SymbolListListener.

Definition at line 152 of file SequenceWithQuality.h.

◆ beforeSequenceDeleted()

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

Implements bpp::SymbolListListener.

Definition at line 156 of file SequenceWithQuality.h.

◆ beforeSequenceInserted()

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

Implements bpp::SymbolListListener.

Definition at line 154 of file SequenceWithQuality.h.

◆ beforeSequenceSubstituted()

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

Implements bpp::SymbolListListener.

Definition at line 158 of file SequenceWithQuality.h.

◆ clone()

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

Implements bpp::SequenceAnnotation.

Definition at line 132 of file SequenceWithQuality.h.

References SequenceQuality().

◆ getPartAnnotation()

SequenceQuality* bpp::SequenceQuality::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 199 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 175 of file SequenceWithQuality.h.

References qualScores_.

Referenced by bpp::SequenceWithQuality::getQualities(), and merge().

◆ getSize()

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

◆ getType()

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

Implements bpp::SequenceAnnotation.

Definition at line 142 of file SequenceWithQuality.h.

References QUALITY_SCORE.

◆ init()

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

References DEFAULT_QUALITY_VALUE, qualScores_, and bpp::SymbolList::size().

◆ isRemovable()

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

Implements bpp::SymbolListListener.

Definition at line 150 of file SequenceWithQuality.h.

References removable_.

◆ isShared()

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

Implements bpp::SymbolListListener.

Definition at line 151 of file SequenceWithQuality.h.

◆ isValidWith()

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

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

◆ merge()

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

References getScores(), and qualScores_.

◆ operator[]() [1/2]

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

Definition at line 163 of file SequenceWithQuality.h.

References qualScores_.

◆ operator[]() [2/2]

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

Definition at line 164 of file SequenceWithQuality.h.

References qualScores_.

◆ setScore()

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

◆ setScores() [1/2]

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

◆ setScores() [2/2]

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

Definition at line 183 of file SequenceWithQuality.h.

References qualScores_.

Member Data Documentation

◆ DEFAULT_QUALITY_VALUE

const int SequenceQuality::DEFAULT_QUALITY_VALUE = 20
static

Definition at line 74 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 69 of file SequenceWithQuality.h.

Referenced by getPartAnnotation(), and isRemovable().


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