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

## Static Public Member Functions

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 MarkerInfo * | GetMarkerInfo (String &name)
static MarkerInfo * | GetMarkerInfo (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)

## Static Public Attributes

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 107 of file PedigreeGlobals.h.

## Constructor & Destructor Documentation

## PedigreeGlobals()

PedigreeGlobals::PedigreeGlobals | ( |  | ) |

inline

Definition at line 204 of file PedigreeGlobals.h.

{
instanceCount++;
}

## ~PedigreeGlobals()

PedigreeGlobals::~PedigreeGlobals | ( |  | ) |

Definition at line 711 of file PedigreeGlobals.cpp.

{
if (--instanceCount == 0 && markerInfoSize)
{
for (int i = 0; i < markerInfoCount; i++)
delete markerInfo[i];
delete [] markerInfo;
delete [] markerInfoByInteger;
}
}

## Member Function Documentation

## AlleleFrequenciesAvailable()

bool PedigreeGlobals::AlleleFrequenciesAvailable | ( |  | ) |

static

Definition at line 806 of file PedigreeGlobals.cpp.

{
for (int i = 0; i < markerInfoCount; i++)
if (markerInfo[i]->freq.Length() > 1)
return true;
return false;
}

## FlagMissingMarkers()

void PedigreeGlobals::FlagMissingMarkers | ( | IntArray & | missingMarkers | ) |

static

Definition at line 263 of file PedigreeGlobals.cpp.

{
int skipped_markers = 0;
if (missingMarkers.Length())
{
StringArray names;
printf("These markers couldn't be placed and won't be analysed:");
for (int i = 0; i < missingMarkers.Length(); i++)
names.Push(GetMarkerInfo(missingMarkers[i])->name);
names.Sort();
for (int i = 0, line = 80, lines = 0; i < missingMarkers.Length(); i++)
{
if (line + names[i].Length() + 1 > 79)
printf("\n "), line = 3, lines++;
if (lines < 5)
{
printf("%s ", (const char *) names[i]);
line += names[i].Length() + 1;
}
else
skipped_markers++;
}
if (skipped_markers)
printf("as well as %d other unlisted markers...", skipped_markers);
printf("\n\n");
}
}
StringArray
Definition StringArray.h:24

## GetAffectionID()

int PedigreeGlobals::GetAffectionID | ( | const char * | name | ) |

static

Definition at line 148 of file PedigreeGlobals.cpp.

{
int idx = affectionLookup.Integer(name);
if (idx != -1) return idx;
affectionNames.Add(name);
affectionLookup.SetInteger(name, affectionCount);
return affectionCount++;
}

## GetCovariateID()

int PedigreeGlobals::GetCovariateID | ( | const char * | name | ) |

static

Definition at line 159 of file PedigreeGlobals.cpp.

{
int idx = covariateLookup.Integer(name);
if (idx != -1) return idx;
covariateNames.Add(name);
covariateLookup.SetInteger(name, covariateCount);
return covariateCount++;
}

## GetMarkerID()

int PedigreeGlobals::GetMarkerID | ( | const char * | name | ) |

static

Definition at line 181 of file PedigreeGlobals.cpp.

{
int idx = markerLookup.Integer(name);
if (idx != -1) return idx;
markerNames.Add(name);
markerLookup.SetInteger(name, markerCount);
// Grow the marker info key ...
if (markerCount == 0)
{
markerInfoByInteger = new MarkerInfo * [16];
for (int i = 0; i < 16; i++)
markerInfoByInteger[i] = NULL;
}
else if ((markerCount & (markerCount - 1)) == 0 && markerCount > 15)
{
MarkerInfo ** newKey = new MarkerInfo * [markerCount * 2];
for (int i = 0; i < markerCount; i++)
newKey[i] = markerInfoByInteger[i];
for (int i = markerCount; i < markerCount * 2; i++)
newKey[i] = NULL;
delete [] markerInfoByInteger;
markerInfoByInteger = newKey;
}
return markerCount++;
}
MarkerInfo
Definition PedigreeGlobals.h:30

## GetMarkerInfo() [1/2]

MarkerInfo * PedigreeGlobals::GetMarkerInfo | ( | int | marker | ) |

static

