using namespace std;
+annot::annot()
+ : start(0),
+ end(0),
+ type(""),
+ name("")
+{
+}
+
+annot::annot(int start, int end, std::string type, std::string name)
+ : start(start),
+ end(end),
+ type(type),
+ name(name)
+{
+}
+
+motif::motif(int start, std::string motif)
+ : annot(start, start+motif.size(), "motif", motif),
+ sequence(motif)
+{
+}
+
Sequence::Sequence()
+ : sequence(""),
+ header(""),
+ species("")
{
+ annots.clear();
+ motif_list.clear();
}
Sequence::Sequence(string seq)
return (size() == 0);
}
-const std::list<annot> Sequence::annotations() const
+const std::list<annot>& Sequence::annotations() const
{
return annots;
}
return valid_motif;
}
+void Sequence::add_motif(string a_motif)
+{
+ vector<int> motif_starts = find_motif(a_motif);
+
+
+ for(vector<int>::iterator motif_start_i = motif_starts.begin();
+ motif_start_i != motif_starts.end();
+ ++motif_start_i)
+ {
+ motif_list.push_back(motif(*motif_start_i, a_motif));
+ }
+}
+
+const list<motif>& Sequence::motifs() const
+{
+ return motif_list;
+}
vector<int>
Sequence::find_motif(string a_motif)
vector<int> motif_match_starts;
string a_motif_rc;
-
motif_match_starts.clear();
//cout << "motif is: " << a_motif << endl;
if (motif_i == motif_len)
{
//cout << "!!";
+ annot new_motif;
motif_match_starts->push_back(seq_i - motif_len + 1);
motif_i = 0;
}
seq_i++;
}
- cout << endl;
+ //cout << endl;
}