C++ Class: Pedigree Example

From Genome Analysis Wiki
Revision as of 16:31, 13 April 2010 by Pha (talk | contribs) (→‎Example)
Jump to navigationJump to search

Example

#include "Pedigree.h"

int main(int argc, char ** argv);
  {
  Pedigree ped;

  // The data file contains a description of the contents of the
  // pedigree file, including for example, a list of marker and 
  // trait names
  ped.Prepare("pedigree.dat");

  // The pedigree file contains a list of individuals, stored one
  // per row, with specific information about each individual as
  // detailed in the data file.
  ped.Load("pedigree.ped");

  printf("Loaded %d individuals\n", ped.count);
  printf("Loaded %d markers\n", ped.markerCount);

  // Print out names of the first 10 individuals
  for (int i = 0; i < max(ped.count, 10); i++)
     printf("Individual #1 is labeled %s\n", (const char *) ped[i].pid);

  if (ped.markerCount == 0) 
     {
     printf("No marker data available!\n");
     return 0;
     }

  // Get some genotype statistics for the first marker
  printf("Statistics for marker %s\n", (const char *) ped.markerNames[0]); 
  }