[Genabel-commits] r1572 - pkg/OmicABEL/src/reshuffle

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jan 29 18:25:59 CET 2014


Author: sharapovsodbo
Date: 2014-01-29 18:25:58 +0100 (Wed, 29 Jan 2014)
New Revision: 1572

Modified:
   pkg/OmicABEL/src/reshuffle/Parameters.cpp
   pkg/OmicABEL/src/reshuffle/main.cpp
   pkg/OmicABEL/src/reshuffle/reshuffle.cpp
Log:
-ver 0.33 Fixed bug with "help" message. Fixed bug with --herit option

Modified: pkg/OmicABEL/src/reshuffle/Parameters.cpp
===================================================================
--- pkg/OmicABEL/src/reshuffle/Parameters.cpp	2014-01-27 18:09:29 UTC (rev 1571)
+++ pkg/OmicABEL/src/reshuffle/Parameters.cpp	2014-01-29 17:25:58 UTC (rev 1572)
@@ -119,7 +119,7 @@
 
 	//get input file names and delete it from argv[]
 	string filename= argv[1];
-	if (filename.find("--")==0||filename.find("-h")==0)
+	if (filename.find("--help")==0||filename.find("-h")==0)
 		get_help=true;
 	iout_fname = filename + ".iout";
 	out_fname = filename + ".out";

Modified: pkg/OmicABEL/src/reshuffle/main.cpp
===================================================================
--- pkg/OmicABEL/src/reshuffle/main.cpp	2014-01-27 18:09:29 UTC (rev 1571)
+++ pkg/OmicABEL/src/reshuffle/main.cpp	2014-01-29 17:25:58 UTC (rev 1572)
@@ -37,28 +37,29 @@
 		print_help();
 	}
 	Parameters Params(argc, argv);
-	if((Params.get_help||(Params.iout_fname==".iout"&&Params.out_fname==".out"))&&(!Params.run_test)){
+	if(Params.get_help||(Params.iout_fname==".iout"&&Params.out_fname==".out")){
 		print_help();
-	}
-	if(Params.get_info)
-		cout << Params;
-	if(Params.param_coutner>1){
-		cout<<"\nToo many parameters. Please, reduce number of parameters";
-		exit(1);
-	}
+	}else{
+		if(Params.get_info)
+			cout << Params;
+		if(Params.param_coutner>1){
+			cout<<"\nToo many parameters. Please, reduce number of parameters";
+			exit(1);
+		}
 
-	cout<<"\nStart reshuffeling";
-	iout_file iout_F(Params);
-	cout << "\nFinish iout_file read\t" << double(clock()) / CLOCKS_PER_SEC <<" sec";
+		cout<<"\nStart reshuffeling";
+		iout_file iout_F(Params);
+		cout << "\nFinish iout_file read\t" << double(clock()) / CLOCKS_PER_SEC <<" sec";
 
-	if(Params.traits.use)
-		Params.traits.setbynames(*(iout_F.labels.trait_names));
-	if(Params.snps.use)
-		Params.snps.setbynames(*(iout_F.labels.snp_names));
-	if(Params.herit.use)
-		Params.herit.setbynames(*(iout_F.labels.trait_names));
-	Reshuffle reshh(iout_F,Params);
-	reshh.run();
-	cout << "\nFinish reshuffling " << double(clock()) / CLOCKS_PER_SEC <<" sec";
+		if(Params.traits.use)
+			Params.traits.setbynames(*(iout_F.labels.trait_names));
+		if(Params.snps.use)
+			Params.snps.setbynames(*(iout_F.labels.snp_names));
+		if(Params.herit.use)
+			Params.herit.setbynames(*(iout_F.labels.trait_names));
+		Reshuffle reshh(iout_F,Params);
+		reshh.run();
+		cout << "\nFinish reshuffling " << double(clock()) / CLOCKS_PER_SEC <<" sec";
+	}
 	return (0);
 }

Modified: pkg/OmicABEL/src/reshuffle/reshuffle.cpp
===================================================================
--- pkg/OmicABEL/src/reshuffle/reshuffle.cpp	2014-01-27 18:09:29 UTC (rev 1571)
+++ pkg/OmicABEL/src/reshuffle/reshuffle.cpp	2014-01-29 17:25:58 UTC (rev 1572)
@@ -256,23 +256,13 @@
 		out_file.seekg(est_shift(counter), ios_base::beg);
 	}
 	out_file.seekg(est_shift(3), ios_base::beg);
-	counter=0;
-	for (unsigned int beta=0;beta<(*(p_iout_file->labels.beta)).size();beta++) {
-		beta++;
-		if (beta != (*(p_iout_file->labels.beta)).size()) {
-			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.seekg(*trait*sizeof(double),ios_base::cur);
-				out_file.read((char *) &tmp_number, sizeof(double));
-				herest << tmp_number << "\t";
-				out_file.seekg(est_beta_shift(counter), ios_base::beg);
-			}
-			counter++;
-			out_file.seekg(est_beta_shift(counter), ios_base::beg);
-			herest << "\n";
-			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));
+			herest << tmp_number << "\t";
 		}
+		herest << "\n";
 	}
 	cout << "\nEnd write heritabilities and estimates\t" << double(clock()) / CLOCKS_PER_SEC <<" sec";
 }



More information about the Genabel-commits mailing list