add annot and motif classes to python interface
[mussa.git] / alg / sequence.cpp
index 65ff57d2e326c42bea38346fabcdc2966d34e6a3..b2f76c7c4f6d9107c59215e6293dd12ae1a0afae 100644 (file)
@@ -47,15 +47,15 @@ static const char* rna_alphabet = "AaCcGgNnUu\012\015";
 static const char* iupac_alphabet = "AaCcGgTtUuRrYyMmKkSsWwBbDdHhVvNn\012\015";
 
 annot::annot() 
- : start(0),
+ : begin(0),
    end(0),
    type(""),
    name("")
 {
 }
 
-annot::annot(int start, int end, std::string type, std::string name)
- : start(start),
+annot::annot(int begin, int end, std::string type, std::string name)
+ : begin(begin),
    end(end),
    type(type),
    name(name)
@@ -68,14 +68,14 @@ annot::~annot()
 
 bool operator==(const annot& left, const annot& right)
 {
-  return ((left.start == right.start) and
+  return ((left.begin== right.begin) and
           (left.end == right.end) and
           (left.type == right.type) and
           (left.name == right.name));
 }
 
-motif::motif(int start, std::string motif)
- : annot(start, start+motif.size(), "motif", motif),
+motif::motif(int begin, std::string motif)
+ : annot(begin, begin+motif.size(), "motif", motif),
    sequence(motif)
 {
 }
@@ -467,14 +467,14 @@ Sequence::subseq(int start, int count) const
       annot_i != annots.end();
       ++annot_i)
   {
-    int annot_start = annot_i->start;
+    int annot_begin= annot_i->begin;
     int annot_end = annot_i->end;
 
-    if (annot_start < end) {
-      if (annot_start >=start) {
-        annot_start -= start;
+    if (annot_begin < end) {
+      if (annot_begin >= start) {
+        annot_begin -= start;
       } else {
-        annot_start = 0;
+        annot_begin = 0;
       }
 
       if (annot_end < end) {
@@ -483,7 +483,7 @@ Sequence::subseq(int start, int count) const
         annot_end = count;
       }
 
-      annot new_annot(annot_start, annot_end, annot_i->type, annot_i->name);
+      annot new_annot(annot_begin, annot_end, annot_i->type, annot_i->name);
       new_seq.annots.push_back(new_annot);
     }
   }
@@ -593,7 +593,7 @@ Sequence::save(fs::fstream &save_file)
   save_file << species << std::endl;
   for (annots_i = annots.begin(); annots_i != annots.end(); ++annots_i)
   {
-    save_file << annots_i->start << " " << annots_i->end << " " ;
+    save_file << annots_i->begin << " " << annots_i->end << " " ;
     save_file << annots_i->name << " " << annots_i->type << std::endl;
   }
   save_file << "</Annotations>" << std::endl;
@@ -638,7 +638,7 @@ Sequence::load_museq(fs::path load_file_path, int seq_num)
         // get annot start index
         space_split_i = file_data_line.find(" ");
         annot_value = file_data_line.substr(0,space_split_i);
-        an_annot.start = atoi (annot_value.c_str());
+        an_annot.begin = atoi (annot_value.c_str());
         file_data_line = file_data_line.substr(space_split_i+1);
         // get annot end index
         space_split_i = file_data_line.find(" ");