Commit f27a7156 authored by Raquel Bromberg's avatar Raquel Bromberg

minor code changes

parent 9db65c61
......@@ -624,7 +624,42 @@ void mctr::set_bitsv()
if(run_type==0) //the normal case.
{
ifstream instream;
double max=-1;
for(int numg=0; numg<number_of_genomes; numg++)
{
ifstream histstream;
u.open_ifile(histstream,path+"/"+bfn+"/HIST/"+bfn+"_"+u.int_to_string(numg)+"_hist.txt","histstream");
bits_holder bh_temp;
int gnum;
histstream>>gnum;
if(gnum!=numg)
{
cout<<"Mismatch in set_bitsv case 0."<<endl;
exit(1);
}
int total_residues;
histstream>>total_residues;
for(int j=0; j<20; j++)
{
int count;
double frequency;
histstream>>count>>frequency;
bh_temp.d[j]=(double)count/(double)total_residues;
bh_temp.d[j]=( (log(bh_temp.d[j])) * (-1.0)) / 2.0; //NOTE: using log, which in C++ uses base e.
//NOTE: Divide by 2 here to speed up calculating scores in get_score(...)
if(max==-1 || max<bh_temp.d[j])
{
max = bh_temp.d[j];
}
}
bitsv.push_back(bh_temp);
histstream.close();
}
/* ifstream instream;
u.open_ifile(instream,path+"/"+bfn+"/"+bfn+"_hist.txt","instream");
double max=-1;
......@@ -647,11 +682,10 @@ void mctr::set_bitsv()
//NOTE: Divide by 2 here to speed up calculating scores in get_score(...)
if(max==-1 || max<bh_temp.d[j])
{
max = bh_temp.d[j];
max = bh_temp.d[j];
}
}
bitsv.push_back(bh_temp);
}
}
bitsv.push_back(bh_temp);*/
max_single_bit_value=max;
} //end of normal case run_type==0
......@@ -696,13 +730,23 @@ void mctr::set_bitsv()
outstream.close();
ifstream probstream;
u.open_ifile(probstream,path+"/"+bfn+"/"+bfn+"_hist.txt","probstream");
// ifstream probstream;
// u.open_ifile(probstream,path+"/"+bfn+"/"+bfn+"_hist.txt","probstream");
//get the bits for the 2 problem proteomes.
double max=-1;
for(int i=0; i<number_of_genomes; i++) //number_of_genomes, NOT number_of_genomes_ref, because the code has to go through the entire set to find a) all the reference genomes and b) the two problem genomes.
{
ifstream probstream;
string probfile=path+"/"+bfn+"/HIST/"+bfn+"_"+u.int_to_string(i)+"_hist.txt";
probstream.open(probfile.c_str());
if(probstream.fail())
{
cout<<"Failed to open probstream to probfile="<<probfile<<endl;
cout<<"run_type=="<<run_type<<endl;
exit(1);
}
int gnum;
probstream>>gnum;
int total_residues;
......@@ -737,21 +781,28 @@ void mctr::set_bitsv()
{
bitsv.push_back(bh_temp);
}
probstream.close();
}
probstream.close();
max_single_bit_value=max;
}
} //run_type==1
else if(run_type==2) //Running a pair against itself, with the suspicious genes already flagged by the previous run against a reference set.
{
ifstream probstream;
u.open_ifile(probstream,path+"/"+bfn+"/"+bfn+"_hist.txt","probstream");
//get the bits for the 2 problem proteomes.
double max=-1;
for(int i=0; i<number_of_genomes; i++) //number_of_genomes, NOT number_of_genomes_ref, because the code has to go through the entire set to find a) all the reference genomes and b) the two problem genomes.
{
ifstream probstream;
string probfile=path+"/"+bfn+"/HIST/"+bfn+"_"+u.int_to_string(i)+"_hist.txt";
probstream.open(probfile.c_str());
if(probstream.fail())
{
cout<<"Failed to open probstream to probfile="<<probfile<<endl;
cout<<"run_type=="<<run_type<<endl;
exit(1);
}
bits_holder bh_temp;
int gnum;
probstream>>gnum;
......@@ -782,11 +833,11 @@ void mctr::set_bitsv()
it++;
bitsv.insert(it,bh_temp);
}
probstream.close();
}
probstream.close();
max_single_bit_value=max;
if(bitsv.size()!=2)
{
cout<<"Problem in void mctr::set_bitsv()"<<endl;
......@@ -795,7 +846,8 @@ void mctr::set_bitsv()
cout<<"prob2 = "<<prob2<<endl;
exit(1);
}
}
} //run_type==2
} //end of set_bitsv()
/*****************************************************
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment