Construct recognizer from epitope string (and starting location).
authorDariusz Murakowski <murakdar@mit.edu>
Fri, 24 Apr 2015 07:05:20 +0000 (03:05 -0400)
committerDariusz Murakowski <murakdar@mit.edu>
Fri, 24 Apr 2015 07:05:20 +0000 (03:05 -0400)
pop_ss.cpp
pop_ss.h
ss.cpp

index ff9bbd5..dce29dd 100644 (file)
@@ -128,6 +128,18 @@ double CTLSpecies::recognized(const MutatedSiteSequence &mutated_sites) const {
 }
 
 
+AARecognizer::AARecognizer(const std::string &seq, int start_index)
+{
+    len = seq.length();
+    site.reserve(len);
+    ref.reserve(len);
+    for (size_t i=0; i<len; ++i) {
+        site.push_back(start_index);
+        ref.push_back(str2aa.at(seq[i]));
+        start_index++;
+    }
+}
+
 // Did virus escape from immune pressure by mutating *any* of the sites away from ref?
 bool AARecognizer::escaped(const NTVirus &v) const {
     return AARecognizer::escaped(v.aa_seq);
index c8e0629..20273aa 100644 (file)
--- a/pop_ss.h
+++ b/pop_ss.h
@@ -84,6 +84,7 @@ public:
     std::vector<unsigned> site;
     std::vector<aa> ref;
     size_t len;
+    AARecognizer(const std::string &seq, int start_index);
     bool escaped(const NTVirus &v) const;
     bool escaped(const std::vector<aa> &aa_seq) const;
 };
diff --git a/ss.cpp b/ss.cpp
index 3e84214..5b4ec36 100644 (file)
--- a/ss.cpp
+++ b/ss.cpp
@@ -516,6 +516,14 @@ int main(int argc, char *argv[]) {
     }
     std::cout << '\n';
     printf("Nnt=%d Naa=%d E=%f\n",v.L_nt,v.L_aa,v.energy);
+    CTLaaSpecies *T = new CTLaaSpecies;
+    T->epitopes.push_back(AARecognizer(argv[4],0));
+    T->affinity.push_back(1.0);
+    T->num_ep = 1;
+    if (T->recognized(v) > 0.0)
+        std::cout << "got 'im!\n";
+    else
+        std::cout << "escaped :(\n";
     return 0;
 //*/