if (r.useTwoSite && supout == NULL) { perror("File error"); exit(1); }
if (r.importState) importState(r); // <infile>.st
+ if (r.useEpitope) importEpitope(r); // <infile>.ep
fflush(stdout);
std::cout << "\n"; // XXX
+}
+
+
+// load epitope definitions from file
+
+void importEpitope(RunParameters &r) {
+
+ FILE *input=fopen(r.epitopeInfile.c_str(),"r"); // <infile>.st
+ if (input == NULL) { perror((std::string("ERROR in importEpitope: ") + r.epitopeInfile).c_str()); exit(1); }
+
+ char o;
+ //double frac;
+ unsigned int site;
+
// Import targeted epitope
while (fscanf(input,"%u",&site)==1) {
if (o=='\n') break;
}
-
- r.useEpitope=true;
}
" -d (string) working directory\n"
" -i (string) input couplings file\n"
" -o (string) output file stem\n"
-" -s (string) input state file, containing initial population fraction and targeted epitope\n"
+" -s (string) input state file, containing initial population fraction\n"
+" -e (string) input file containing targeted epitope\n"
" -n (int/double) population size\n"
" -g (int/double) number of generations\n"
" -mu (double) mutation rate\n"
" -b (double) \"inverse temperature\" multiplier\n"
-" -e (int) (int) targeted epitope spans sites [e#1, ..., e#2], assuming all WT\n"
" -r flag to use relative energy condition for survival probability\n"
" -esc flag to run until escape observed (or max number of generations reached)\n"
" -v flag for verbose output\n"
* -i (string) input couplings file
* -o (string) output file stem
* -s (string) input state file, containing initial population fraction and targeted epitope
+ * -e (string) input file containing targeted epitope
* -n (int/double) population size
* -g (int/double) number of generations
* -mu (double) mutation rate
* -b (double) "inverse temperature" multiplier
- * -e (int) (int) targeted epitope spans sites [e#1, ..., e#2], assuming all WT
* -r flag to use relative energy condition for survival probability
* -esc flag to run until escape observed (or max number of generations reached)
* -v flag for verbose output
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; r.useEpitope=true; } }
+ else if (strcmp(argv[i],"-s")==0) { if (++i==argc) break; else { r.statefile=argv[i]; r.importState=true; } }
+ else if (strcmp(argv[i],"-e")==0) { if (++i==argc) break; else { r.epitopefile=argv[i]; 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]); }
else if (strcmp(argv[i],"-bh")==0) { if (++i==argc) break; else r.bh=strtodouble(argv[i]); }
else if (strcmp(argv[i],"-bJ")==0) { if (++i==argc) break; else r.bJ=strtodouble(argv[i]); }
-// else if (strcmp(argv[i],"-e")==0) { if (argc-i<2) break; else { r.estart=strtoint(argv[++i]);
-// r.eend=strtoint(argv[++i]);
-// r.useEpitope=true; } }
-
else if (strcmp(argv[i],"-r")==0) { r.useRelative=true; }
else if (strcmp(argv[i],"-esc")==0) { r.runUntilEscape=true; }
else if (strcmp(argv[i],"-v")==0) { r.useVerbose=true; }
std::string infile; // Input file from which couplings are to be read
std::string outfile; // Output file (prefix) where data is to be written
std::string statefile; // Input state file which contains initial population fractions
- // and targeted epitope
+ std::string epitopefile; // Input file name for targeted epitopes
unsigned int n; // Population size
unsigned int g; // Number of generations
std::string trajectoryOutfile;
std::string supplementaryOutfile;
std::string stateInfile;
+ std::string epitopeInfile;
RunParameters() {
trajectoryOutfile=directory+"/"+outfile+".dat";
supplementaryOutfile=directory+"/"+outfile+".sum";
stateInfile=directory+"/"+statefile+".st";
+ epitopeInfile=directory+"/"+epitopefile+".ep";
}
trajectoryOutfile=outfile+".dat";
supplementaryOutfile=outfile+".sum";
stateInfile=statefile+".st";
+ epitopeInfile=epitopefile+".ep";
}
void run(RunParameters &r);
void importState(RunParameters &r);
+void importEpitope(RunParameters &r);
#endif