Loading...
Searching...
No Matches
MarkerInfo Class Reference
Collaboration diagram for MarkerInfo:
[legend]

## Public Member Functions

| MarkerInfo (String &string)
bool | AdjustFrequencies ()
String | GetAlleleLabel (int allele)
int | GetAlleleNumber (char label) const
int | GetAlleleNumber (const String &label) const
int | NewAllele (char label)
int | NewAllele (const String &label)
void | UpdateSerial ()
void | IndexAlleles ()
int | CountAlleles ()

## Static Public Member Functions

static int | ComparePosition (MarkerInfo **left, MarkerInfo **right)

## Public Attributes

int | chromosome
double | position
double | positionMale
double | positionFemale
Vector | freq
String | name
StringArray | alleleLabels
StringIntHash | alleleNumbers

## Detailed Description

Definition at line 29 of file PedigreeGlobals.h.

## Constructor & Destructor Documentation

## MarkerInfo()

MarkerInfo::MarkerInfo | ( | String & | string | ) |

inline

Definition at line 45 of file PedigreeGlobals.h.

{
serial = count++;
name = string;
chromosome = -1;
position = 0.0;
positionMale = 0.0;
positionFemale = 0.0;
}

## Member Function Documentation

## AdjustFrequencies()

bool MarkerInfo::AdjustFrequencies | ( |  | ) |

Definition at line 80 of file PedigreeGlobals.cpp.

{
if (freq.Length() <= 1)
{
freq.Clear();
return false;
}
if (freq.Min() < 0.0)
error("Locus %s has negative allele frequencies\n", (const char *) name);
double sum = freq.Sum();
if (sum <= 0.0)
error("Locus %s frequencies sum to %f, which doesn't make sense\n",
(const char *) name, sum);
if (sum != 1.0)
freq *= 1.0 / sum;
if (fabs(sum - 1.0) > 1.2e-5)
{
printf("Locus %s frequencies sum to %f, adjusted to 1.0\n",
(const char *) name, sum);
return true;
}
return false;
}

## ComparePosition()

int MarkerInfo::ComparePosition | ( | MarkerInfo ** | left,
|  | MarkerInfo ** | right )

static

Definition at line 56 of file PedigreeGlobals.cpp.

{
if ((*left)->chromosome != (*right)->chromosome)
return (*left)->chromosome - (*right)->chromosome;
double difference = (*left)->position - (*right)->position;
if (difference > 0.0)
return 1;
else if (difference == 0.0)
return (*left)->serial - (*right)->serial;
else
return -1;
}

## CountAlleles()

int MarkerInfo::CountAlleles | ( |  | ) |

inline

Definition at line 89 of file PedigreeGlobals.h.

{
return alleleLabels.Length() ? alleleLabels.Length() - 1 : 0;
}

## GetAlleleLabel()

String MarkerInfo::GetAlleleLabel | ( | int | allele | ) |

Definition at line 71 of file PedigreeGlobals.cpp.

{
if (alleleLabels.Length() > allele && alleleLabels[allele].Length())
return alleleLabels[allele];
else if (alleleLabels.Length() <= allele)
alleleLabels.Dimension(allele + 1);
return alleleLabels[allele] = allele;
}

## GetAlleleNumber() [1/2]

int MarkerInfo::GetAlleleNumber | ( | char | label | ) | const

inline

Definition at line 60 of file PedigreeGlobals.h.

{
String labelString;
labelString = label;
return(GetAlleleNumber(labelString));
}

## GetAlleleNumber() [2/2]

int MarkerInfo::GetAlleleNumber | ( | const String & | label | ) | const

inline

Definition at line 66 of file PedigreeGlobals.h.

{
return label == "0" ? 0 : alleleNumbers.Integer(label);
}

## IndexAlleles()

void MarkerInfo::IndexAlleles | ( |  | ) |

Definition at line 110 of file PedigreeGlobals.cpp.

{
if (alleleLabels.Length() >= 255)
error("Marker %s has more than 254 distinct alleles\n",
(const char *) name);
alleleNumbers.Clear();
for (int i = 1; i < alleleLabels.Length(); i++)
alleleNumbers.SetInteger(alleleLabels[i], i);
}

## NewAllele() [1/2]

int MarkerInfo::NewAllele | ( | char | label | ) |

inline

Definition at line 71 of file PedigreeGlobals.h.

{
String labelString;
labelString = label;
return(NewAllele(labelString));
}

## NewAllele() [2/2]

int MarkerInfo::NewAllele | ( | const String & | label | ) |

Definition at line 122 of file PedigreeGlobals.cpp.

{
if (alleleLabels.Length() == 0)
alleleLabels.Push("");
if (alleleLabels.Length() >= 255)
error("Marker %s has more than 254 distinct alleles\n",
(const char *) name);
alleleNumbers.SetInteger(label, alleleLabels.Length());
alleleLabels.Push(label);
return alleleLabels.Length() - 1;
}

## UpdateSerial()

void MarkerInfo::UpdateSerial | ( |  | ) |

inline

Definition at line 82 of file PedigreeGlobals.h.

{
serial = count++;
}

## Member Data Documentation

## alleleLabels

StringArray MarkerInfo::alleleLabels

Definition at line 42 of file PedigreeGlobals.h.

## alleleNumbers

StringIntHash MarkerInfo::alleleNumbers

Definition at line 43 of file PedigreeGlobals.h.

## chromosome

int MarkerInfo::chromosome

Definition at line 33 of file PedigreeGlobals.h.

## freq

Vector MarkerInfo::freq

Definition at line 40 of file PedigreeGlobals.h.

## name

String MarkerInfo::name

Definition at line 41 of file PedigreeGlobals.h.

## position

double MarkerInfo::position

Definition at line 36 of file PedigreeGlobals.h.

## positionFemale

double MarkerInfo::positionFemale

Definition at line 38 of file PedigreeGlobals.h.

## positionMale

double MarkerInfo::positionMale

Definition at line 37 of file PedigreeGlobals.h.

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

- general/PedigreeGlobals.h
- general/PedigreeGlobals.cpp