aboutsummaryrefslogtreecommitdiff
path: root/src/vc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vc.cpp')
-rw-r--r--src/vc.cpp27
1 files changed, 4 insertions, 23 deletions
diff --git a/src/vc.cpp b/src/vc.cpp
index 94bf931..f17a9e9 100644
--- a/src/vc.cpp
+++ b/src/vc.cpp
@@ -453,7 +453,7 @@ int LogRL_dev12 (const gsl_vector *log_sigma2, void *params, gsl_vector *dev1, g
//read header to determine which column contains which item
-bool ReadHeader (const string &line, HEADER &header)
+bool ReadHeader_vc (const string &line, HEADER &header)
{
string rs_ptr[]={"rs","RS","snp","SNP","snps","SNPS","snpid","SNPID","rsid","RSID"};
set<string> rs_set(rs_ptr, rs_ptr+10);
@@ -586,7 +586,7 @@ void ReadFile_cor (const string &file_cor, const set<string> &setSnps, vector<st
//header
!safeGetline(infile, line).eof();
- ReadHeader (line, header);
+ ReadHeader_vc (line, header);
if (header.n_col==0 ) {
if (header.nobs_col==0 && header.nmis_col==0) {
@@ -700,7 +700,7 @@ void ReadFile_beta (const bool flag_priorscale, const string &file_beta, const m
//read header
HEADER header;
!safeGetline(infile, line).eof();
- ReadHeader (line, header);
+ ReadHeader_vc (line, header);
if (header.n_col==0 ) {
if (header.nobs_col==0 && header.nmis_col==0) {
@@ -869,7 +869,7 @@ void ReadFile_cor (const string &file_cor, const vector<string> &vec_rs, const v
HEADER header;
!safeGetline(infile, line).eof();
- ReadHeader (line, header);
+ ReadHeader_vc (line, header);
while (!safeGetline(infile, line).eof()) {
//do not read cor values this time; upto col_n-1
@@ -1059,25 +1059,6 @@ void ReadFile_cor (const string &file_cor, const vector<string> &vec_rs, const v
return;
}
-
-
-
-
-//copied from lmm.cpp; is used in the following function VCss
-//map a number 1-(n_cvt+2) to an index between 0 and [(n_c+2)^2+(n_c+2)]/2-1
-size_t GetabIndex (const size_t a, const size_t b, const size_t n_cvt) {
- if (a>n_cvt+2 || b>n_cvt+2 || a<=0 || b<=0) {cout<<"error in GetabIndex."<<endl; return 0;}
- size_t index;
- size_t l, h;
- if (b>a) {l=a; h=b;} else {l=b; h=a;}
-
- size_t n=n_cvt+2;
- index=(2*n-l+2)*(l-1)/2+h-l;
-
- return index;
-}
-
-
//use the new method to calculate variance components with summary statistics
//first, use a function CalcS to compute S matrix (where the diagonal elements are part of V(q) ), and then use bootstrap to compute the variance for S, use a set of genotypes, phenotypes, and individual ids, and snp category label
void CalcVCss(const gsl_matrix *Vq, const gsl_matrix *S_mat, const gsl_matrix *Svar_mat, const gsl_vector *q_vec, const gsl_vector *s_vec, const double df, vector<double> &v_pve, vector<double> &v_se_pve, double &pve_total, double &se_pve_total, vector<double> &v_sigma2, vector<double> &v_se_sigma2, vector<double> &v_enrich, vector<double> &v_se_enrich) {