43 #include <Bpp/Seq/SequenceTools.h> 44 #include <Bpp/Seq/Alphabet/CodonAlphabet.h> 45 #include <Bpp/Seq/Alphabet/AlphabetTools.h> 46 #include <Bpp/Seq/Alphabet/AlphabetExceptions.h> 57 if (range.end() > seq.size())
58 throw IndexOutOfBoundsException (
"SequenceTools::extract: Invalid upper bound", range.end(), 0, seq.size());
59 Sequence* sout = SequenceTools::subseq(seq, range.begin(), range.end() - 1);
61 SequenceTools::invertComplement(*sout);
70 if (! AlphabetTools::isNucleicAlphabet(seq.getAlphabet())) {
71 throw AlphabetException(
"SequenceFeatureTools::getOrfs: Sequence alphabet must be nucleic!", seq.getAlphabet());
73 unsigned int orfCpt = 0;
74 const CodonAlphabet* codonAlpha = gCode.getSourceAlphabet();
75 std::vector< std::vector<size_t> > starts(3), stops(3);
77 for (
size_t p = 0 ; p < seq.size() - 2 ; p++) {
79 if (gCode.isStart(codonAlpha->getCodon(seq.getValue(p), seq.getValue(p + 1), seq.getValue(p + 2)))) {
80 starts[phase].push_back(p);
82 }
else if (gCode.isStop(codonAlpha->getCodon(seq.getValue(p), seq.getValue(p + 1), seq.getValue(p + 2)))) {
83 stops[phase].push_back(p);
87 for (
size_t i = 0 ; i < 3 ; ++i) {
88 std::vector< size_t >::iterator start(starts[i].begin()), stop(stops[i].begin());
89 while (stop != stops[i].end() && start != starts[i].end()) {
void addFeature(const SequenceFeature &feature)
Add a feature to the container. The feature will be copied and the copy owned by the container...
virtual bool isNegativeStrand() const
A very simple implementation of the SequenceFeature class.
a coordinate range on a sequence. Stores coordinates as a Range<size_t> object, but also keep the str...
A simple ensemble of sequence features.