Skip to content

Commit b0e9915

Browse files
committed
dynparams no longer makes rates larger than input rates, and add experimental objectives Rob Patro suggested
1 parent 9e9d831 commit b0e9915

8 files changed

Lines changed: 50 additions & 41 deletions

File tree

Alignment.cpp

Lines changed: 18 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,18 @@ double Alignment::fastS3() const{
543543
return num/denom;
544544
}
545545

546+
inline double Alignment::icsTimesEC() const{
547+
return fastICS()*fastEC();
548+
}
549+
550+
double Alignment::s3Variant() const{
551+
double a = (double)currConservedCount;
552+
double b = (double)(net1->edges.size());
553+
double c = (double)currInducedCount;
554+
double denom = max(b,c) -a;
555+
return a/denom;
556+
}
557+
546558
//todo: maybe something more principled than fitnessNames (so ad hoc!)
547559
void Alignment::computeFitness(const vector<fitnessName>& fitnessNames){
548560

@@ -578,39 +590,13 @@ void Alignment::computeFitness(const vector<fitnessName>& fitnessNames){
578590
fitness[i] = -(double(net1->edges.size() + currInducedCount)
579591
-currConservedCount);
580592
break;
593+
case ICSTimesEC:
594+
fitness[i] = icsTimesEC();
595+
break;
596+
case S3Variant:
597+
fitness[i] = s3Variant();
598+
break;
581599
}
582-
583-
/*
584-
if(fitnessNames.at(i) == "ICS"){
585-
fitness.at(i) = fastICS(); //ics();
586-
}
587-
if(fitnessNames.at(i) == "EC"){
588-
fitness.at(i) = (double(currConservedCount)) /
589-
double(net1->edges.size());
590-
}
591-
if(fitnessNames.at(i) == "BitscoreSum"){
592-
fitness.at(i) = currBitscore; //sumBLAST();
593-
}
594-
if(fitnessNames.at(i) == "EvalsSum"){
595-
fitness.at(i) = -1.0*sumBLAST();
596-
}
597-
if(fitnessNames.at(i) == "Size"){
598-
fitness.at(i) = alnSize();
599-
}
600-
if(fitnessNames.at(i) == "GOC"){
601-
fitness.at(i) = currGOC;
602-
}
603-
if(fitnessNames.at(i) == "S3"){
604-
double num = (double)currConservedCount;
605-
double denom = double(net1->edges.size()
606-
+ currInducedCount) - num;
607-
fitness.at(i) = num/denom;
608-
}
609-
if(fitnessNames.at(i) == "S3Denom"){
610-
fitness.at(i) = -(double(net1->edges.size() + currInducedCount)
611-
-currConservedCount);
612-
}
613-
*/
614600
}
615601
fitnessValid = true;
616602
}

Alignment.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ class Alignment{
9090

9191
double fastEC() const;
9292
double fastS3() const;
93+
94+
//experimental metrics suggested by Rob Patro:
95+
double icsTimesEC() const;
96+
double s3Variant() const;
9397
//pointers to our networks
9498
const Network* net1;
9599
const Network* net2;

Network.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ string fitnessNameToStr(fitnessName x){
2727
return "S3";
2828
case S3DenomFit:
2929
return "S3Denom";
30+
case ICSTimesEC:
31+
return "ICS*EC";
32+
case S3Variant:
33+
return "S3Variant";
3034
default:
3135
return "invalid fitness name";
3236
}

Network.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class LineReadException: public exception
2929

3030
//for keeping track of what we are optimizing
3131
enum fitnessName {ICSFit, ECFit, BitscoreSumFit, EvalsSumFit, SizeFit,
32-
GOCFit, S3Fit, S3DenomFit};
32+
GOCFit, S3Fit, S3DenomFit, ICSTimesEC, S3Variant};
3333

3434
string fitnessNameToStr(fitnessName x);
3535

