1 // $Id: haplotypes.h,v 1.9 2011/03/07 06:08:49 bobgian Exp $
2 
3 /*
4   Copyright 2006  Lucian Smith, Mary Kuhner, Jon Yamato and Joseph Felsenstein
5 
6   This software is distributed free of charge for non-commercial use
7   and is copyrighted.  Of course, we do not guarantee that the software
8   works, and are not responsible for any damage you may cause or have.
9 */
10 
11 // This files defines the class that stores "haplotype" specific
12 // information.
13 
14 #ifndef HAPLOTYPES_H
15 #define HAPLOTYPES_H
16 
17 #include "vectorx.h"
18 #include <set>
19 
20 class LocusCell;
21 
22 class Haplotypes
23 {
24   private:
25     Haplotypes(); //undefined
26     long m_regionnum;
27     string m_locusname;
28     StringVec2d  m_haplotype_alleles; //Phase 1
29     DoubleVec1d  m_penetrances;
30 
31     vector<vector<LocusCell> > m_haplotype_dlcells; //Phase 2
32     long m_current_hapindex;
33 
34     void ConvertAllelesToDLCells();
35     void CollapseHaplotypeDLs();
36     StringVec2d SetToVecs(std::multiset<std::string> stringSet) const;
37 
38   public:
39     Haplotypes(long regnum, string lname);
40     Haplotypes(Haplotypes hap, bool clear);
~Haplotypes()41     ~Haplotypes() {};
42     //We accept the default for:
43     //Haplotype& operator=(const Haplotype& src);
44     //Haplotype(const Haplotype& src);
45 
46     void AddHaplotype(StringVec1d alleles, double penetrance);
47     void AddHaplotype(std::multiset<std::string> alleles, double penetrance);
48     vector<LocusCell> ChooseNewHaplotypes();
49     vector<LocusCell> ChooseRandomHaplotypes();
50     vector<LocusCell> ChooseFirstHaplotypes();
51     vector<LocusCell> ChooseNextHaplotypes();
52     StringVec1d GetAlleles() const; //phase 1
53     string GetMarkerData() const; //phase 3 (output)
54     StringVec1d GetHaplotypesXML(long nspaces) const; //menuinfile XML
55     bool MultipleHaplotypes() const;
56 
57     // Debugging function.
58     void PrintCellsAndAlleles() const;
59 
60 };
61 
62 #endif // HAPLOTYPES_H
63 
64 //____________________________________________________________________________________
65