From: Dariusz Murakowski Date: Fri, 24 Apr 2015 06:50:08 +0000 (-0400) Subject: CTL for recognizing arbitrary amino acid sequence as epitope. X-Git-Url: http://src.murakowski.org/?a=commitdiff_plain;h=4c1ca0d858646e9bf9992e4373201c134807a3ba;p=VirEvoDyn.git CTL for recognizing arbitrary amino acid sequence as epitope. --- diff --git a/pop_ss.cpp b/pop_ss.cpp index ba8ddad..ff9bbd5 100644 --- a/pop_ss.cpp +++ b/pop_ss.cpp @@ -110,6 +110,7 @@ bool EpitopeRecognizer::escaped(const MutatedSiteSequence &mutated_sites) const return escape; } + // returns the affinity to which a virus is recognized // or 0 if it is not recognized (i.e. has escaped from all epitopes) // If multiple epitopes are present and recognized, returns the total affinity @@ -126,3 +127,32 @@ double CTLSpecies::recognized(const MutatedSiteSequence &mutated_sites) const { return bind; } + +// 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); +} +bool AARecognizer::escaped(const std::vector &aa_seq) const { + bool escape = false; + for (unsigned i=0; i &aa_seq) const { + double bind = 0.0; + for (size_t i = 0; i < num_ep; ++i) { + if (!epitopes[i].escaped(aa_seq)) { + bind += affinity[i]; + } + } + return bind; +} + diff --git a/pop_ss.h b/pop_ss.h index ea92489..c8e0629 100644 --- a/pop_ss.h +++ b/pop_ss.h @@ -79,6 +79,16 @@ public: }; +class AARecognizer { +public: + std::vector site; + std::vector ref; + size_t len; + bool escaped(const NTVirus &v) const; + bool escaped(const std::vector &aa_seq) const; +}; + + class Species { public: long count; @@ -134,4 +144,20 @@ public: }; +class CTLaaSpecies : public Species { +public: + CTLaaSpecies() : Species(), num_ep(0) {} + CTLaaSpecies(long c) : Species(c), num_ep(0) {} + CTLaaSpecies(std::string x) : Species(x), num_ep(0) {} + CTLaaSpecies(std::string x, long c) : Species(x,c), num_ep(0) {} + + std::vector epitopes; + std::vector affinity; + size_t num_ep; + + double recognized(const NTVirus &v) const; + double recognized(const std::vector &aa_seq) const; +}; + + #endif // POP_SS_H