argParsing.h

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ argRetVals handleArgs(int ac, char* av[]){
142142
("dynparams", "When set, automatically adjust some parameters based on their "
143143
"success rate. See documentation for more information.")
144144
("timelimit", po::value<int>(), "Sets a time limit in minutes. Default: not set.")
145+
("icstimesec", "When set, uses the product of ICS and EC as an alignment objective.")
146+
("s3variant", "When set, uses a variant on S^3 as an alignment objective.")
145147
;
146148

147149
po::variables_map vm;
@@ -155,7 +157,8 @@ argRetVals handleArgs(int ac, char* av[]){
155157

156158

157159
if(!(vm.count("ics") || vm.count("bitscores") || vm.count("evalues")
158-
|| vm.count("ec") || vm.count("s3") || vm.count("s3denom"))
160+
|| vm.count("ec") || vm.count("s3") || vm.count("s3denom")
161+
|| vm.count("icstimesec") || vm.count("s3variant"))
159162
&& !(vm.count("annotations1") && vm.count("annotations2")) ){
160163
throw ArgError("At least one objective must be specified!");
161164
}
@@ -224,6 +227,14 @@ argRetVals handleArgs(int ac, char* av[]){
224227
fitnessNames.push_back(S3DenomFit);
225228
}
226229

230+
if(vm.count("icstimesec")){
231+
fitnessNames.push_back(ICSTimesEC);
232+
}
233+
234+
if(vm.count("s3variant")){
235+
fitnessNames.push_back(S3Variant);
236+
}
237+
227238
BLASTDict* bitscores = nullptr;
228239

229240
if(vm.count("bitscores")){

generateExperimentsSteadyState.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@
88
hillclimbiters = int(random.uniform(5000, 50000))
99
dynparams = True
1010
popsize = int(random.uniform(5,1000))
11-
print "./steadystateMOGA --net1 ~/Dropbox/optnetalign/optnetalign/tests/dmela.net --net2 ~/Dropbox/optnetalign/optnetalign/tests/hsapi.net --annotations1 ~/Dropbox/optnetalign/optnetalign/tests/dmela.annos --annotations2 ~/Dropbox/optnetalign/optnetalign/tests/hsapi.annos --s3 " + " --hillclimbiters " + str(hillclimbiters) + " --mutswappb " + str(mutswappb) + " --mutrate " + str(mutrate) + " --cxswappb " + str(cxswappb) + " --cxrate " + str(cxrate) + " --popsize " + str(popsize) + (" --dynparams " if dynparams else " ") + "--total --nthreads 16 --nooutput --generations 10000000 --timelimit 120 --finalstats >> experimentalDataSteadyState.csv"
11+
print "./steadystateMOGA --net1 ~/Dropbox/optnetalign/optnetalign/tests/dmela.net --net2 ~/Dropbox/optnetalign/optnetalign/tests/hsapi.net --annotations1 ~/Dropbox/optnetalign/optnetalign/tests/dmela.annos --annotations2 ~/Dropbox/optnetalign/optnetalign/tests/hsapi.annos --goc --s3 " + " --hillclimbiters " + str(hillclimbiters) + " --mutswappb " + str(mutswappb) + " --mutrate " + str(mutrate) + " --cxswappb " + str(cxswappb) + " --cxrate " + str(cxrate) + " --popsize " + str(popsize) + (" --dynparams " if dynparams else " ") + "--total --nthreads 16 --nooutput --generations 10000000 --timelimit 120 --finalstats >> experimentalDataSteadyState.csv"

localTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int main(int ac, char* av[])
6767
500, fitnessNames);
6868

6969
for(int j = 0; j <fitnessNames.size();j++){
70-
cout<<"current "<<fitnessNames.at(j)<<" is "
70+
cout<<"current "<<fitnessNameToStr(fitnessNames.at(j))<<" is "
7171
<<aln->fitness.at(j)<<endl;
7272
}
7373
cout<<"EC is "<<((double)(aln->currConservedCount))/((double)(net1->edges.size()))<<endl;

steadystate.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,21 +153,21 @@ int main(int ac, char* av[])
153153
//method of setting these.
154154
if(dynparams && numAlnsGenerated > 100){
155155
if(numMut > 0){
156-
tmutrate = double(nonDomMut)/double(numMut);
156+
tmutrate = min(double(nonDomMut)/double(numMut),mutrate);
157157
}
158158
else{
159159
tmutrate = mutrate;
160160
}
161161

162162
if(numCx > 0){
163-
tcxrate = double(nonDomCx)/double(numCx);
163+
tcxrate = min(double(nonDomCx)/double(numCx),cxrate);
164164
}
165165
else{
166166
tcxrate = cxrate;
167167
}
168168

169169
if(numPropSearch > 0){
170-
tpropsrchrate = double(nonDomPropSearch)/double(numPropSearch);
170+
tpropsrchrate = min(double(nonDomPropSearch)/double(numPropSearch),oneobjrate);
171171
}
172172
else{
173173
tpropsrchrate = oneobjrate;
@@ -347,7 +347,7 @@ int main(int ac, char* av[])
347347
bool bitOn = find(fitnessNames.begin(),fitnessNames.end(),BitscoreSumFit) != fitnessNames.end();
348348
bool evalsOn = find(fitnessNames.begin(),fitnessNames.end(),EvalsSumFit) != fitnessNames.end();
349349
vector<fitnessName> allFitnessNames {ECFit,ICSFit,S3Fit,GOCFit,
350-
BitscoreSumFit,EvalsSumFit,SizeFit};
350+
BitscoreSumFit,EvalsSumFit,SizeFit, ICSTimesEC, S3Variant};
351351
for(auto fitnm : allFitnessNames){
352352
infoFile <<'\t'<<fitnessNameToStr(fitnm);
353353
if(find(fitnessNames.begin(),fitnessNames.end(), fitnm) != fitnessNames.end()){
@@ -384,7 +384,11 @@ int main(int ac, char* av[])
384384
infoFile<<'?'<<'\t';
385385
}
386386

387-
infoFile<<archive.nonDominated[i]->alnSize();
387+
infoFile<<archive.nonDominated[i]->alnSize()<<'\t';
388+
389+
infoFile<<archive.nonDominated[i]->icsTimesEC()<<'\t';
390+
391+
infoFile<<archive.nonDominated[i]->s3Variant();
388392

389393
infoFile << endl;
390394
}

0 commit comments

Comments
 (0)