bpp-seq-omics  2.4.1
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
 
bool isEmpty () 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 fillRangeCollection (RangeCollection< size_t > &coords) const
 Get all coordinates of features. All ranges are added to a RangeCollection container, as SeqRange objects. More...
 
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::string &type) const
 
SequenceFeatureSetgetSubsetForTypes (const std::vector< std::string > &types) const
 
SequenceFeatureSetgetSubsetForSequence (const std::string &id) const
 
SequenceFeatureSetgetSubsetForSequences (const std::vector< std::string > &ids) const
 
SequenceFeatureSetgetSubsetForRange (const SeqRange &range, bool complete) 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 417 of file SequenceFeature.h.

Constructor & Destructor Documentation

◆ SequenceFeatureSet() [1/2]

bpp::SequenceFeatureSet::SequenceFeatureSet ( )
inline

◆ ~SequenceFeatureSet()

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

Definition at line 425 of file SequenceFeature.h.

References clear().

◆ SequenceFeatureSet() [2/2]

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

Definition at line 427 of file SequenceFeature.h.

References features_.

Member Function Documentation

◆ addFeature()

◆ clear()

void bpp::SequenceFeatureSet::clear ( )
inline

Delete all features in this set.

Definition at line 451 of file SequenceFeature.h.

References features_.

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

◆ fillRangeCollection()

void bpp::SequenceFeatureSet::fillRangeCollection ( RangeCollection< size_t > &  coords) const
inline

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

Parameters
coords[out] a container where to add the coordinates of each feature.

Definition at line 528 of file SequenceFeature.h.

References bpp::RangeCollection< class >::addRange(), and features_.

◆ 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 542 of file SequenceFeature.h.

References bpp::RangeCollection< class >::addRange(), and features_.

Referenced by bpp::FeatureExtractorMafIterator::FeatureExtractorMafIterator(), 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 465 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 481 of file SequenceFeature.h.

References features_.

Referenced by bpp::BedGraphFeatureReader::toString(), and bpp::GffFeatureReader::toString().

◆ getSequences()

std::set<std::string> bpp::SequenceFeatureSet::getSequences ( ) const
inline

◆ getSubsetForRange()

SequenceFeatureSet* bpp::SequenceFeatureSet::getSubsetForRange ( const SeqRange range,
bool  complete 
) const
inline
Parameters
rangeThe range of features to look for.
completeIf true, only return features fully included in the given range. Otherwise returns features overlapping with the range.
Returns
A new set with all features included in the given range.

Definition at line 622 of file SequenceFeature.h.

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

◆ getSubsetForSequence()

SequenceFeatureSet* bpp::SequenceFeatureSet::getSubsetForSequence ( const std::string &  id) const
inline
Parameters
idThe sequence id to look for.
Returns
A new set with all features for a given sequence id.

Definition at line 588 of file SequenceFeature.h.

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

Referenced by bpp::CoordinateTranslatorMafIterator::CoordinateTranslatorMafIterator().

◆ getSubsetForSequences()

SequenceFeatureSet* bpp::SequenceFeatureSet::getSubsetForSequences ( const std::vector< std::string > &  ids) const
inline
Parameters
idsThe sequence ids to look for.
Returns
A new set with all features of given sequence ids.

Definition at line 604 of file SequenceFeature.h.

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

◆ getSubsetForType()

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

Definition at line 556 of file SequenceFeature.h.

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

◆ getSubsetForTypes()

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

Definition at line 572 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 513 of file SequenceFeature.h.

References features_.

◆ isEmpty()

bool bpp::SequenceFeatureSet::isEmpty ( ) const
inline
Returns
True if the set contains no feature.

Definition at line 486 of file SequenceFeature.h.

References features_.

◆ operator=()

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

Definition at line 436 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 474 of file SequenceFeature.h.

References features_.

Member Data Documentation

◆ features_


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