Alleles Class Reference

## Public Member Functions

char & | operator[] (int i)
bool | isKnown ()
bool | isHeterozygous ()
bool | isHomozygous ()
bool | hasAllele (int a)
bool | isHeterozygousFor (int a)
bool | isHomozygousFor (int a)
int | countAlleles (int a)
int | otherAllele (int a)
int | identicalTo (Alleles &al)
int | countIBS (Alleles &al)
int | operator== (Alleles &rhs)
int | operator!= (Alleles &rhs)
char | Hi ()
char | Lo ()
int | SequenceCoded ()
longint | BinaryCoded ()
void | Intersect (Alleles &geno)
void | Intersect (char allele)
bool | AddAllele (char allele)
void | Wipe ()

## Public Attributes

char | one
char | two

## Detailed Description

Definition at line 23 of file PedigreeAlleles.h.

## Constructor & Destructor Documentation

## Alleles()

Alleles::Alleles | ( |  | ) |

inline

Definition at line 29 of file PedigreeAlleles.h.

{
one = two = 0;
}

## Member Function Documentation

## AddAllele()

bool Alleles::AddAllele | ( | char | allele | ) |

inline

Definition at line 158 of file PedigreeAlleles.h.

{
if (one == allele || two == allele)
return true;
if (one != 0 && two != 0)
return false;
if (one == 0) one = allele;
else two = allele;
return true;
}

## BinaryCoded()

longint Alleles::BinaryCoded | ( |  | ) |

inline

Definition at line 119 of file PedigreeAlleles.h.

{
if (isKnown())
{
longint allele1(1);
longint allele2(1);
allele1 <<= one - 1;
allele2 <<= two - 1;
return allele1 | allele2;
}
else
return NOTZERO;
}

## countAlleles()

int Alleles::countAlleles | ( | int | a | ) |

inline

Definition at line 68 of file PedigreeAlleles.h.

{
return ((one == a) ? 1 : 0) + ((two == a) ? 1 : 0);
}

## countIBS()

int Alleles::countIBS | ( | Alleles & | al | ) |

inline

Definition at line 87 of file PedigreeAlleles.h.

{
return (one == al.one) ?
((two == al.two) ? 2 : 1) :
((one == al.two) ?
((two == al.one) ? 2 : 1) :
(((two == al.one) || (two == al.two)) ? 1 : 0));
}

## hasAllele()

bool Alleles::hasAllele | ( | int | a | ) |

inline

Definition at line 52 of file PedigreeAlleles.h.

{
return (one == a) || (two == a);
}

## Hi()

char Alleles::Hi | ( |  | ) |

inline

Definition at line 105 of file PedigreeAlleles.h.

{
return one > two ? one : two;
}

## identicalTo()

int Alleles::identicalTo | ( | Alleles & | al | ) |

inline

Definition at line 80 of file PedigreeAlleles.h.

{
return ((al.one == one) && (al.two == two)) ||
((al.two == one) && (al.one == two));
}

## Intersect() [1/2]

void Alleles::Intersect | ( | Alleles & | geno | ) |

inline

Definition at line 135 of file PedigreeAlleles.h.

{
char a1 = Lo(), a2 = Hi();
char b1 = geno.Lo(), b2 = geno.Hi();
if (a1 == b1 && a2 == b2)
return;
if (a1 == b1 || a1 == b2)
one = two = a1;
else if (a2 == b1 || a2 == b2)
one = two = a2;
else
one = two = 0;
}

## Intersect() [2/2]

void Alleles::Intersect | ( | char | allele | ) |

inline

Definition at line 150 of file PedigreeAlleles.h.

{
if (one != allele && two != allele)
one = two = 0;
else
one = two = allele;
}

## isHeterozygous()

bool Alleles::isHeterozygous | ( |  | ) |

inline

Definition at line 44 of file PedigreeAlleles.h.

{
return isKnown() && (one != two);
}

## isHeterozygousFor()

bool Alleles::isHeterozygousFor | ( | int | a | ) |

inline

Definition at line 58 of file PedigreeAlleles.h.

{
return isHeterozygous() && hasAllele(a);
}

## isHomozygous()

bool Alleles::isHomozygous | ( |  | ) |

inline

Definition at line 48 of file PedigreeAlleles.h.

{
return isKnown() && (one == two);
}

## isHomozygousFor()

bool Alleles::isHomozygousFor | ( | int | a | ) |

inline

Definition at line 62 of file PedigreeAlleles.h.

{
return !(isHeterozygousFor(a));
}

## isKnown()

bool Alleles::isKnown | ( |  | ) |

inline

Definition at line 40 of file PedigreeAlleles.h.

{
return (one * two) != 0;
}

## Lo()

char Alleles::Lo | ( |  | ) |

inline

Definition at line 109 of file PedigreeAlleles.h.

{
return one > two ? two : one;
}

## operator!=()

int Alleles::operator!= | ( | Alleles & | rhs | ) |

inline

Definition at line 100 of file PedigreeAlleles.h.

{
return !identicalTo(rhs);
}

## operator==()

int Alleles::operator== | ( | Alleles & | rhs | ) |

inline

Definition at line 96 of file PedigreeAlleles.h.

{
return identicalTo(rhs);
}

## operator[]()

char & Alleles::operator[] | ( | int | i | ) |

inline

Definition at line 34 of file PedigreeAlleles.h.

{
return (i == 1) ? one : two;
}

## otherAllele()

int Alleles::otherAllele | ( | int | a | ) |

inline

Definition at line 74 of file PedigreeAlleles.h.

{
return ((one == a) ? two : one);
}

## SequenceCoded()

int Alleles::SequenceCoded | ( |  | ) |

inline

Definition at line 114 of file PedigreeAlleles.h.

{
return isKnown() ? Hi() *(Hi() - 1) / 2 + Lo() : 0;
}

## Wipe()

void Alleles::Wipe | ( |  | ) |

inline

Definition at line 171 of file PedigreeAlleles.h.

{
one = two = 0;
}

## Member Data Documentation

## one

char Alleles::one

Definition at line 26 of file PedigreeAlleles.h.

## two

char Alleles::two

Definition at line 27 of file PedigreeAlleles.h.

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

- general/PedigreeAlleles.h