[Genabel-commits] r1943 - pkg/OmicABEL/src/reshuffle
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Apr 12 08:54:33 CEST 2015
Author: sharapovsodbo
Date: 2015-04-12 08:54:30 +0200 (Sun, 12 Apr 2015)
New Revision: 1943
Modified:
pkg/OmicABEL/src/reshuffle/Parameters.cpp
pkg/OmicABEL/src/reshuffle/main.cpp
pkg/OmicABEL/src/reshuffle/makefile
pkg/OmicABEL/src/reshuffle/reshuffle.cpp
Log:
Version 0.34
fixed bug with "--chi" options fixed (before "--chi=0" or "--chi" extracted SNPs with chi>=1)
fixed same bug with "--chi" "--dataslim" options fixed
fixed bug with "--outfile" option (before "--outfile" didn't work if "--chi" was used)
fixed bug with trait names output format
minor changes
Modified: pkg/OmicABEL/src/reshuffle/Parameters.cpp
===================================================================
--- pkg/OmicABEL/src/reshuffle/Parameters.cpp 2015-03-31 13:05:51 UTC (rev 1942)
+++ pkg/OmicABEL/src/reshuffle/Parameters.cpp 2015-04-12 06:54:30 UTC (rev 1943)
@@ -136,7 +136,7 @@
{"traits",optional_argument,NULL,'t'},
{"snps",optional_argument,NULL,'s'},
{"herit",optional_argument,NULL,'e'},
- {"chi",required_argument,NULL,'c'},
+ {"chi",optional_argument,NULL,'c'},
{"dataslim",no_argument,NULL,'l'},
{"outfile",required_argument,NULL,'o'},
{NULL,0,NULL,0}
@@ -179,10 +179,12 @@
}
case 'c':{
chi = Parameter(optarg,"chi");
- if (chi.numbersset.size()==0){
- cout<<"\nChi value is not a number. Please, set correct Chi value";
+ //cout << "\n\nchi.numbersset = " << chi<<"\n\n";
+ /*if (chi.numbersset.size()==0){
+ cout<<"\nChi value is not a number. Please, set correct Chi value\n";
exit(1);
- }
+ }*/
+ //cout <<"\nChi is yopta " << chi;
break;
}
@@ -193,6 +195,7 @@
case 'o':{
default_outfile = false;
outfile=optarg;
+ //cout << "\n\nOutfile name os yopta = " << outfile<<"\n\n";
break;
}
}
Modified: pkg/OmicABEL/src/reshuffle/main.cpp
===================================================================
--- pkg/OmicABEL/src/reshuffle/main.cpp 2015-03-31 13:05:51 UTC (rev 1942)
+++ pkg/OmicABEL/src/reshuffle/main.cpp 2015-04-12 06:54:30 UTC (rev 1943)
@@ -49,7 +49,7 @@
cout<<"\nStart reshuffeling";
iout_file iout_F(Params);
- cout << "\nFinish iout_file read\t" << double(clock()) / CLOCKS_PER_SEC <<" sec";
+ cout << "\nFinish iout_file read " << double(clock()) / CLOCKS_PER_SEC <<" sec";
if(Params.traits.use)
Params.traits.setbynames(*(iout_F.labels.trait_names));
@@ -59,7 +59,7 @@
Params.herit.setbynames(*(iout_F.labels.trait_names));
Reshuffle reshh(iout_F,Params);
reshh.run();
- cout << "\nFinish reshuffling " << double(clock()) / CLOCKS_PER_SEC <<" sec";
- }
+ cout << "\nFinish reshuffling " << double(clock()) / CLOCKS_PER_SEC <<" sec\n\n";
+ }
return (0);
}
Modified: pkg/OmicABEL/src/reshuffle/makefile
===================================================================
--- pkg/OmicABEL/src/reshuffle/makefile 2015-03-31 13:05:51 UTC (rev 1942)
+++ pkg/OmicABEL/src/reshuffle/makefile 2015-04-12 06:54:30 UTC (rev 1943)
@@ -3,12 +3,8 @@
g++ -O3 -Wall -c -fmessage-length=0 -o reshuffle_obj.o reshuffle.cpp
g++ -O3 -Wall -c -fmessage-length=0 -o Parameters.o Parameters.cpp
g++ -O3 -Wall -c -fmessage-length=0 -o main.o main.cpp
- g++ -o reshuffle "reshuffle_obj.o" "main.o" "iout_file.o" "Parameters.o
+ g++ -o reshuffle reshuffle_obj.o main.o iout_file.o Parameters.o
clean:
- del iout_file.o
- del reshuffle_obj.o
- del Parameters.o
- del main.o
- del reshuffle
\ No newline at end of file
+ rm -rf *.o reshuffle
\ No newline at end of file
Modified: pkg/OmicABEL/src/reshuffle/reshuffle.cpp
===================================================================
--- pkg/OmicABEL/src/reshuffle/reshuffle.cpp 2015-03-31 13:05:51 UTC (rev 1942)
+++ pkg/OmicABEL/src/reshuffle/reshuffle.cpp 2015-04-12 06:54:30 UTC (rev 1943)
@@ -25,7 +25,7 @@
txt_datadims << "Number of traits\t" << (*p_iout_file).header.t << endl;
txt_datadims << "Number of SNP\t" << (*p_iout_file).header.m << endl;
txt_datadims << "Number of covariates\t" << ((*p_iout_file).header.p - 2);
- cout<<"\nEnd write data dimension\t"<< double(clock()) / CLOCKS_PER_SEC <<" sec";
+ cout<<"\nEnd write data dimension "<< double(clock()) / CLOCKS_PER_SEC <<" sec";
}
void Reshuffle::write_snpnames(ofstream& txt_snpnames){
@@ -36,8 +36,8 @@
cout<<"\nWriting all SNP's names";
}
for(set<int>::iterator it= (*p_Parameters).snpnames.numbersset.begin();it!=(*p_Parameters).snpnames.numbersset.end();++it)
- txt_snpnames << "\nSNP #"<<(*it+1)<<"\t"<<(*(*p_iout_file).labels.snp_names)[*it];
- cout<<"\nEnd write SNP's names\t" << double(clock()) / CLOCKS_PER_SEC <<" sec";
+ txt_snpnames << "\nSNP#"<<(*it+1)<<"\t"<<(*(*p_iout_file).labels.snp_names)[*it];
+ cout<<"\nEnd write SNP's names " << double(clock()) / CLOCKS_PER_SEC <<" sec";
}
void Reshuffle::write_traitnames(ofstream& txt_traitnames){
@@ -48,13 +48,13 @@
cout<<"\nWriting all trait's names";
}
for(std::set<int>::iterator it= (*p_Parameters).traitnames.numbersset.begin();it!=p_Parameters->traitnames.numbersset.end();++it)
- txt_traitnames<<"TRAIT #"<<(*it+1)<<"\t"<<(*(*p_iout_file).labels.trait_names)[*it];
- cout<<"\nEnd write trait's names\t" << double(clock()) / CLOCKS_PER_SEC <<" sec" << endl;
+ txt_traitnames<<"\nTRAIT#"<<(*it+1)<<"\t"<<(*(*p_iout_file).labels.trait_names)[*it];
+ cout<<"\nEnd write trait's names " << double(clock()) / CLOCKS_PER_SEC <<" sec" << endl;
}
void Reshuffle::write_data(ifstream& out_file,ofstream& data){
out_file.seekg(0, ios_base::beg);
- cout << "\nStart write data\t" << double(clock()) / CLOCKS_PER_SEC <<" sec";
+ cout << "\nStart write data " << double(clock()) / CLOCKS_PER_SEC <<" sec";
data.precision(PRECISION_DOUBLE);
data<<"SNP\t";
data<< "Trait\t";
@@ -98,8 +98,13 @@
out_file.seekg(0, ios_base::beg);
double chi = 0;
set<int>::iterator chi_val = (*p_Parameters).chi.numbersset.begin();
- double CheckChi = *chi_val+1;
- cout << "\nStart write chi data=" << double(clock()) / CLOCKS_PER_SEC <<" sec";
+ double CheckChi = 0;
+ if((*p_Parameters).chi.numbersset.size()==0){
+ CheckChi = 0;
+ }else{
+ CheckChi = *chi_val+1;
+ }
+ cout << "\nStart write chi data " << double(clock()) / CLOCKS_PER_SEC <<" sec";
txt_chi.precision(PRECISION_DOUBLE);
txt_chi << "SNP\t";
txt_chi << "Trait\t";
@@ -139,22 +144,27 @@
ostr.clear();
}
delete buf;
- cout << "\nFinish write chi data\t" << double(clock()) / CLOCKS_PER_SEC <<" sec";
+ cout << "\nFinish write chi data " << double(clock()) / CLOCKS_PER_SEC <<" sec";
}
void Reshuffle::write_slim_data(ifstream& out_file, ofstream& txt_slim){
- cout << "\nStart write slim data=" << double(clock()) / CLOCKS_PER_SEC <<" sec";
+ cout << "\nStart write slim data " << double(clock()) / CLOCKS_PER_SEC <<" sec";
out_file.seekg(0, ios_base::beg);
set<int> goodtraits;
set<int> goodsnps;
double chi = 0;
if((*p_Parameters).chi.def_value||(!(*p_Parameters).chi.use)){
cout << "\nERROR: " << "Chi value doesn't exist";
- cout << "\nPlease, set Chi value to get slim data";
+ cout << "\nPlease, set Chi value to get slim data\n";
exit(1);
}
set<int>::iterator chi_val = (*p_Parameters).chi.numbersset.begin();
- double CheckChi = *chi_val+1;
+ double CheckChi = 0;
+ if((*p_Parameters).chi.numbersset.size()==0){
+ CheckChi = 0;
+ }else{
+ CheckChi = *chi_val+1;
+ }
double* buf = new double[per_trait_per_snp];
for (set<int>::iterator trait= (*p_Parameters).traits.numbersset.begin();trait!=(*p_Parameters).traits.numbersset.end();trait++) {
long long oldPos=0,pos = 0;
@@ -211,7 +221,7 @@
ostr.clear();
}
delete buf;
- cout <<"\nEnd write slim data\t" << double(clock()) / CLOCKS_PER_SEC <<" sec";
+ cout <<"\nEnd write slim data " << double(clock()) / CLOCKS_PER_SEC <<" sec";
}
int Reshuffle::est_shift(int counter){
@@ -256,7 +266,7 @@
out_file.seekg(est_shift(counter), ios_base::beg);
}
out_file.seekg(est_shift(3), ios_base::beg);
- for (unsigned int beta=0;beta<(*(p_iout_file->labels.beta)).size()-1;beta++) {
+ for (unsigned int beta=0;beta<(*(p_iout_file->labels.beta)).size()-1;beta++) {
herest << (*(p_iout_file->labels).beta)[beta] << "\t";
for (std::set<int>::iterator trait= p_Parameters->herit.numbersset.begin();trait!=p_Parameters->herit.numbersset.end();trait++) {
out_file.read((char *) &tmp_number, sizeof(double));
More information about the Genabel-commits
mailing list