From: Dariusz Murakowski Date: Thu, 13 Feb 2014 17:05:02 +0000 (-0500) Subject: Start framework for targeting multiple epitopes. X-Git-Url: http://src.murakowski.org/?a=commitdiff_plain;h=c844d1c3da32b5231899b01f8bcef709119ebcbc;p=VirEvoDyn.git Start framework for targeting multiple epitopes. --- diff --git a/hamiltonian.cpp b/hamiltonian.cpp index b76615d..af10101 100644 --- a/hamiltonian.cpp +++ b/hamiltonian.cpp @@ -223,39 +223,55 @@ double Hamiltonian::get_energy(const std::set &mutated_sites) cons void EpitopeHamiltonian::set_epitope(const std::vector &eWT, const std::vector &eMut, double d) { - penalty=d; - epitopeWT=eWT; - epitopeMut=eMut; + penalty.push_back(d); + epitopeWT.push_back(eWT); + epitopeMut.push_back(eMut); } +// Did virus escape from *any* immune pressure anywhere? +bool EpitopeHamiltonian::escaped(const Virus &v) { + return EpitopeHamiltonian::escaped(v.mutated_sites); +} + +// Did sequence escape from *any* immune pressure anywhere? +bool EpitopeHamiltonian::escaped(const std::set &mutated_sites) const { + for (unsigned ep=0; ep &eWT, const std::vector &eMut) { - return EpitopeHamiltonian::escaped(v.mutated_sites); + return EpitopeHamiltonian::escaped(v.mutated_sites, eWT, eMut); } // Return true if the sequence has escaped from immune pressure -bool EpitopeHamiltonian::escaped(const std::set &mutated_sites) const { +bool EpitopeHamiltonian::escaped(const std::set &mutated_sites, const std::vector &eWT, const std::vector &eMut) const { bool escape=false; - for (unsigned i=0;i &mutated_site // Check for mismatch between targeted epitope and current sequence - if (escaped(mutated_sites)) return ((efield * bh) + (ecoupling * bJ)); - else return ((efield * bh) + (ecoupling * bJ) + (penalty * bh)); + double energy = (efield * bh) + (ecoupling * bJ); + + for (unsigned ep=0; ep epitopeWT; - std::vector epitopeMut; + std::vector penalty; + std::vector > epitopeWT; + std::vector > epitopeMut; EpitopeHamiltonian(std::string &FILENAME); @@ -53,6 +53,8 @@ public: bool escaped(const Virus &v); bool escaped(const std::set &mutated_sites) const; + bool escaped(const Virus &v, const std::vector &eWT, const std::vector &eMut); + bool escaped(const std::set &mutated_sites, const std::vector &eWT, const std::vector &eMut) const; double get_energy(const std::set &mutated_sites) const; }; diff --git a/wf.cpp b/wf.cpp index 71ecb24..bc23b18 100644 --- a/wf.cpp +++ b/wf.cpp @@ -299,7 +299,7 @@ int main(int argc, char *argv[]) { if (strcmp(argv[i],"-d")==0) { if (++i==argc) break; else r.directory=argv[i]; } else if (strcmp(argv[i],"-i")==0) { if (++i==argc) break; else r.infile=argv[i]; } else if (strcmp(argv[i],"-o")==0) { if (++i==argc) break; else r.outfile=argv[i]; } - else if (strcmp(argv[i],"-s")==0) { if (++i==argc) break; else { r.statefile=argv[i]; r.importState=true; } } + else if (strcmp(argv[i],"-s")==0) { if (++i==argc) break; else { r.statefile=argv[i]; r.importState=true; r.useEpitope=true; } } else if (strcmp(argv[i],"-n")==0) { if (++i==argc) break; else r.n=(unsigned int)strtodouble(argv[i]); } else if (strcmp(argv[i],"-g")==0) { if (++i==argc) break; else r.g=(unsigned int)strtodouble(argv[i]); }