File: sets.h

package info (click to toggle)
plink 1.07%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 3,136 kB
  • sloc: cpp: 72,375; makefile: 123; sh: 12
file content (88 lines) | stat: -rw-r--r-- 2,226 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88


//////////////////////////////////////////////////////////////////
//                                                              //
//           PLINK (c) 2005-2008 Shaun Purcell                  //
//                                                              //
// This file is distributed under the GNU General Public        //
// License, Version 2.  Please see the file COPYING for more    //
// details                                                      //
//                                                              //
//////////////////////////////////////////////////////////////////


#ifndef __SETS_H__
#define __SETS_H__

class SetSortedSNP
{
 public:
  double chisq;
  int l;
  bool operator< (const SetSortedSNP & s2) const
    {  return (chisq < s2.chisq); }  
};


class Set
{
  
 public:
  
  vector<int> s_min;
  vector<int> s_max;
  
  Set(vector<vector<int> > &);
  
  vector<vector<int> > & snpset;
  
  map<int,set<int> > setMapping;

  // Sum-statistics based set-based scores
  void empiricalSetPValues();
  void cumulativeSetSum_WITHOUTLABELS(vector<double>&,int);
  void cumulativeSetSum_WITHLABELS(Plink &, vector<double>&);
  
  
  // Profile-score based set-based tests
  void initialiseSetMapping();
  void profileTestSNPInformation(int,double);
  vector_t profileTestScore();
  void profileTestInitialise();
  
  vector<vector<int> > profileSNPs;
  vector<vector_t> profileScore;
  
  // Stepwise regression models
  vector_t fitStepwiseModel();

  // New, LD-aware single-statistic set test
  vector_t fitLDSetTest(vector_t&,bool);
  vector< vector<set<int> > > ldSet;
  vector<int> numSig;
  vector<vector<int> > selectedSNPs;

  // Helper functions  
  void sizeSets();
  void pruneSets(Plink&);
  void pruneMC(Plink &,bool,double);
  void dropNotSet(Plink &);
  void makeLDSets();

  // get better name ?? 
  vector<vector<string> > setsort;
  
  // All statistics
  vector<vector<vector<double> > > stat_set;
  
  // Empirical set-based p-values (p0, p1 and p2)
  vector<vector<vector<double> > > pv_set;
  vector<vector<double> > pv_maxG_set;
  vector<vector<double> > pv_maxE_set;

  // Include or drop this SNP (multi-collinearity)
  vector<vector<bool> > cur;
  
};

#endif