Skip Navigation
  Print Page

Biostatistics and Bioinformatics Branch (BBB)

Skip sharing on social media links
Share this:
Skip Internal Navigation

Extended Homozygosity Score Test (EHST)


#include <stdio.h>
#include <iostream>
#include <ctype.h>
#include <vector>
#include <string>
#include <string.h>
#include <algorithm>
#include "math.h"
#include <map>

#define epsilon 0.00001
#define TEST 20 //mamimum number of gap snps before exiting in loop calculation

using namespace std;

// comparison function for map keys sorting
struct strCmp
      bool operator()(const char* s1, const char* s2) const
            return strcmp(s1, s2) < 0;

// compare two strings s and t betwen positions n and m, n <= m
int Memcmp(const char* s, const char* t, int n, int m)
      if (n > m)
            printf("Error: m must be larger than n!\n");

      int i;
      for (i = n; s[i] == t[i] && i < m + 1; i++)
            if (s[i] == '\0')
                  return 0;

      if ( i == m + 1)
            return 0;
            return s[i] - t[i];

class EGHH
            void load_info(char *infofile);
            int load_data(char *datafile);
            void compute_eghst(int index); // calculate score test for genotype data
            void compute_hmmst(int index); // calculate score test by hidden markov
                                                            // chains, assuming pair-wise LD
            void compute_ehhst(int index); // calcualte score test for hapotype data
            void compute_FYst(int index); // calcualte Fisher-Yates score test
            void compute_allele_freq(int index);// calculate allele freq for locus "index"
            void compute_hap_freq(int index); // calculate hap freq for two loci
                                                            // of "index" and "index + 1"

            int snp_num; // number of snps
            vector<string> snp_list;

                 double ndist(double z, bool upper); //normal distribution function
            char *out_egh, * out_hmm, *out_ehh, *out_FY;
                 FILE *output_egh, * output_hmm, *output_ehh, *output_FY;
             // output_FY is results of Fisher-Yates Hap Exact Tests //

                 vector<char *> data;

                 vector<int> phy_map;
                       vector<string> allele_coded_0;
                 vector<string> allele_coded_1;

                 vector<float> p; //allele freq
                       double hap00, hap01, hap10, hap11; //haplotype frequencies

                 double mean_M (int index);
                       double count_homozygotes(int index); //count all homozygotes around locus "index"//

                 double mean_R, mean_Rsq;
                       void mean_R_Rsq_hap (int index); //to calculate E R and E R^2 for haplotype data
                       void mean_R_Rsq_gen (int index); //to calculate E R and E R^2 for genotype data
                       void mean_R_Rsq_hmm (int index); //to calculate E R and E R^2 using hidden Markov
                       //chain, assuming pair-wise LD

                 double mean_L, mean_Lsq;
                       void mean_L_Lsq_hap (int index); //to calculate E L and E L^2 for haplotype data
                       void mean_L_Lsq_gen (int index); //to calculate E L and E L^2 for genotype data
                       void mean_L_Lsq_hmm (int index); //to calculate E L and E L^2 using hidden Markov
                       //chain, assuming pair-wise LD

                 //double expectation_LR (int index); //to calculate E LR for haplotype data
                 //vector<int> sw_list;

Last Updated Date: 04/12/2013
Last Reviewed Date: 04/12/2013

Contact Information

Name: Dr Paul Albert
Chief and Senior Investigator
Biostatistics and Bioinformatics Branch
Phone: 301-496-5582

Staff Directory
Vision National Institutes of Health Home BOND National Institues of Health Home Home Storz Lab: Section on Environmental Gene Regulation Home Machner Lab: Unit on Microbial Pathogenesis Home Division of Intramural Population Health Research Home Bonifacino Lab: Section on Intracellular Protein Trafficking Home Lilly Lab: Section on Gamete Development Home Lippincott-Schwartz Lab: Section on Organelle Biology