[Genabel-commits] r757 - in pkg/VariABEL/src: ITERlib VARlib
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jul 28 12:29:42 CEST 2011
Author: maksim
Date: 2011-07-28 12:29:42 +0200 (Thu, 28 Jul 2011)
New Revision: 757
Modified:
pkg/VariABEL/src/ITERlib/iterator_functions.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:
fix leven's test. genotypic groups were detemined wrongly
Modified: pkg/VariABEL/src/ITERlib/iterator_functions.cpp
===================================================================
--- pkg/VariABEL/src/ITERlib/iterator_functions.cpp 2011-07-27 13:38:09 UTC (rev 756)
+++ pkg/VariABEL/src/ITERlib/iterator_functions.cpp 2011-07-28 10:29:42 UTC (rev 757)
@@ -473,9 +473,9 @@
double *trait = new double[indataHeight];
- for(int i=0 ; i<indataHeight*(*p) ; i++) design_matrix[i] = design_matrix_[i];
- for(int i=0 ; i<indataHeight*(*p) ; i++) design_matrix_copy[i] = design_matrix_copy_[i];
- for(int i=0 ; i<indataHeight ; i++) trait[i] = trait_[i];
+ for(unsigned i=0 ; i<indataHeight*(*p) ; i++) design_matrix[i] = design_matrix_[i];
+ for(unsigned i=0 ; i<indataHeight*(*p) ; i++) design_matrix_copy[i] = design_matrix_copy_[i];
+ for(unsigned i=0 ; i<indataHeight ; i++) trait[i] = trait_[i];
//indataHeight is nids;
@@ -489,7 +489,7 @@
is_trait_na[id_counter]=0;
//NA among covariates
- for(unsigned column_counter=0 ; column_counter<*p ; column_counter++)
+ for(int column_counter=0 ; column_counter<*p ; column_counter++)
{
if(ISNAN(design_matrix[id_counter + column_counter*indataHeight])) {is_trait_na[id_counter]=1;}
}
Modified: pkg/VariABEL/src/VARlib/supplementary_functions.cpp
===================================================================
--- pkg/VariABEL/src/VARlib/supplementary_functions.cpp 2011-07-27 13:38:09 UTC (rev 756)
+++ pkg/VariABEL/src/VARlib/supplementary_functions.cpp 2011-07-28 10:29:42 UTC (rev 757)
@@ -882,32 +882,34 @@
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)
{
+// case 0:
+// {
+// //NA.push_back(trait[id]);
+// }
+ break;
case 0:
{
- //NA.push_back(trait[id]);
+ AA.push_back(trait[id]);
}
break;
case 1:
{
- AA.push_back(trait[id]);
+ AB.push_back(trait[id]);
}
break;
case 2:
{
- AB.push_back(trait[id]);
- }
- break;
- case 3:
- {
BB.push_back(trait[id]);
}
break;
default:
{
- Rprintf("error: VarABEL: Unexpected genotype code has been detected (%i, %i). Only 0, 1, 2, 3, NA are alowed\n", &snp[id], snp[id]);
+ Rprintf("error: VarABEL: Unexpected genotype code has been detected (%i, %i). Only 0, 1, 2, NA are alowed\n", &snp[id], snp[id]);
return;
}
break;
Modified: pkg/VariABEL/src/VARlib/var_homogeneity_test_C.cpp
===================================================================
--- pkg/VariABEL/src/VARlib/var_homogeneity_test_C.cpp 2011-07-27 13:38:09 UTC (rev 756)
+++ pkg/VariABEL/src/VARlib/var_homogeneity_test_C.cpp 2011-07-28 10:29:42 UTC (rev 757)
@@ -68,12 +68,12 @@
void variance_homogeneity_test_C(double* snp, double *trait, double *design_matrix_copy, double *design_matrix, int *p_, long unsigned* nids_, double *betas, double *se, double * chi2, int * df, double * residuals, int *analys_type_, int * is_trait_na, int *testname, /*auxiliary variables:*/ double *qty, int *jpvt, double *qraux, double *work, double *v, double *x_for_ch2inv)
{
-//std::cout<<"variance_homogeneity_test_C: START\n";
std::list<my_small_vector> trait_groups;
static chisq_df chisq;
+
if(*testname != sqlm)
{
break_trait_up_into_groups(&trait_groups, snp, trait, nids_, *analys_type_, is_trait_na);
Modified: pkg/VariABEL/src/VARlib/var_homogeneity_tests.cpp
===================================================================
--- pkg/VariABEL/src/VARlib/var_homogeneity_tests.cpp 2011-07-27 13:38:09 UTC (rev 756)
+++ pkg/VariABEL/src/VARlib/var_homogeneity_tests.cpp 2011-07-28 10:29:42 UTC (rev 757)
@@ -183,6 +183,7 @@
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++;
}
@@ -216,6 +217,7 @@
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