[Genabel-commits] r824 - pkg/VariABEL/src/VARlib

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Dec 7 11:55:54 CET 2011


Author: maksim
Date: 2011-12-07 11:55:53 +0100 (Wed, 07 Dec 2011)
New Revision: 824

Modified:
   pkg/VariABEL/src/VARlib/gtps_container.cpp
   pkg/VariABEL/src/VARlib/supplementary_functions.cpp
   pkg/VariABEL/src/VARlib/var_homogeneity_test_C.cpp
   pkg/VariABEL/src/VARlib/var_homogeneity_tests.cpp
Log:
Replaced std::cout, std::cerr, exit(1) by Rprintf, error

Modified: pkg/VariABEL/src/VARlib/gtps_container.cpp
===================================================================
--- pkg/VariABEL/src/VARlib/gtps_container.cpp	2011-12-07 10:33:34 UTC (rev 823)
+++ pkg/VariABEL/src/VARlib/gtps_container.cpp	2011-12-07 10:55:53 UTC (rev 824)
@@ -42,7 +42,6 @@
 snp_numbers = snp_numbers_;
 nbytes_for_one_snp = unsigned(ceil(double(id_numbers)/4.) + 0.5);
 
-//std::cout<<"gtps_container::gtps_container: nbytes_for_one_snp="<<nbytes_for_one_snp<<"\n";
 
 }
 //------------------------------------------------------------------
@@ -124,11 +123,8 @@
 char* gtps_for_one_snp = new char(nbytes_for_one_snp);
 get_our_byte_number_and_local_person_number(1, snp_position); //calculate our_byte_number value
 
-std::cout<<"gtps_container::get_gtps_array_for_snp:  our_byte_number="<<our_byte_number<<"\n";
-std::cout<<"gtps_container::get_gtps_array_for_snp:  nbytes_for_one_snp="<<nbytes_for_one_snp<<"\n";
-	
-std::cout<<"gtps_array[0]="<<int(gtps_array[0])<<"\n";
 
