Difference between revisions of "C++ Class: Pedigree Example"

From Genome Analysis Wiki
Jump to navigationJump to search
(Created page with '== Example == <source lang="cpp"> #include "Pedigree.h" int main(int argc, char ** argv); { Pedigree ped; // The data file contains a description of the contents of the…')
 
Line 33: Line 33:
  
 
   // Get some genotype statistics for the first marker
 
   // Get some genotype statistics for the first marker
   printf("Statistics for marker %s\n", (const char *) ped.markerNames[0]);
+
   printf("Statistics for marker %s\n", (const char *) ped.markerNames[0]);  
 
   }
 
   }
 
</source>
 
</source>

Revision as of 16:31, 13 April 2010

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]); 
  }