libStatGen Software 1
Loading...
Searching...
No Matches
Person Class Reference
Inheritance diagram for Person:
Collaboration diagram for Person:

Public Member Functions

bool isHalfSib (Person &sib)
 
bool isSib (Person &sib)
 
bool isTwin (Person &twin)
 
bool isMzTwin (Person &mzTwin)
 
bool CheckParents ()
 
void AssessStatus ()
 
bool isFounder ()
 
bool isSexed ()
 
bool isGenotyped (int m)
 
bool isFullyGenotyped ()
 
bool isControlled (int c)
 
bool isFullyControlled ()
 
bool isPhenotyped (int t)
 
bool isFullyPhenotyped ()
 
bool isDiagnosed (int a)
 
bool isFullyDiagnosed ()
 
bool haveData ()
 
bool isAncestor (Person *descendant)
 
int GenotypedMarkers ()
 
void Copy (Person &rhs)
 
void CopyIDs (Person &rhs)
 
void CopyPhenotypes (Person &rhs)
 
void WipePhenotypes (bool remove_genotypes=true)
 

Static Public Member Functions

static void Order (Person *&p1, Person *&p2)
 
- Static Public Member Functions inherited from PedigreeGlobals
static int GetTraitID (const char *name)
 
static int GetMarkerID (const char *name)
 
static int GetCovariateID (const char *name)
 
static int GetAffectionID (const char *name)
 
static int GetStringID (const char *name)
 
static int LookupTrait (const char *name)
 
static int LookupMarker (const char *name)
 
static int LookupCovariate (const char *name)
 
static int LookupAffection (const char *name)
 
static int LookupString (const char *name)
 
static void GrowMarkerInfo ()
 
static MarkerInfoGetMarkerInfo (String &name)
 
static MarkerInfoGetMarkerInfo (int marker)
 
static int SortMarkersInMapOrder (IntArray &markers, int chromosome=-1)
 
static void GetOrderedMarkers (IntArray &markers)
 
static void FlagMissingMarkers (IntArray &missingMarkers)
 
static bool MarkerPositionsAvailable ()
 
static bool AlleleFrequenciesAvailable ()
 
static void VerifySexSpecificOrder ()
 
static void LoadAlleleFrequencies (const char *filename, bool required=false)
 
static void LoadAlleleFrequencies (IFILE &file)
 
static void LoadMarkerMap (const char *filename, bool filter=false)
 
static void LoadMarkerMap (IFILE &file, bool filter=false)
 
static void LoadBasepairMap (const char *filename)
 
static void LoadBasepairMap (IFILE &file)
 
static void WriteMapFile (const char *filename)
 
static void WriteMapFile (FILE *file)
 
static void WriteFreqFile (const char *filename, bool old_format=false)
 
static void WriteFreqFile (FILE *file, bool old_format=false)
 
static int LoadAllele (int marker, String &label)
 
static int LoadAllele (MarkerInfo *info, String &label)
 

Public Attributes

String famid
 
String pid
 
String motid
 
String fatid
 
int sex
 
int zygosity
 
int serial
 
int traverse
 
Allelesmarkers
 
double * traits
 
char * affections
 
double * covariates
 
Stringstrings
 
Personfather
 
Personmother
 
int sibCount
 
Person ** sibs
 
int ngeno
 
bool filter
 

Additional Inherited Members

- Static Public Attributes inherited from PedigreeGlobals
static int traitCount = 0
 
static int markerCount = 0
 
static int affectionCount = 0
 
static int covariateCount = 0
 
static int stringCount = 0
 
static bool chromosomeX = false
 
static bool sexSpecificMap = false
 
static StringArray traitNames
 
static StringArray covariateNames
 
static StringArray affectionNames
 
static StringArray markerNames
 
static StringArray stringNames
 
static StringIntHash markerLookup
 
static StringIntHash traitLookup
 