Definition at line 236 of file PedigreeGlobals.cpp.

{
if (markerId >= markerCount)
error("Attempted to retrieve MarkerInfo using out-of-bounds index\n");
if (markerInfoByInteger[markerId] != NULL)
return markerInfoByInteger[markerId];
else
return GetMarkerInfo(markerNames[markerId]);
}

## GetMarkerInfo() [2/2]

MarkerInfo * PedigreeGlobals::GetMarkerInfo | ( | String & | name | ) |

static

Definition at line 216 of file PedigreeGlobals.cpp.

{
MarkerInfo * info = (MarkerInfo *) markerInfoByName.Object(name);
if (info != NULL) return info;
info = new MarkerInfo(name);
markerInfoByName.Add(name, info);
if (markerInfoCount >= markerInfoSize)
GrowMarkerInfo();
markerInfo[markerInfoCount++] = info;
int markerId = LookupMarker(name);
if (markerId >= 0) markerInfoByInteger[markerId] = info;
return info;
}

## GetOrderedMarkers()

void PedigreeGlobals::GetOrderedMarkers | ( | IntArray & | markers | ) |

static

Definition at line 298 of file PedigreeGlobals.cpp.

{
if (markers.Length() == 0)
{
markers.Dimension(markerCount);
markers.SetSequence(0, 1);
}
MarkerInfo ** subset = new MarkerInfo * [markers.Length()];
int count = 0;
IntArray missingMarkers;
for (int i = 0; i < markers.Length(); i++)
{
MarkerInfo * info = GetMarkerInfo(markers[i]);
if (info->chromosome != -1)
subset[count++] = info;
else
missingMarkers.Push(i);
}
FlagMissingMarkers(missingMarkers);
QuickSort(subset, count, sizeof(MarkerInfo *),
COMPAREFUNC MarkerInfo::ComparePosition);
markers.Clear();
for (int i = 0; i < count; i++)
markers.Push(GetMarkerID(subset[i]->name));
}
IntArray
Definition IntArray.h:24

## GetStringID()

int PedigreeGlobals::GetStringID | ( | const char * | name | ) |

static

Definition at line 170 of file PedigreeGlobals.cpp.

{
int idx = stringLookup.Integer(name);
if (idx != -1) return idx;
stringNames.Add(name);
stringLookup.SetInteger(name, stringCount);
return stringCount++;
}

## GetTraitID()

int PedigreeGlobals::GetTraitID | ( | const char * | name | ) |

static

Definition at line 137 of file PedigreeGlobals.cpp.

{
int idx = traitLookup.Integer(name);
if (idx != -1) return idx;
traitNames.Add(name);
traitLookup.SetInteger(name, traitCount);
return traitCount++;
}

## GrowMarkerInfo()

void PedigreeGlobals::GrowMarkerInfo | ( |  | ) |

static

Definition at line 247 of file PedigreeGlobals.cpp.

{
int newSize = markerInfoSize ? 2 * markerInfoSize : 32;
MarkerInfo ** newArray = new MarkerInfo * [newSize];
if (markerInfoSize)
{
memcpy(newArray, markerInfo, sizeof(MarkerInfo *) * markerInfoSize);
delete [] markerInfo;
}
markerInfo = newArray;
markerInfoSize = newSize;
}

## LoadAllele() [1/2]

int PedigreeGlobals::LoadAllele | ( | int | marker,
|  | String & | label
| ) |  |

static

Definition at line 815 of file PedigreeGlobals.cpp.

{
return LoadAllele(GetMarkerInfo(marker), token);
}

## LoadAllele() [2/2]

int PedigreeGlobals::LoadAllele | ( | MarkerInfo * | info,
|  | String & | label
| ) |  |

static

Definition at line 820 of file PedigreeGlobals.cpp.

