5 #ifndef BPP_SEQ_SEQUENCEWITHANNOTATION_H
6 #define BPP_SEQ_SEQUENCEWITHANNOTATION_H
19 class SequenceWithAnnotation;
40 virtual const std::string&
getType()
const = 0;
65 virtual std::unique_ptr<SequenceAnnotation>
getPartAnnotation(
size_t pos,
size_t len)
const = 0;
119 const std::string& name,
120 const std::string& sequence,
121 std::shared_ptr<const Alphabet>& alpha) :
146 const std::string& name,
147 const std::string& sequence,
149 std::shared_ptr<const Alphabet>& alpha) :
170 const std::string& name,
171 const std::vector<std::string>& sequence,
172 std::shared_ptr<const Alphabet>& alpha) :
191 const std::string& name,
192 const std::vector<std::string>& sequence,
194 std::shared_ptr<const Alphabet>& alpha) :
209 const std::string& name,
210 const std::vector<int>& sequence,
211 std::shared_ptr<const Alphabet>& alpha) :
227 const std::string& name,
228 const std::vector<int>& sequence,
230 std::shared_ptr<const Alphabet>& alpha) :
308 virtual void setContent(
const std::string& sequence)
override;
310 void setContent(
const std::vector<std::string>& list)
override
332 void append(
const std::vector<int>& content)
override;
334 void append(
const std::vector<std::string>& content)
override;
336 void append(
const std::string& content)
override;
351 anno->isValidWith(*
this);
363 if (anno.
getType() == type)
return true;
365 catch (std::bad_cast&) {}
379 if (anno.
getType() == type)
return anno;
381 catch (std::bad_cast&) {}
383 throw Exception(
"SequenceWithAnnotation::getAnnotation. No annotation found with type '" + type +
"'.");
394 if (anno.
getType() == type)
return anno;
396 catch (std::bad_cast&) {}
398 throw Exception(
"SequenceWithAnnotation::getAnnotation. No annotation found with type '" + type +
"'.");
A partial implementation of the CoreSequence interface.
const std::string & getName() const override
Get the name of this sequence.
void setName(const std::string &name) override
Set the name of this sequence.
AbstractCoreSequence & operator=(const AbstractCoreSequence &s)
virtual size_t getNumberOfListeners() const override
virtual const CoreSymbolListListener< int > & listener(size_t i) const override
A partial implementation of a SymbolList object.
virtual const std::vector< T > & getContent() const override
virtual std::shared_ptr< const Alphabet > getAlphabet() const =0
Get the alphabet associated to the list.
A event-driven IntSymbolList object.
void addIntSymbolListListener(std::shared_ptr< IntSymbolListListener > listener)
EventDrivenIntSymbolList & operator=(const IntSymbolList &list)
The generic assignment operator.
virtual void setContent(const std::vector< T > &list)=0
Set the whole content of the list.
Interface for sequence annotations.
virtual std::unique_ptr< SequenceAnnotation > getPartAnnotation(size_t pos, size_t len) const =0
virtual const std::string & getType() const =0
virtual bool merge(const SequenceAnnotation &anno)=0
Merge the input annotation with the current one.
virtual SequenceAnnotation * clone() const override=0
virtual bool isValidWith(const SequenceWithAnnotation &sequence, bool throwException=true) const =0
Test is the annotation is valid for a given sequence.
virtual void init(const Sequence &seq)=0
An implementation of the Sequence interface that supports annotation.
SequenceWithAnnotation(const std::string &name, const std::vector< std::string > &sequence, const Comments &comments, std::shared_ptr< const Alphabet > &alpha)
General purpose constructor, can be used with any alphabet.
void setContent(const std::vector< int > &list) override
virtual SequenceAnnotation & annotation(const std::string &type)
SequenceWithAnnotation(const Sequence &s)
The Sequence generic copy constructor.
virtual ~SequenceWithAnnotation()
void setContent(const std::vector< std::string > &list) override
Set the whole content of the list.
SequenceWithAnnotation(const std::string &name, const std::vector< int > &sequence, std::shared_ptr< const Alphabet > &alpha)
General purpose constructor, can be used with any alphabet.
virtual bool hasAnnotation(const std::string &type) const
SequenceWithAnnotation(const std::string &name, const std::vector< std::string > &sequence, std::shared_ptr< const Alphabet > &alpha)
General purpose constructor, can be used with any alphabet.
void setToSizeL(size_t newSize) override
Set up the size of a sequence from the left side.
void append(const SequenceInterface &seq) override
Append the content of a sequence to the current one.
SequenceWithAnnotation(const std::string &name, const std::string &sequence, const Comments &comments, std::shared_ptr< const Alphabet > &alpha)
Direct constructor: build a Sequence object from a std::string.
SequenceWithAnnotation & operator=(const SequenceWithAnnotation &s)
The Sequence assignment operator. This does not perform a hard copy of the alphabet object.
SequenceWithAnnotation * clone() const override
virtual void addAnnotation(std::shared_ptr< SequenceAnnotation > anno)
Add a new annotation to the sequence.
SequenceWithAnnotation(const SequenceWithAnnotation &s)
The Sequence copy constructor.
SequenceWithAnnotation(const std::string &name, const std::string &sequence, std::shared_ptr< const Alphabet > &alpha)
Direct constructor: build a Sequence object from a std::string You can use it safely for RNA,...
virtual const SequenceAnnotation & annotation(const std::string &type) const
SequenceWithAnnotation & operator=(const Sequence &s)
The Sequence generic assignment operator.
SequenceWithAnnotation(std::shared_ptr< const Alphabet > &alpha)
Empty constructor: build a void Sequence with just an Alphabet.
SequenceWithAnnotation(const std::string &name, const std::vector< int > &sequence, const Comments &comments, std::shared_ptr< const Alphabet > &alpha)
General purpose constructor, can be used with any alphabet.
virtual std::vector< std::string > getAnnotationTypes() const
void setToSizeR(size_t newSize) override
Set up the size of a sequence from the right side.
virtual void merge(const SequenceWithAnnotation &swa)
Merge a sequence with the current one.
A basic implementation of the Sequence interface.
virtual const std::vector< T > & getContent() const =0
This alphabet is used to deal NumericAlphabet.
std::vector< std::string > Comments
Declaration of Comments type.