static StringIntHash affectionLookup
 
static StringIntHash covariateLookup
 
static StringIntHash stringLookup
 
static int markerInfoCount = 0
 
static int markerInfoSize = 0
 
static MarkerInfo ** markerInfo = NULL
 
static StringHash markerInfoByName
 
static MarkerInfo ** markerInfoByInteger = NULL
 

Detailed Description

Definition at line 31 of file PedigreePerson.h.

Constructor & Destructor Documentation

◆ Person()

Person::Person ( )

Definition at line 28 of file PedigreePerson.cpp.

29{
30 zygosity = sex = 0;
31 serial = traverse = -1;
32
33 markers = new Alleles [markerCount];
34 traits = new double [traitCount];
35 covariates = new double [covariateCount];
36 affections = new char [affectionCount];
37 strings = new String [stringCount];
38
39 for (int i = 0; i < traitCount; i++) traits[i] = _NAN_;
40 for (int i = 0; i < covariateCount; i++) covariates[i] = _NAN_;
41 for (int i = 0; i < affectionCount; i++) affections[i] = 0;
42
43 filter = false;
44
45 father = mother = NULL;
46 sibs = NULL;
47 sibCount = 0;
48
49 ngeno = 0;
50 hasBothParents = hasAllTraits = hasAllAffections = hasAllCovariates = false;
51}

◆ ~Person()

Person::~Person ( )

Definition at line 53 of file PedigreePerson.cpp.

54{
55 delete [] markers;
56 delete [] traits;
57 delete [] affections;
58 delete [] covariates;
59 delete [] strings;
60
61 if (sibCount) delete [] sibs;
62}

Member Function Documentation

◆ AssessStatus()

void Person::AssessStatus ( )

Definition at line 147 of file PedigreePerson.cpp.

148{
149 hasBothParents = father != NULL && mother != NULL;
150
151 hasAllTraits = hasAllAffections = hasAllCovariates = true;
152
153 ngeno = 0;
154 for (int m = 0; m < markerCount; m++)
155 if (isGenotyped(m))
156 ngeno++;
157
158 for (int t = 0; t < traitCount; t++)
159 if (!isPhenotyped(t))
160 {
161 hasAllTraits = false;
162 break;
163 }
164
165 for (int c = 0; c < covariateCount; c++)
166 if (!isControlled(c))
167 {
168 hasAllCovariates = false;
169 break;
170 }
171
172 for (int a = 0; a < affectionCount; a++)
173 if (!isDiagnosed(a))
174 {
175 hasAllAffections = false;
176 break;
177 }
178}

◆ CheckParents()

bool Person::CheckParents ( )

Definition at line 107 of file PedigreePerson.cpp.

108{
109 hasBothParents = father != NULL && mother != NULL;
110
111 if (!hasBothParents)
112 {
113 if (father != NULL || mother != NULL)
114 {
115 printf("Parent named %s for Person %s in Family %s is missing\n",
116 (father == NULL) ? (const char *) fatid : (const char *) motid,
117 (const char *) pid, (const char *) famid);
118 return false;
119 }
120 else
121 return true;
122 }
123
124 if (father->sex == SEX_FEMALE || mother->sex == SEX_MALE)
125 // If parents are switched around, we can fix it...
126 {
127 Person * swap = father;
128 father = mother;
129 mother = swap;
130
131 String temp = fatid;
132 fatid = motid;
133 motid = temp;
134 }
135
136 if (father->sex == SEX_FEMALE || mother->sex == SEX_MALE)
137 // If things still don't make sense then the problem is more serious ...
138 {
139 printf("Parental sex codes don't make sense for Person %s in Family %s\n",
140 (const char *) pid, (const char *) famid);
141 return false;
142 }
143
144 return true;
145}

◆ Copy()

void Person::Copy ( Person rhs)

Definition at line 64 of file PedigreePerson.cpp.