{
int allele = info->GetAlleleNumber(token);
if (allele >= 0) return allele;
static unsigned char lookup[128];
static bool init = false;
if (!init)
{
init = true;
for (int i = 0; i < 128; i++)
lookup[i] = 0;
for (int i = '1'; i <= '9'; i++)
lookup[i] = 1;
lookup[int('a')] = lookup[int('A')] = lookup[int('c')] = lookup[int('C')] = 2;
lookup[int('g')] = lookup[int('G')] = lookup[int('t')] = lookup[int('T')] = 2;
}
int first = token[0];
bool goodstart = first > 0 && first < 128;
if (token.Length() == 1 && goodstart && lookup[int(token[0])])
return info->NewAllele(token);
if (!goodstart || lookup[int(token[0])] != 1)
return 0;
int integer = token.AsInteger();
token = integer;
allele = info->GetAlleleNumber(token);
if (allele > 0)
return allele;
if (integer <= 0) return 0;
if (integer > 1000000)
{
static bool warn_user = true;
if (warn_user)
{
printf("Some allele numbers for marker %s are > 1000000\n"
"All allele numbers >1000000 will be treated as missing\n\n",
(const char *) info->name);
warn_user = false;
}
return 0;
}
return info->NewAllele(token);
}

## LoadAlleleFrequencies() [1/2]

void PedigreeGlobals::LoadAlleleFrequencies | ( | const char * | filename,
|  | bool | required = `false`
| ) |  |

static

Definition at line 433 of file PedigreeGlobals.cpp.