+
 for(unsigned int i=0 ; i<nbytes_for_one_snp; i++)
 	{
 	gtps_for_one_snp[i]=gtps_array[our_byte_number-1+i];
@@ -150,7 +146,7 @@
 char gtps_container::get_strand(unsigned snp_position)
 {
 if(do_we_have_strand_and_codding_arrays) return strand_array[snp_position-1]; 
-else std::cout<<"gtps_container::get_strand: You can not get strand since you create object with constructor gtps_container(char * gtps_array_raw, unsigned id_numbers, unsigned snp_numbers)\n";
+else Rprintf("gtps_container::get_strand: You can not get strand since you create object with constructor gtps_container(char * gtps_array_raw, unsigned id_numbers, unsigned snp_numbers)");
 return char(0);
 }
 
@@ -159,7 +155,7 @@
 char gtps_container::get_coding(unsigned snp_position)
 {
 if(do_we_have_strand_and_codding_arrays) return coding_array[snp_position-1]; 
-else std::cout<<"gtps_container::get_strand: You can not get strand since you create object with constructor gtps_container(char * gtps_array_raw, unsigned id_numbers, unsigned snp_numbers)\n";
+else Rprintf("gtps_container::get_strand: You can not get strand since you create object with constructor gtps_container(char * gtps_array_raw, unsigned id_numbers, unsigned snp_numbers)");
 return char(0);
 }
 
@@ -167,27 +163,20 @@
 //------------------------------------------------------------------
 void gtps_container::set(unsigned id_position, unsigned snp_position, char data)
 {
-//for(int i=0 ; i<4 ; i++)
-//std::cout<<"rearrangement_array["<<i<<"]="<<rearrangement_array[i]<<"\n";
 
 		
 static const char clear_info_for_person[]={63, 207, 243, 252};
 		
-//std::cout<<"set: id_position="<<id_position<<", snp_position="<<snp_position<<", data="<<int(data)<<"\n";
 get_our_byte_number_and_local_person_number(id_position, snp_position);
 
 
-//std::cout<<"set: (gtps_array[our_byte_number]&clear_info_for_person[local_person_number-1])="<<int(gtps_array[our_byte_number]&clear_info_for_person[local_person_number-1])<<"\n";
 
 //char tmp = (gtps_array[our_byte_number]&clear_info_for_person[local_person_number-1]) | data;
-//std::cout<<"set: tmp="<<int(tmp)<<"\n";
 
 
-//std::cout<<"gtps_array["<<our_byte_number-1<<"] = (gtps_array["<<our_byte_number-1<<"]&"<<int(clear_info_for_person[local_person_number-1])<<" |"<< int((data&3)<<rearrangement_array[local_person_number-1])<<"\n";
 
 
 gtps_array[our_byte_number-1] = (gtps_array[our_byte_number-1]&clear_info_for_person[local_person_number-1]) | (data&3)<<rearrangement_array[local_person_number-1];
-//std::cout<<"gtps_array["<<our_byte_number<<"-1]="<<int(gtps_array[our_byte_number-1])<<"\n";
 }
 //------------------------------------------------------------------
 
@@ -199,12 +188,10 @@
 {
 if (id_position > id_numbers || id_position<0)
 	{
-	std::cerr<<"Bad ID number. ID_number="<<id_position<<". Maximum ID_number can be "<<id_position<<"\n";
 	}
 
 if(snp_position > snp_position || snp_position <0)
 	{
-	std::cerr<<"Bad ID number. ID_number="<<id_position<<". Maximum ID_number can be "<<id_position<<"\n";
 	}
 }
 */

Modified: pkg/VariABEL/src/VARlib/supplementary_functions.cpp
===================================================================
--- pkg/VariABEL/src/VARlib/supplementary_functions.cpp	2011-12-07 10:33:34 UTC (rev 823)
+++ pkg/VariABEL/src/VARlib/supplementary_functions.cpp	2011-12-07 10:55:53 UTC (rev 824)
@@ -661,14 +661,12 @@
 
 //for(int i=0 ; i<vec->size() ; i++)
 //	{
-//	std::cout<<"my_median: vec["<<i<<"]="<<(*vec)[i]<<"\n";
 //	}
 
 std::sort(vec->begin(), vec->end());
 
 //for(int i=0 ; i<vec->size() ; i++)
 //	{
-//	std::cout<<"my_median: vec["<<i<<"]="<<(*vec)[i]<<"\n";
 //	}
 
 
@@ -713,8 +711,9 @@
 	double sum = 0;
 	double mean = my_mean(vec);
 
-	if(vec->number <= 1) {std::cout<<"error: var: sample has not more than one element\n"; exit(1);}
+	error("error: var: sample has not more than one element")
 
+
 	for(unsigned i=0; i<vec->number ; i++)
 		{
 		sum += (vec->vector[i]-mean)*(vec->vector[i]-mean);
@@ -735,7 +734,7 @@
   mean = 0;
 	
 
-	if(vec->number == 0) {std::cout<<"error: get_mean: sample does not have any element\n"; return NA_value;}
+	if(vec->number == 0) {Rptintf("error: get_mean: sample does not have any element"); return NA_value;}
 
 	for(unsigned i=0; i<vec->number ; i++)
 		{
@@ -871,7 +870,6 @@
 
 	for(unsigned id=0 ; id < *nids ; id++)
 		{
-		//std::cout<<"break_trait_up_into_groups: trait["<<id<<"]="<<trait[id]<<", is_trait_na["<<id<<"]="<<is_trait_na[id]<<", snp["<<id<<"]="<<snp[id]<<"\n";	
 		if(is_trait_na[id] == 1) continue;
 
 	//get bestguess:
@@ -882,7 +880,6 @@
 	if(snp[id]>1.5 && snp[id]<=2. ) snp_value=2;
 	//________________		
 
-//	std::cout<<"id="<<id<<", snp_value="<<snp_value<<"\n";
 
 		//spread ids trait among genotype group
 		switch(snp_value)

Modified: pkg/VariABEL/src/VARlib/var_homogeneity_test_C.cpp
===================================================================
--- pkg/VariABEL/src/VARlib/var_homogeneity_test_C.cpp	2011-12-07 10:33:34 UTC (rev 823)
+++ pkg/VariABEL/src/VARlib/var_homogeneity_test_C.cpp	2011-12-07 10:55:53 UTC (rev 824)
@@ -98,26 +98,20 @@
 	//fillfull the last covariates by the values from snp
 	for(int i=nids*(p-1) ; i<nids*p ; i++) 
 		{
-		//std::cout<<"design_matrix_copy["<<i<<"]="<<design_matrix_copy[i]<<", snp["<<i-nids*(p-1)<<"]="<<snp[i-nids*(p-1)]<<"\n";
 	
-//		std::cout<<"design_matrix_copy["<<i<<"]="<<design_matrix_copy[i]<<", snp["<<i-nids*(p-1)<<"]="<<snp[i-nids*(p-1)]<<"\n";
 		design_matrix_copy[i]=snp[i-nids*(p-1)];
 		}
 	
 //	for(int i=0 ; i<nids*p ; i++) 
 //		{
-//		std::cout<<"design_matrix_copy["<<i<<"]="<<design_matrix_copy[i]<<"\n";
 //		}
-//		std::cout<<"nids="<<nids<<", p="<<p;
 		
 
 //	for(int i=0 ; i<nids ; i++)
 //		{
-//		std::cout<<"is_trait_na["<<i<<"]="<<is_trait_na[i]<<"\n";
 //		}
 
 
-//	std::cout<<"\np="<<p<<"\n";
 
 
 
@@ -135,11 +129,9 @@
 		{
 		for(int id=0; id<nids ; id++)
 			{
-//			std::cout<<"design_matrix_copy["<<id + column*nids<<"]="<<design_matrix_copy[id + column*nids]<<"\n";
 			if(is_trait_na[id] == 0) 
 				{
 				design_matrix[nids_nona] = design_matrix_copy[id + column*nids];
-	//			std::cout<<"design_matrix["<<nids_nona<<"]="<<design_matrix[nids_nona]<<"\n";
 				
 				nids_nona++;	
 				}
@@ -158,7 +150,6 @@
 
 	
 
-//	std::cout<<"nids_nona="<<nids_nona<<"\n";
 	//___________________________________________
 
 	
@@ -171,12 +162,10 @@
 
 //	for(int i=0; i<2*nids_nona ; i++)
 //		{
-//		std::cout<<"design_matrix_copy["<<i<<"]="<<design_matrix_copy[i]<<"\n";
 //		}
 
 //	for(int i=0; i<nids_nona ; i++)
 //		{
-//		std::cout<<"trait["<<i<<"]="<<trait[i]<<"\n";
 //		}
 
 
@@ -194,8 +183,6 @@
 		
 
 
-//	std::cout<<"main effect: beta0="<<betas[0]<<", se0="<<se[0]<<"\n";
-//	std::cout<<"main effect: beta1="<<betas[1]<<", se1="<<se[1]<<"\n";
 
 
 	//___________________________________________
@@ -209,10 +196,8 @@
 								/*auxiliary variables:*/ qty, jpvt, qraux, work, v, x_for_ch2inv);
 
 	//___________________________________________
-//	std::cout<<"dispersion effect: beta="<<betas[p-1]<<", se["<<p-1<<"]="<<se[p-1]<<"\n";
 
 
-//	for(int i=0 ; i<p ; i++) {std::cout<<"betas["<<i<<"]="<<betas[i]<<", se["<<i<<"]="<<se[i]<<"\n";}
 
 
 	*chi2 = (betas_disp[1]/se_disp[1])*(betas_disp[1]/se_disp[1]);
@@ -222,7 +207,6 @@
 	
 	}
 
-//std::cout<<"variance_homogeneity_test_C: END\n";
 return;
 } // end of function bartlett_test
 //_________________________________________________________________________________________________

Modified: pkg/VariABEL/src/VARlib/var_homogeneity_tests.cpp
===================================================================
--- pkg/VariABEL/src/VARlib/var_homogeneity_tests.cpp	2011-12-07 10:33:34 UTC (rev 823)
+++ pkg/VariABEL/src/VARlib/var_homogeneity_tests.cpp	2011-12-07 10:55:53 UTC (rev 824)
@@ -124,7 +124,6 @@
 	return chi2;
 
 //	unsigned sample_amount = samples->size();
-//	if(sample_amount <= 1) {std::cout<<"error: bartlett_test: only one sample found\n"; return -1;}
 //
 //	std::list<my_small_vector>::const_iterator it;
 //
@@ -136,10 +135,8 @@
 //
 //	for(it=samples->begin(); it!=samples->end(); ++it)
 //		{
-//		if(it->number <= 1) {std::cout<<"error: bartlett_test: one of the sample has 1 element only\n"; return -1;}
 //		N += it->number;
 //		var_i = var(*it);
-//		if(var_i > -1.E-32 && var_i < 1.E-32) {std::cout<<"error: bartlett_test: one of the sample has too small variance\n"; return -1;}
 //		sum_ni_1lnSi2 += (it->number - 1)*log(var_i);
 //		sum_1__n_1 += 1./(it->number-1.);
 //		Sp2 += (it->number - 1)*var_i;
@@ -183,7 +180,6 @@
   if(snp->COUNTS[i] == 0 || is_na(snp->COUNTS[i])) continue;
 	common_mean += snp->MEAN[i]*snp->COUNTS[i];
 	N += snp->COUNTS[i];
-	std::cout<<"snp->COUNTS["<<i<<"]="<<snp->COUNTS[i]<<"\n";
 	geno_group_num++;
 	}
 
@@ -217,7 +213,6 @@
 
 chisq = (N-geno_group_num)*var_mean/(var_sum*df);
 
-std::cout<<"leven_test: chisq="<<chisq<<", df="<<df<<"\n";
 
 return chisq_df(chisq, df);
 



More information about the Genabel-commits mailing list