65{
66 CopyIDs(rhs);
67 CopyPhenotypes(rhs);
68}

◆ CopyIDs()

void Person::CopyIDs ( Person rhs)

Definition at line 97 of file PedigreePerson.cpp.

98{
99 famid = rhs.famid;
100 pid = rhs.pid;
101 fatid = rhs.fatid;
102 motid = rhs.motid;
103 sex = rhs.sex;
104 zygosity = rhs.zygosity;
105}

◆ CopyPhenotypes()

void Person::CopyPhenotypes ( Person rhs)

Definition at line 70 of file PedigreePerson.cpp.

71{
72 for (int i = 0; i < Person::traitCount; i++)
73 traits[i] = rhs.traits[i];
74 for (int i = 0; i < Person::affectionCount; i++)
75 affections[i] = rhs.affections[i];
76 for (int i = 0; i < Person::covariateCount; i++)
77 covariates[i] = rhs.covariates[i];
78 for (int i = 0; i < Person::markerCount; i++)
79 markers[i] = rhs.markers[i];
80 ngeno = rhs.ngeno;
81}

◆ GenotypedMarkers()

int Person::GenotypedMarkers ( )

Definition at line 190 of file PedigreePerson.cpp.

191{
192 int count = 0;
193
194 for (int m = 0; m < Person::markerCount; m++)
195 if (markers[m].isKnown())
196 count++;
197
198 return count;
199}

◆ haveData()

bool Person::haveData ( )

Definition at line 201 of file PedigreePerson.cpp.

202{
203 if (ngeno)
204 return true;
205
206 for (int i = 0; i < affectionCount; i++)
207 if (affections[i] != 0)
208 return true;
209
210 for (int i = 0; i < traitCount; i++)
211 if (traits[i] != _NAN_)
212 return true;
213
214 return false;
215}

◆ isAncestor()

bool Person::isAncestor ( Person descendant)

Definition at line 217 of file PedigreePerson.cpp.

218{
219 if (traverse > descendant->traverse)
220 return false;
221
222 if (serial == descendant->serial)
223 return true;
224
225 if (descendant->isFounder())
226 return false;
227
228 return (isAncestor(descendant->mother) ||
229 isAncestor(descendant->father));
230}

◆ isControlled()

bool Person::isControlled ( int  c)
inline

Definition at line 107 of file PedigreePerson.h.

108 {
109 return covariates[c] != _NAN_;
110 }

◆ isDiagnosed()

bool Person::isDiagnosed ( int  a)
inline

Definition at line 123 of file PedigreePerson.h.

124 {
125 return affections[a] != 0;
126 }

◆ isFounder()

bool Person::isFounder ( )
inline

Definition at line 91 of file PedigreePerson.h.

92 {
93 return !hasBothParents;
94 }

◆ isFullyControlled()

bool Person::isFullyControlled ( )
inline

Definition at line 111 of file PedigreePerson.h.

112 {
113 return hasAllCovariates;
114 }

◆ isFullyDiagnosed()

bool Person::isFullyDiagnosed ( )
inline

Definition at line 127 of file PedigreePerson.h.

128 {
129 return hasAllAffections;
130 }

◆ isFullyGenotyped()

bool Person::isFullyGenotyped ( )
inline

Definition at line 103 of file PedigreePerson.h.

104 {
105 return ngeno == markerCount;
106 }

◆ isFullyPhenotyped()

bool Person::isFullyPhenotyped ( )
inline

Definition at line 119 of file PedigreePerson.h.

120 {
121 return hasAllTraits;
122 }

◆ isGenotyped()

bool Person::isGenotyped ( int  m)
inline

Definition at line 99 of file PedigreePerson.h.

100 {
101 return markers[m].isKnown();
102 }

◆ isHalfSib()

bool Person::isHalfSib ( Person sib)
inline

Definition at line 61 of file PedigreePerson.h.

