Sequence
Sequence::subseq(int start, int count) const
{
+ if (!seq) {
+ Sequence new_seq;
+ return new_seq;
+ }
+
// there might be an off by one error with start+count > size()
if ( count == npos || start+count > size()) {
count = size()-start;
Sequence::const_reference Sequence::operator[](Sequence::size_type i) const
{
- return seq->at(i);
+ return at(i);
}
Sequence::const_reference Sequence::at(Sequence::size_type i) const
{
+ if (!seq) throw std::out_of_range("empty sequence");
return seq->at(i);
}
void
Sequence::motif_scan(std::string a_motif, std::vector<int> * motif_match_starts) const
{
+ // if there's no sequence we can't scan for it?
+ // should this throw an exception?
+ if (!seq) return;
+
std::string::const_iterator seq_c = seq->begin();
std::string::size_type seq_i;
int motif_i, motif_len;