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

A very simple implementation of the SequenceFeature class. More...

#include <Bpp/Seq/Feature/SequenceFeature.h>

+ Inheritance diagram for bpp::BasicSequenceFeature:
+ Collaboration diagram for bpp::BasicSequenceFeature:

Public Member Functions

 BasicSequenceFeature ()
 
 BasicSequenceFeature (const std::string &id, const std::string &seqId, const std::string &source, const std::string &type, size_t start, size_t end, char strand, double score=-1)
 
virtual BasicSequenceFeatureclone () const
 
const std::string & getId () const
 
void setId (const std::string &id)
 
const std::string & getSequenceId () const
 
void setSequenceId (const std::string &sid)
 
const std::string & getSource () const
 
void setSource (const std::string &source)
 
const std::string & getType () const
 
void setType (const std::string &type)
 
const size_t getStart () const
 
const size_t getEnd () const
 
bool isStranded () const
 
bool isNegativeStrand () const
 
void invert ()
 
const double & getScore () const
 
void setScore (double score)
 
const std::string & getAttribute (const std::string &attribute) const
 
std::string & getAttribute (const std::string &attribute)
 
void setAttribute (const std::string &attribute, const std::string &value)
 Set the value of an attribute. More...
 
std::set< std::string > getAttributeList () const
 
void removeAttribute (const std::string &attribute)
 
SeqRange getRange () const
 
bool overlap (const SequenceFeature &feat) const
 
bool overlap (const SeqRange &range) const
 
virtual bool includes (const SeqRange &range) const
 
virtual bool isIncludedIn (const SeqRange &range) const
 
virtual const size_t size () const
 
virtual bool isEmpty () const
 
virtual bool isPoint () const
 

Static Public Attributes

static const std::string NO_ATTRIBUTE_SET = ""
 

Protected Attributes

std::string id_
 
std::string sequenceId_
 
std::string source_
 
std::string type_
 
SeqRange range_
 
double score_
 
std::map< std::string, std::string > attributes_
 

Detailed Description

A very simple implementation of the SequenceFeature class.

It uses a hash map for storing attributes.

Definition at line 295 of file SequenceFeature.h.

Constructor & Destructor Documentation

◆ BasicSequenceFeature() [1/2]

bpp::BasicSequenceFeature::BasicSequenceFeature ( )
inline

Definition at line 309 of file SequenceFeature.h.

Referenced by clone().

◆ BasicSequenceFeature() [2/2]

bpp::BasicSequenceFeature::BasicSequenceFeature ( const std::string &  id,
const std::string &  seqId,
const std::string &  source,
const std::string &  type,
size_t  start,
size_t  end,
char  strand,
double  score = -1 
)
inline

Definition at line 311 of file SequenceFeature.h.

Member Function Documentation

◆ clone()

virtual BasicSequenceFeature* bpp::BasicSequenceFeature::clone ( ) const
inlinevirtual

Implements bpp::SequenceFeature.

Definition at line 326 of file SequenceFeature.h.

References BasicSequenceFeature().

◆ getAttribute() [1/2]

std::string& bpp::BasicSequenceFeature::getAttribute ( const std::string &  attribute)
inlinevirtual
Parameters
attributeThe name of the attribute to retrieve.
Returns
The attribute with specified name.

Implements bpp::SequenceFeature.

Definition at line 355 of file SequenceFeature.h.

References attributes_.

◆ getAttribute() [2/2]

const std::string& bpp::BasicSequenceFeature::getAttribute ( const std::string &  attribute) const
inlinevirtual
Parameters
attributeThe name of the attribute to retrieve.
Returns
The attribute with specified name (read only).

Implements bpp::SequenceFeature.

Definition at line 347 of file SequenceFeature.h.

References attributes_, and bpp::SequenceFeature::NO_ATTRIBUTE_SET.

◆ getAttributeList()

std::set< std::string > bpp::BasicSequenceFeature::getAttributeList ( ) const
inlinevirtual
Returns
The list of all attributes available.

Implements bpp::SequenceFeature.

Definition at line 363 of file SequenceFeature.h.

References attributes_.

◆ getEnd()

const size_t bpp::BasicSequenceFeature::getEnd ( ) const
inlinevirtual
Returns
The ending position of the feature, 0-based, excluded.

Implements bpp::SequenceFeature.

Definition at line 338 of file SequenceFeature.h.

References bpp::Range< class >::end(), and range_.

◆ getId()

const std::string& bpp::BasicSequenceFeature::getId ( ) const
inlinevirtual
Returns
The id of this feature.

Implements bpp::SequenceFeature.

Definition at line 329 of file SequenceFeature.h.

