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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
  
     | 
    
      
//////////////////////////////////////////////////////////////////
//                                                              //
//           PLINK (c) 2005-2007 Shaun Purcell                  //
//                                                              //
// This file is distributed under the GNU General Public        //
// License, Version 2.  Please see the file COPYING for more    //
// details                                                      //
//                                                              //
//////////////////////////////////////////////////////////////////
#ifndef CLUMP_LD_H_
#define CLUMP_LD_H_
#include <string>
#include <vector>
#include <map>
#include "plink.h"
#include "helper.h"
using namespace std;
class ResultTrio
{
public:
  
  double p;  // p-value
  string annot; // Annotation
  int f;     // which results file?
  string s;  // SNP name
  
  bool operator< (const ResultTrio & p2) const
  {
    return ( p < p2.p );
  }
  
};
class ClumpPair {
 public:
  string snp;
  int f;
  bool operator< (const ClumpPair & p2) const
  {
    if ( snp == p2.snp ) return ( f < p2.f );
    return ( snp < p2.snp );
  }
};
class ClumpResults {
 public:
  double p;
  string annot;
  
  bool operator< (const ClumpResults & p2) const
  {
    return ( p < p2.p );
  }
};
class clump_LD
{
public:
  Plink * P;
  HaploPhase * hp;
  //will be user defined
  double pval_cutoff; 
  double ld_distance;
  double second_pval_cutoff;
  float r2_cutoff;
  
  map<string, bool> clumped;
  vector<string> snps;
  vector<double> pvals;
  map<ClumpPair, ClumpResults>  assoc_results;
  vector<string> filename;
  
  // constructer
  clump_LD(Plink*,HaploPhase*,
	   double, double, double, float);
  
  // accessors
  void set_pval( double );
  void set_second_pval( double );
  void set_ld( double );
  void set_r2( double );
  
  // methods
  vector<ResultTrio> read_assoc_file(string);
  void clump();
  string allelePairs(int,int);
};
#endif /*CLUMP_LD_H_*/
 
     |