PedigreePerson.h
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __PEDPERSON_H__
00019 #define __PEDPERSON_H__
00020
00021 #include "Constant.h"
00022 #include "PedigreeAlleles.h"
00023 #include "PedigreeGlobals.h"
00024 #include "StringArray.h"
00025 #include "IntArray.h"
00026
00027 #define SEX_MALE 1
00028 #define SEX_FEMALE 2
00029 #define SEX_UNKNOWN 0
00030
00031 class Person : public PedigreeGlobals
00032 {
00033 public:
00034 String famid;
00035 String pid;
00036 String motid;
00037 String fatid;
00038 int sex;
00039 int zygosity;
00040 int serial, traverse;
00041
00042 Alleles * markers;
00043 double * traits;
00044 char * affections;
00045 double * covariates;
00046
00047 Person * father;
00048 Person * mother;
00049
00050 int sibCount;
00051 Person ** sibs;
00052
00053 int ngeno;
00054
00055 bool filter;
00056
00057 Person();
00058 ~Person();
00059
00060 bool isHalfSib(Person & sib)
00061 {
00062 return hasBothParents &&
00063 ((sib.father == father) ^(sib.mother == mother));
00064 }
00065
00066 bool isSib(Person & sib)
00067 {
00068 return hasBothParents &&
00069 (sib.father == father) && (sib.mother == mother);
00070 }
00071
00072 bool isTwin(Person & twin)
00073 {
00074 return (zygosity != 0) && (zygosity == twin.zygosity) && isSib(twin);
00075 }
00076
00077 bool isMzTwin(Person & mzTwin)
00078 {
00079 return (zygosity & 1) && (zygosity == mzTwin.zygosity) && isSib(mzTwin);
00080 }
00081
00082
00083
00084 bool CheckParents();
00085
00086
00087 void AssessStatus();
00088
00089
00090 bool isFounder()
00091 {
00092 return !hasBothParents;
00093 }
00094 bool isSexed()
00095 {
00096 return sex != 0;
00097 }
00098 bool isGenotyped(int m)
00099 {
00100 return markers[m].isKnown();
00101 }
00102 bool isFullyGenotyped()
00103 {
00104 return ngeno == markerCount;
00105 }
00106 bool isControlled(int c)
00107 {
00108 return covariates[c] != _NAN_;
00109 }
00110 bool isFullyControlled()
00111 {
00112 return hasAllCovariates;
00113 }
00114 bool isPhenotyped(int t)
00115 {
00116 return traits[t] != _NAN_;
00117 }
00118 bool isFullyPhenotyped()
00119 {
00120 return hasAllTraits;
00121 }
00122 bool isDiagnosed(int a)
00123 {
00124 return affections[a] != 0;
00125 }
00126 bool isFullyDiagnosed()
00127 {
00128 return hasAllAffections;
00129 }
00130 bool haveData();
00131 bool isAncestor(Person * descendant);
00132
00133 int GenotypedMarkers();
00134
00135 static void Order(Person * & p1, Person * & p2);
00136
00137 void Copy(Person & rhs);
00138 void CopyIDs(Person & rhs);
00139 void CopyPhenotypes(Person & rhs);
00140 void WipePhenotypes(bool remove_genotypes = true);
00141
00142 private:
00143
00144 bool hasAllCovariates, hasAllTraits,
00145 hasAllAffections, hasBothParents;
00146 };
00147
00148 #endif
00149
00150
00151
00152