References id_.

◆ getRange()

SeqRange bpp::BasicSequenceFeature::getRange ( ) const
inlinevirtual
Returns
Coordinates as a Range object.

Implements bpp::SequenceFeature.

Definition at line 378 of file SequenceFeature.h.

References range_.

◆ getScore()

const double& bpp::BasicSequenceFeature::getScore ( ) const
inlinevirtual
Returns
The score associated to the feature (eg, an E-value or a P-value).

Implements bpp::SequenceFeature.

Definition at line 344 of file SequenceFeature.h.

References score_.

◆ getSequenceId()

const std::string& bpp::BasicSequenceFeature::getSequenceId ( ) const
inlinevirtual
Returns
The id of the sequence on which this feature is based.

Implements bpp::SequenceFeature.

Definition at line 331 of file SequenceFeature.h.

References sequenceId_.

Referenced by bpp::BedGraphFeatureReader::getFeaturesOfSequence(), bpp::GffFeatureReader::getFeaturesOfSequence(), and bpp::GtfFeatureReader::getFeaturesOfSequence().

◆ getSource()

const std::string& bpp::BasicSequenceFeature::getSource ( ) const
inlinevirtual
Returns
A text intended to describe the algorithm or procedure used to generate the feature.

Implements bpp::SequenceFeature.

Definition at line 333 of file SequenceFeature.h.

References source_.

◆ getStart()

const size_t bpp::BasicSequenceFeature::getStart ( ) const
inlinevirtual
Returns
The starting position of the feature, 0-based, included.

Implements bpp::SequenceFeature.

Definition at line 337 of file SequenceFeature.h.

References bpp::Range< class >::begin(), and range_.

◆ getType()

const std::string& bpp::BasicSequenceFeature::getType ( ) const
inlinevirtual
Returns
A text describing the type of feature. Depending on the format, it can be restricted (for example, mRNA), or any text can be supplied (for example TFXX binding site).

Implements bpp::SequenceFeature.

Definition at line 335 of file SequenceFeature.h.

References type_.

Referenced by bpp::BedGraphFeatureReader::getFeaturesOfType(), bpp::GffFeatureReader::getFeaturesOfType(), and bpp::GtfFeatureReader::getFeaturesOfType().

◆ includes()

virtual bool bpp::BasicSequenceFeature::includes ( const SeqRange range) const
inlinevirtual
Returns
True if the feature fully contains the given range.

Implements bpp::SequenceFeature.

Definition at line 393 of file SequenceFeature.h.

References bpp::Range< class >::contains(), and range_.

◆ invert()

void bpp::BasicSequenceFeature::invert ( )
inlinevirtual

Change the orientation of the feature.

Implements bpp::SequenceFeature.

Definition at line 341 of file SequenceFeature.h.

References bpp::SeqRange::invert(), and range_.

◆ isEmpty()

virtual bool bpp::SequenceFeature::isEmpty ( ) const
inlinevirtualinherited
Returns
Check if the feature is empty (start == end)

Definition at line 222 of file SequenceFeature.h.

References bpp::SequenceFeature::size().

◆ isIncludedIn()

virtual bool bpp::BasicSequenceFeature::isIncludedIn ( const SeqRange range) const
inlinevirtual
Returns
True if the feature is fully contained in the given range.

Implements bpp::SequenceFeature.

Definition at line 397 of file SequenceFeature.h.

References bpp::Range< class >::contains(), and range_.

◆ isNegativeStrand()

bool bpp::BasicSequenceFeature::isNegativeStrand ( ) const
inlinevirtual
Returns
True if the sequence is coded on the negative strand. False if it is on the positive one or unknown.

Implements bpp::SequenceFeature.

Definition at line 340 of file SequenceFeature.h.

References bpp::SeqRange::isNegativeStrand(), and range_.

◆ isPoint()

virtual bool bpp::SequenceFeature::isPoint ( ) const
inlinevirtualinherited
Returns
Check if the feature is a point annotation (start + 1 == end)

Definition at line 227 of file SequenceFeature.h.

References bpp::SequenceFeature::size().

◆ isStranded()

bool bpp::BasicSequenceFeature::isStranded ( ) const
inlinevirtual
Returns
True if the feature is stranded.

Implements bpp::SequenceFeature.

Definition at line 339 of file SequenceFeature.h.

References bpp::SeqRange::isStranded(), and range_.

◆ overlap() [1/2]

bool bpp::BasicSequenceFeature::overlap ( const SeqRange range) const
inlinevirtual
Returns
True if the feature overlap with the given range (non-null intersection).

Implements bpp::SequenceFeature.