{
// This function is often called with an empty string, and not
// all implementations of the C library like that ...
if (filename[0] == 0)
{
if (required)
error("No name provided for required allele freuquency file\n");
else
return;
}
// If we get here, the filename is not empty and things should
// work as planned
IFILE f = ifopen(filename, "rb");
if (f == NULL)
{
if (required)
error("Failed to open required allele frequency file '%s'",
(const char *) filename);
else
return;
}
LoadAlleleFrequencies(f);
ifclose(f);
}
ifopen
IFILE ifopen(const char *filename, const char *mode, InputFile::ifileCompression compressionMode=InputFile::DEFAULT)
Open a file with the specified name and mode, using a filename of "-" to indicate stdin/stdout.
Definition InputFile.h:562
ifclose
int ifclose(IFILE &file)
Close the file.
Definition InputFile.h:580
InputFile
Class for easily reading/writing files without having to worry about file type (uncompressed,...
Definition InputFile.h:37

## LoadAlleleFrequencies() [2/2]

void PedigreeGlobals::LoadAlleleFrequencies | ( | IFILE & | file | ) |

static

Definition at line 462 of file PedigreeGlobals.cpp.

{
int done = 0;
String buffer;
StringArray tokens;
MarkerInfo *info = NULL;
bool need_blank_line = false;
int allele_size, old_max, next_allele = 0; // Initialization avoids compiler warning
while (!ifeof(input) && !done)
{
int i, j;
buffer.ReadLine(input);
tokens.Clear();
tokens.AddTokens(buffer, WHITESPACE);
if (tokens.Length() < 1) continue;
switch (toupper(tokens[0][0]))
{
case 'M' :
if (tokens.Length() == 1)
error("Unnamed marker in allele frequency file");
if (info != NULL)
need_blank_line |= info->AdjustFrequencies();
info = GetMarkerInfo(tokens[1]);
info->freq.Clear();
info->freq.Push(0.0);
next_allele = 1;
break;
case 'F' :
if (info != NULL)
for (i = 1; i < tokens.Length(); i++)
{
buffer = next_allele++;
int allele = LoadAllele(info, buffer);
if (allele >= info->freq.Length())
{
old_max = info->freq.Length();
info->freq.Dimension(allele + 1);
for (j = old_max; j < allele; j++)
info->freq[j] = 0.0;
}
info->freq[allele] = tokens[i].AsDouble();
}
break;
case 'A' :
if (info == NULL) continue;
if (tokens.Length() != 3)
error("Error reading named allele frequencies for locus %s\n"
"Lines with named alleles should have the format\n"
" A allele_label allele_frequency\n\n"
"But the following line was read:\n%s\n",
(const char *) info->name, (const char *) buffer);
allele_size = LoadAllele(info, tokens[1]);
next_allele = atoi(tokens[1]) + 1;
if (allele_size < 1)
error("Error reading named allele frequencies for locus %s\n"
"An invalid allele label was encountered\n",
(const char *) info->name);
if (allele_size >= info->freq.Length())
{
old_max = info->freq.Length();
info->freq.Dimension(allele_size + 1);
for (i = old_max; i < allele_size; i++)
info->freq[i] = 0.0;
}
info->freq[allele_size] = tokens[2];
break;
case 'E' :
done = 1;
break;
default :
error("Problem in allele frequency file.\n"
"Lines in this file should be of two types:\n"
" -- Marker name lines begin with an M\n"
" -- Frequency lines begin with an F\n\n"
"However the following line is different:\n%s\n",
(const char *) buffer);
}
}
if (info != NULL)
need_blank_line |= info->AdjustFrequencies();
if (need_blank_line) printf("\n");
}
ifeof
int ifeof(IFILE file)
Check to see if we have reached the EOF (returns 0 if not EOF).
Definition InputFile.h:654
String
Definition StringBasics.h:39

## LoadBasepairMap() [1/2]

void PedigreeGlobals::LoadBasepairMap | ( | const char * | filename | ) |

static

Definition at line 656 of file PedigreeGlobals.cpp.

{
IFILE f = ifopen(filename, "rb");
if (f == NULL)
error("The map file [%s] could not be opened\n\n"
"Please check that the filename is correct and that the file is\n"
"not being used by another program", filename);
LoadBasepairMap(f);
ifclose(f);
}

## LoadBasepairMap() [2/2]

void PedigreeGlobals::LoadBasepairMap | ( | IFILE & | file | ) |

static

Definition at line 667 of file PedigreeGlobals.cpp.

{
String buffer;
StringArray tokens;
sexSpecificMap = false;
while (!ifeof(input))
{
buffer.ReadLine(input);
tokens.Clear();
tokens.AddTokens(buffer, WHITESPACE);
if (tokens.Length() < 1) continue;
if (tokens.Length() != 3)
error("Error reading map file\n"
"Each line in this file should include 3 fields:\n"
"CHROMOSOME, MARKER_NAME, and POSITION\n"
"However the following line has %d fields\n%s\n",
tokens.Length(), (const char *) buffer);
bool previous_state = String::caseSensitive;
String::caseSensitive = false;
if ((tokens[0] == "CHR" || tokens[0] == "CHROMOSOME") &&
(tokens[1] == "MARKER" || tokens[1] == "MARKER_NAME" || tokens[1] == "MRK") &&
(tokens[2] == "BASEPAIR" || tokens[2] == "POS" || tokens[2] == "POSITION"))
continue;
String::caseSensitive = previous_state;
MarkerInfo * info = GetMarkerInfo(tokens[1]);
int chr = (tokens[0][0] == 'x' || tokens[0][0] == 'X') ? 999 : (int) tokens[0];
info->chromosome = chr;
info->position = (double) tokens[2];
}
}

## LoadMarkerMap() [1/2]

void PedigreeGlobals::LoadMarkerMap | ( | const char * | filename,
|  | bool | filter = `false`
| ) |  |

static

Definition at line 561 of file PedigreeGlobals.cpp.

{
IFILE f = ifopen(filename, "rb");
if (f == NULL) return;
LoadMarkerMap(f, filter);
ifclose(f);
}

## LoadMarkerMap() [2/2]

void PedigreeGlobals::LoadMarkerMap | ( | IFILE & | file,
|  | bool | filter = `false`
| ) |  |

static

Definition at line 569 of file PedigreeGlobals.cpp.

{
String buffer;
StringArray tokens;
bool first_pass = true;
while (!ifeof(input))
{
buffer.ReadLine(input);
tokens.Clear();
tokens.AddTokens(buffer, WHITESPACE);
if (tokens.Length() < 1) continue;
if (first_pass)
{
sexSpecificMap = (tokens.Length() == 5);
// if (sexSpecificMap)
// printf("\n Found sex-specific map ...\n\n");
first_pass = false;
}
if (tokens.Length() != 3 && !sexSpecificMap)
error("Error reading map file\n"
"Each line in this file should include 3 fields:\n"
"CHROMOSOME, MARKER_NAME, and POSITION\n"
"However the following line has %d fields\n%s\n",
tokens.Length(), (const char *) buffer);
if (tokens.Length() != 5 && sexSpecificMap)
error("Error reading map file\n"
"Each line in this file should include 5 fields:\n\n"
"CHROMOSOME, MARKER_NAME, SEX_AVERAGED_POS, FEMALE_POS AND MALE_POS\n\n"
"However the following line has %d fields\n%s\n",
tokens.Length(), (const char *) buffer);
bool previous_state = String::caseSensitive;
String::caseSensitive = false;
if ((tokens[0] == "CHR" || tokens[0] == "CHROMOSOME") &&
(tokens[1] == "MARKER" || tokens[1] == "MARKER_NAME" || tokens[1] == "MRK") &&
(tokens[2] == "KOSAMBI" || tokens[2] == "POS" || tokens[2] == "POSITION" ||
tokens[2] == "SEX_AVERAGED_POS" || tokens[2] == "CM" || tokens[2] == "HALDANE"))
continue;
String::caseSensitive = previous_state;
if (filter)
if (LookupMarker(tokens[1]) < 0)
continue;
MarkerInfo * info = GetMarkerInfo(tokens[1]);
int chr = (tokens[0][0] == 'x' || tokens[0][0] == 'X') ? 999 : (int) tokens[0];
info->chromosome = chr;
info->position = (double) tokens[2] * 0.01;
if (sexSpecificMap)
{
char * flag;
double female = strtod(tokens[3], &flag);
if (*flag)
error("In the map file, the female cM position for marker\n"
"%s is %s. This is not a valid number.",
(const char *) tokens[1], (const char *) tokens[3]);
double male = strtod(tokens[4], &flag);
if (*flag)
error("In the map file, the male cM position for marker\n"
"%s is %s. This is not a valid number.",
(const char *) tokens[1], (const char *) tokens[4]);
info->positionFemale = (double) female * 0.01;
info->positionMale = (double) male * 0.01;
}
else
info->positionFemale = info->positionMale = info->position;
}
if (sexSpecificMap) VerifySexSpecificOrder();
}

## LookupAffection()

static int PedigreeGlobals::LookupAffection | ( | const char * | name | ) |

inline static

Definition at line 158 of file PedigreeGlobals.h.

{
return affectionLookup.Integer(name);
}

## LookupCovariate()

static int PedigreeGlobals::LookupCovariate | ( | const char * | name | ) |

inline static

Definition at line 154 of file PedigreeGlobals.h.

{
return covariateLookup.Integer(name);
}

## LookupMarker()

static int PedigreeGlobals::LookupMarker | ( | const char * | name | ) |

inline static

Definition at line 150 of file PedigreeGlobals.h.

{
return markerLookup.Integer(name);
}

## LookupString()

static int PedigreeGlobals::LookupString | ( | const char * | name | ) |

inline static

Definition at line 162 of file PedigreeGlobals.h.

{
return stringLookup.Integer(name);
}

## LookupTrait()

static int PedigreeGlobals::LookupTrait | ( | const char * | name | ) |

inline static

Definition at line 146 of file PedigreeGlobals.h.

{
return traitLookup.Integer(name);
}

## MarkerPositionsAvailable()

bool PedigreeGlobals::MarkerPositionsAvailable | ( |  | ) |

static

Definition at line 797 of file PedigreeGlobals.cpp.

{
for (int i = 0; i < markerInfoCount; i++)
if (markerInfo[i]->chromosome != -1)
return true;
return false;
}

## SortMarkersInMapOrder()

int PedigreeGlobals::SortMarkersInMapOrder | ( | IntArray & | markers,
|  | int | chromosome = `-1`
| ) |  |

static

Definition at line 331 of file PedigreeGlobals.cpp.

{
if (markers.Length() == 0)
{
markers.Dimension(markerCount);
markers.SetSequence(0, 1);
}
MarkerInfo ** subset = new MarkerInfo * [markers.Length()];
int count = 0;
IntArray missingMarkers;
for (int i = 0; i < markers.Length(); i++)
{
MarkerInfo * info = GetMarkerInfo(markers[i]);
if (info->chromosome != -1)
subset[count++] = info;
else if (chromosome == -1)
missingMarkers.Push(i);
}
if (chromosome == -1)
FlagMissingMarkers(missingMarkers);
QuickSort(subset, count, sizeof(MarkerInfo *),
COMPAREFUNC MarkerInfo::ComparePosition);
markers.Clear();
int current_chromosome = -1, next_chromosome = 0;
for (int i = 0; i < count; i++)
if (subset[i]->chromosome < chromosome)
continue;
else if (current_chromosome == -1 ||
subset[i]->chromosome == current_chromosome)
{
markers.Push(GetMarkerID(subset[i]->name));
current_chromosome = subset[i]->chromosome;
}
else if (!next_chromosome)
{
next_chromosome = subset[i]->chromosome;
break;
}
delete [] subset;
return next_chromosome;
}

## VerifySexSpecificOrder()

void PedigreeGlobals::VerifySexSpecificOrder | ( |  | ) |

static

Definition at line 384 of file PedigreeGlobals.cpp.

{
if (markerCount <= 1)
return;
MarkerInfo ** sortedMarkers = new MarkerInfo * [markerCount];
for (int i = 0; i < markerCount; i++)
sortedMarkers[i] = GetMarkerInfo(i);
QuickSort(sortedMarkers, markerCount, sizeof(MarkerInfo *),
COMPAREFUNC MarkerInfo::ComparePosition);
double prev_female = sortedMarkers[0]->positionFemale;
double prev_male = sortedMarkers[0]->positionMale;
double curr_female, curr_male;
int prev_chromosome = sortedMarkers[0]->chromosome;
int curr_chromosome;
for (int i = 1; i < markerCount; i++)
{
curr_chromosome = sortedMarkers[i]->chromosome;
curr_female = sortedMarkers[i]->positionFemale;
curr_male = sortedMarkers[i]->positionMale;
if (curr_chromosome == prev_chromosome &&
(curr_female < prev_female || curr_male < prev_male))
error("Sex-specific and sex-averaged maps are inconsistent.\n\n"
"In the sex-averaged map, marker %s (%.2f cM) follows marker %s (%.2f cM).\n"
"In the %smale map, marker %s (%.2f cM) PRECEDES marker %s (%.2f cM).\n",
(const char *) sortedMarkers[i]->name,
sortedMarkers[i]->position * 100,
(const char *) sortedMarkers[i-1]->name,
sortedMarkers[i-1]->position * 100,
curr_female < prev_female ? "fe" : "",
(const char *) sortedMarkers[i]->name,
(curr_female < prev_female ? curr_female : curr_male) * 100,
(const char *) sortedMarkers[i-1]->name,
(curr_female < prev_female ? prev_female : prev_male) * 100);
prev_chromosome = curr_chromosome;
prev_female = curr_female;
prev_male = curr_male;
}
delete [] sortedMarkers;
}

## WriteFreqFile() [1/2]

void PedigreeGlobals::WriteFreqFile | ( | const char * | filename,
|  | bool | old_format = `false`
| ) |  |

static

Definition at line 763 of file PedigreeGlobals.cpp.

{
FILE * output = fopen(filename, "wt");
if (output == NULL)
error("Creating allele frequency file \"%s\"", filename);
WriteFreqFile(output, old_format);
fclose(output);
}

## WriteFreqFile() [2/2]

void PedigreeGlobals::WriteFreqFile | ( | FILE * | file,
|  | bool | old_format = `false`
| ) |  |

static

Definition at line 774 of file PedigreeGlobals.cpp.

{
for (int i = 0; i < markerInfoCount; i++)
{
MarkerInfo * info = markerInfo[i];
if (info->freq.Length() == 0) continue;
fprintf(output, "M %s\n", (const char *) info->name);
if (old_format && info->alleleLabels.Length() == 0)
for (int j = 1; j < info->freq.Length(); j++)
fprintf(output, "%s%.5f%s",
j % 7 == 1 ? "F " : "", info->freq[j],
j == info->freq.Length() - 1 ? "\n" : j % 7 == 0 ? "\n" : " ");
else
for (int j = 1; j < info->freq.Length(); j++)
if (info->freq[j] > 1e-7)
fprintf(output, "A %5s %.5f\n",
(const char *) info->GetAlleleLabel(j), info->freq[j]);
}
}

## WriteMapFile() [1/2]

void PedigreeGlobals::WriteMapFile | ( | const char * | filename | ) |

static

Definition at line 722 of file PedigreeGlobals.cpp.

{
if (!MarkerPositionsAvailable())
return;
FILE * output = fopen(filename, "wt");
if (output == NULL)
error("Creating map file \"%s\"", filename);
WriteMapFile(output);
fclose(output);
}

## WriteMapFile() [2/2]

void PedigreeGlobals::WriteMapFile | ( | FILE * | file | ) |

static

Definition at line 736 of file PedigreeGlobals.cpp.

{
if (!sexSpecificMap)
fprintf(output, "CHR MARKER POS\n");
else
fprintf(output, "CHR MARKER POS POSF POSM\n");
for (int i = 0; i < markerInfoCount; i++)
{
if (markerInfo[i]->chromosome != -1)
{
if (!sexSpecificMap)
fprintf(output, "%3d %-10s %g\n",
markerInfo[i]->chromosome,
(const char *) markerInfo[i]->name,
markerInfo[i]->position * 100.0);
else
fprintf(output, "%3d %-10s %g %g %g\n",
markerInfo[i]->chromosome,
(const char *) markerInfo[i]->name,
markerInfo[i]->position * 100.0,
markerInfo[i]->positionFemale * 100.0,
markerInfo[i]->positionMale * 100.0);
}
}
}

## Member Data Documentation

## affectionCount

int PedigreeGlobals::affectionCount = 0

static

Definition at line 112 of file PedigreeGlobals.h.

## affectionLookup

StringIntHash PedigreeGlobals::affectionLookup

static

Definition at line 129 of file PedigreeGlobals.h.

## affectionNames

StringArray PedigreeGlobals::affectionNames

static

Definition at line 124 of file PedigreeGlobals.h.

## chromosomeX

bool PedigreeGlobals::chromosomeX = false

static

Definition at line 117 of file PedigreeGlobals.h.

## covariateCount

int PedigreeGlobals::covariateCount = 0

static

Definition at line 113 of file PedigreeGlobals.h.

## covariateLookup

StringIntHash PedigreeGlobals::covariateLookup

static

Definition at line 130 of file PedigreeGlobals.h.

## covariateNames

StringArray PedigreeGlobals::covariateNames

static

Definition at line 123 of file PedigreeGlobals.h.

## markerCount

int PedigreeGlobals::markerCount = 0

static

Definition at line 111 of file PedigreeGlobals.h.

## markerInfo

MarkerInfo ** PedigreeGlobals::markerInfo = NULL

static

Definition at line 169 of file PedigreeGlobals.h.

## markerInfoByInteger

MarkerInfo ** PedigreeGlobals::markerInfoByInteger = NULL

static

Definition at line 171 of file PedigreeGlobals.h.

## markerInfoByName

StringHash PedigreeGlobals::markerInfoByName

static

Definition at line 170 of file PedigreeGlobals.h.

## markerInfoCount

int PedigreeGlobals::markerInfoCount = 0

static

Definition at line 167 of file PedigreeGlobals.h.

## markerInfoSize

int PedigreeGlobals::markerInfoSize = 0

static

Definition at line 168 of file PedigreeGlobals.h.

## markerLookup

StringIntHash PedigreeGlobals::markerLookup

static

Definition at line 127 of file PedigreeGlobals.h.

## markerNames

StringArray PedigreeGlobals::markerNames

static

Definition at line 125 of file PedigreeGlobals.h.

## sexSpecificMap

bool PedigreeGlobals::sexSpecificMap = false

static

Definition at line 120 of file PedigreeGlobals.h.

## stringCount

int PedigreeGlobals::stringCount = 0

static

Definition at line 114 of file PedigreeGlobals.h.

## stringLookup

StringIntHash PedigreeGlobals::stringLookup

static

Definition at line 131 of file PedigreeGlobals.h.

## stringNames

StringArray PedigreeGlobals::stringNames

static

Definition at line 126 of file PedigreeGlobals.h.

## traitCount

int PedigreeGlobals::traitCount = 0

static

Definition at line 110 of file PedigreeGlobals.h.

## traitLookup

StringIntHash PedigreeGlobals::traitLookup

static

Definition at line 128 of file PedigreeGlobals.h.

## traitNames

StringArray PedigreeGlobals::traitNames

static

Definition at line 122 of file PedigreeGlobals.h.

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

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