add annotations by sequence string
[mussa.git] / alg / sequence.cpp
index b15c4f5fc946ccecc13064f962ded0c2b32ca708..53a13f0b266ddde77b716a55e7b991a4a1aac02a 100644 (file)
@@ -796,3 +796,28 @@ Sequence::motif_scan(string a_motif, vector<int> * motif_match_starts)
   //cout << endl;
 }
 
+void Sequence::add_string_annotation(std::string a_seq, 
+                                     std::string name)
+{
+  vector<int> seq_starts = find_motif(a_seq);
+
+  for(vector<int>::iterator seq_start_i = seq_starts.begin();
+      seq_start_i != seq_starts.end();
+      ++seq_start_i)
+  {
+    annots.push_back(annot(*seq_start_i, 
+                           *seq_start_i+a_seq.size(),
+                           "",
+                           name));
+  }
+}
+
+void Sequence::find_sequences(std::list<Sequence>::iterator start, 
+                              std::list<Sequence>::iterator end)
+{
+  while (start != end) {
+    add_string_annotation(start->get_seq(), start->get_header());
+    ++start;
+  }
+}
+