bpp-seq-omics  2.2.0
bpp::SequenceFeatureSet Class Reference

A simple ensemble of sequence features. More...

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

+ Collaboration diagram for bpp::SequenceFeatureSet:

Public Member Functions

 SequenceFeatureSet ()
 
virtual ~SequenceFeatureSet ()
 
 SequenceFeatureSet (const SequenceFeatureSet &sfs)
 
SequenceFeatureSetoperator= (const SequenceFeatureSet &sfs)
 
void clear ()
 Delete all features in this set. More...
 
const SequenceFeaturegetFeature (size_t i) const
 
const SequenceFeatureoperator[] (size_t i) const
 
size_t getNumberOfFeatures () const
 
void addFeature (const SequenceFeature &feature)
 Add a feature to the container. The feature will be copied and the copy owned by the container. More...
 
std::set< std::string > getSequences () const
 
std::set< std::string > getTypes () const
 
void fillRangeCollectionForSequence (const std::string &seqId, RangeCollection< size_t > &coords) const
 Get all coordinates of features for a given source. All ranges are added to a RangeCollection container, as SeqRange objects. More...
 
SequenceFeatureSetgetSubsetForType (const std::vector< std::string > &types) const
 

Private Attributes

std::vector< SequenceFeature * > features_
 

Detailed Description

A simple ensemble of sequence features.

This class is at a draft stage, and further improvements are expected, notably to allow proper indexation, nested features, etc.

For now, it is mostly a vector of feature object, stored as pointers. A few functions are provided for convenience.

Author
Julien Dutheil

Definition at line 361 of file SequenceFeature.h.

Constructor & Destructor Documentation

◆ SequenceFeatureSet() [1/2]

bpp::SequenceFeatureSet::SequenceFeatureSet ( )
inline

Definition at line 367 of file SequenceFeature.h.

Referenced by getSubsetForType().

◆ ~SequenceFeatureSet()

virtual bpp::SequenceFeatureSet::~SequenceFeatureSet ( )
inlinevirtual

Definition at line 369 of file SequenceFeature.h.

References clear().

◆ SequenceFeatureSet() [2/2]

bpp::SequenceFeatureSet::SequenceFeatureSet ( const SequenceFeatureSet sfs)
inline

Definition at line 371 of file SequenceFeature.h.

References features_.

Member Function Documentation

◆ addFeature()

void bpp::SequenceFeatureSet::addFeature ( const SequenceFeature feature)
inline

Add a feature to the container. The feature will be copied and the copy owned by the container.

Parameters
featureThe feature to add to the container.

Definition at line 432 of file SequenceFeature.h.

References bpp::SequenceFeature::clone(), and features_.

Referenced by bpp::GtfFeatureReader::getFeaturesOfSequence(), bpp::GffFeatureReader::getFeaturesOfSequence(), bpp::GtfFeatureReader::getFeaturesOfType(), bpp::GffFeatureReader::getFeaturesOfType(), bpp::SequenceFeatureTools::getOrfs(), and getSubsetForType().

◆ clear()

void bpp::SequenceFeatureSet::clear ( )
inline

Delete all features in this set.

Definition at line 395 of file SequenceFeature.h.

References features_.

Referenced by operator=(), and ~SequenceFeatureSet().

◆ fillRangeCollectionForSequence()

void bpp::SequenceFeatureSet::fillRangeCollectionForSequence ( const std::string &  seqId,
RangeCollection< size_t > &  coords 
) const
inline

Get all coordinates of features for a given source. All ranges are added to a RangeCollection container, as SeqRange objects.

Parameters
seqIdThe name of the sequence id to consider.
coords[out] a container where to add the coordinates of each feature.

Definition at line 468 of file SequenceFeature.h.

References features_.

Referenced by bpp::FeatureExtractor::FeatureExtractor(), and bpp::FeatureFilterMafIterator::FeatureFilterMafIterator().

◆ getFeature()

const SequenceFeature& bpp::SequenceFeatureSet::getFeature ( size_t  i) const
inline
Parameters
iThe index of the feature.
Returns
A reference toward the feature.

Definition at line 409 of file SequenceFeature.h.

References features_.

◆ getNumberOfFeatures()

size_t bpp::SequenceFeatureSet::getNumberOfFeatures ( ) const
inline
Returns
The number of features in this set.

Definition at line 425 of file SequenceFeature.h.

References features_.

Referenced by bpp::GffFeatureReader::toString().

◆ getSequences()

std::set<std::string> bpp::SequenceFeatureSet::getSequences ( ) const
inline
Returns
A set containing all sequences ids in this set.

Definition at line 439 of file SequenceFeature.h.

References features_.

Referenced by bpp::FeatureExtractor::FeatureExtractor(), and bpp::FeatureFilterMafIterator::FeatureFilterMafIterator().

◆ getSubsetForType()

SequenceFeatureSet* bpp::SequenceFeatureSet::getSubsetForType ( const std::vector< std::string > &  types) const
inline
Parameters
typesThe feature type.
Returns
A new set with all features of a given type.

Definition at line 482 of file SequenceFeature.h.

References addFeature(), features_, and SequenceFeatureSet().

◆ getTypes()

std::set<std::string> bpp::SequenceFeatureSet::getTypes ( ) const
inline
Returns
A set containing all feature type in this set.

Definition at line 452 of file SequenceFeature.h.

References features_.

◆ operator=()

SequenceFeatureSet& bpp::SequenceFeatureSet::operator= ( const SequenceFeatureSet sfs)
inline

Definition at line 380 of file SequenceFeature.h.

References clear(), and features_.

◆ operator[]()

const SequenceFeature& bpp::SequenceFeatureSet::operator[] ( size_t  i) const
inline
Parameters
iThe index of the feature.
Returns
A reference toward the feature.
See also
getFeature(size_t i)

Definition at line 418 of file SequenceFeature.h.

References features_.

Member Data Documentation

◆ features_


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