Definition at line 389 of file SequenceFeature.h.

References bpp::Range< class >::overlap(), and range_.

◆ overlap() [2/2]

bool bpp::BasicSequenceFeature::overlap ( const SequenceFeature feat) const
inlinevirtual
Returns
True if the features overlap.

Implements bpp::SequenceFeature.

Definition at line 382 of file SequenceFeature.h.

References bpp::SequenceFeature::getRange(), bpp::SequenceFeature::getSequenceId(), bpp::Range< class >::overlap(), range_, and sequenceId_.

◆ removeAttribute()

void bpp::BasicSequenceFeature::removeAttribute ( const std::string &  attribute)
inlinevirtual
Parameters
attributeThe name of the attribute to be removed.

Implements bpp::SequenceFeature.

Definition at line 371 of file SequenceFeature.h.

References attributes_.

◆ setAttribute()

void bpp::BasicSequenceFeature::setAttribute ( const std::string &  attribute,
const std::string &  value 
)
inlinevirtual

Set the value of an attribute.

Parameters
attributeThe name of the attribute to set.
valueThe value of the attribute to set.

Implements bpp::SequenceFeature.

Definition at line 359 of file SequenceFeature.h.

References attributes_.

Referenced by bpp::BedGraphFeatureReader::nextFeature(), bpp::GffFeatureReader::nextFeature(), and bpp::GtfFeatureReader::nextFeature().

◆ setId()

void bpp::BasicSequenceFeature::setId ( const std::string &  id)
inlinevirtual
Parameters
idA std::string representing the id.

Implements bpp::SequenceFeature.

Definition at line 330 of file SequenceFeature.h.

References id_.

◆ setScore()

void bpp::BasicSequenceFeature::setScore ( double  score)
inlinevirtual
Parameters
scoreA double representing the score of this feature.

Implements bpp::SequenceFeature.

Definition at line 345 of file SequenceFeature.h.

References score_.

◆ setSequenceId()

void bpp::BasicSequenceFeature::setSequenceId ( const std::string &  id)
inlinevirtual
Parameters
idA std::string representing the id of the reference.

Implements bpp::SequenceFeature.

Definition at line 332 of file SequenceFeature.h.

References sequenceId_.

◆ setSource()

void bpp::BasicSequenceFeature::setSource ( const std::string &  source)
inlinevirtual
Parameters
sourceA std::string representing the source of the feature.

Implements bpp::SequenceFeature.

Definition at line 334 of file SequenceFeature.h.

References source_.

◆ setType()

void bpp::BasicSequenceFeature::setType ( const std::string &  type)
inlinevirtual
Parameters
typeA std::string representing the type of this feature.

Implements bpp::SequenceFeature.

Definition at line 336 of file SequenceFeature.h.

References type_.

◆ size()

virtual const size_t bpp::SequenceFeature::size ( ) const
inlinevirtualinherited
Returns
The size of the feature.

Definition at line 195 of file SequenceFeature.h.

References bpp::SequenceFeature::getEnd(), and bpp::SequenceFeature::getStart().

Referenced by bpp::SequenceFeature::isEmpty(), and bpp::SequenceFeature::isPoint().

Member Data Documentation

◆ attributes_

std::map<std::string, std::string> bpp::BasicSequenceFeature::attributes_
mutableprotected

Definition at line 305 of file SequenceFeature.h.

Referenced by getAttribute(), getAttributeList(), removeAttribute(), and setAttribute().

◆ id_

std::string bpp::BasicSequenceFeature::id_
protected

Definition at line 299 of file SequenceFeature.h.

Referenced by getId(), and setId().

◆ NO_ATTRIBUTE_SET

const std::string SequenceFeature::NO_ATTRIBUTE_SET = ""
staticinherited

Definition at line 140 of file SequenceFeature.h.

Referenced by getAttribute().

◆ range_

SeqRange bpp::BasicSequenceFeature::range_
protected

◆ score_

double bpp::BasicSequenceFeature::score_
protected

Definition at line 304 of file SequenceFeature.h.

Referenced by getScore(), and setScore().

◆ sequenceId_

std::string bpp::BasicSequenceFeature::sequenceId_
protected

Definition at line 300 of file SequenceFeature.h.

Referenced by getSequenceId(), overlap(), and setSequenceId().

◆ source_

std::string bpp::BasicSequenceFeature::source_
protected

Definition at line 301 of file SequenceFeature.h.

Referenced by getSource(), and setSource().

◆ type_

std::string bpp::BasicSequenceFeature::type_
protected

Definition at line 302 of file SequenceFeature.h.

Referenced by getType(), and setType().


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