62 {
63 return hasBothParents &&
64 ((sib.father == father) ^(sib.mother == mother));
65 }

◆ isMzTwin()

bool Person::isMzTwin ( Person mzTwin)
inline

Definition at line 78 of file PedigreePerson.h.

79 {
80 return (zygosity & 1) && (zygosity == mzTwin.zygosity) && isSib(mzTwin);
81 }

◆ isPhenotyped()

bool Person::isPhenotyped ( int  t)
inline

Definition at line 115 of file PedigreePerson.h.

116 {
117 return traits[t] != _NAN_;
118 }

◆ isSexed()

bool Person::isSexed ( )
inline

Definition at line 95 of file PedigreePerson.h.

96 {
97 return sex != 0;
98 }

◆ isSib()

bool Person::isSib ( Person sib)
inline

Definition at line 67 of file PedigreePerson.h.

68 {
69 return hasBothParents &&
70 (sib.father == father) && (sib.mother == mother);
71 }

◆ isTwin()

bool Person::isTwin ( Person twin)
inline

Definition at line 73 of file PedigreePerson.h.

74 {
75 return (zygosity != 0) && (zygosity == twin.zygosity) && isSib(twin);
76 }

◆ Order()

void Person::Order ( Person *&  p1,
Person *&  p2 
)
static

Definition at line 180 of file PedigreePerson.cpp.

181{
182 if (p1->traverse > p2->traverse)
183 {
184 Person * temp = p1;
185 p1 = p2;
186 p2 = temp;
187 }
188}

◆ WipePhenotypes()

void Person::WipePhenotypes ( bool  remove_genotypes = true)

Definition at line 83 of file PedigreePerson.cpp.

84{
85 for (int i = 0; i < traitCount; i++) traits[i] = _NAN_;
86 for (int i = 0; i < covariateCount; i++) covariates[i] = _NAN_;
87 for (int i = 0; i < affectionCount; i++) affections[i] = 0;
88
89 if (remove_genotypes)
90 {
91 for (int i = 0; i < markerCount; i++)
92 markers[i][0] = markers[i][1] = 0;
93 ngeno = 0;
94 }
95}

Member Data Documentation

◆ affections

char* Person::affections

Definition at line 44 of file PedigreePerson.h.

◆ covariates

double* Person::covariates

Definition at line 45 of file PedigreePerson.h.

◆ famid

String Person::famid

Definition at line 34 of file PedigreePerson.h.

◆ father

Person* Person::father

Definition at line 48 of file PedigreePerson.h.

◆ fatid

String Person::fatid

Definition at line 37 of file PedigreePerson.h.

◆ filter

bool Person::filter

Definition at line 56 of file PedigreePerson.h.

◆ markers

Alleles* Person::markers

Definition at line 42 of file PedigreePerson.h.

◆ mother

Person* Person::mother

Definition at line 49 of file PedigreePerson.h.

◆ motid

String Person::motid

Definition at line 36 of file PedigreePerson.h.

◆ ngeno

int Person::ngeno

Definition at line 54 of file PedigreePerson.h.

◆ pid

String Person::pid

Definition at line 35 of file PedigreePerson.h.

◆ serial

int Person::serial

Definition at line 40 of file PedigreePerson.h.

◆ sex

int Person::sex

Definition at line 38 of file PedigreePerson.h.

◆ sibCount

int Person::sibCount

Definition at line 51 of file PedigreePerson.h.

◆ sibs

Person** Person::sibs

Definition at line 52 of file PedigreePerson.h.

◆ strings

String* Person::strings

Definition at line 46 of file PedigreePerson.h.

◆ traits

double* Person::traits

Definition at line 43 of file PedigreePerson.h.

◆ traverse

int Person::traverse

Definition at line 40 of file PedigreePerson.h.

◆ zygosity

int Person::zygosity

Definition at line 39 of file PedigreePerson.h.


The documentation for this class was generated from the following files: