Skip Navigation
  Print Page

Biostatistics and Bioinformatics Branch (BBB)

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

A Cross-population Extended Haplotype-based Homozygosity Score Test (xp-EHHST)


#include <stdio.h>
//#include <stdlib.h>
#include <iostream>
#include <ctype.h>
#include <vector>
//#include <iterator>
#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 xpEHHT
                void load_info(char *infofile);
                int load_data(char *datafile);
                void compute_ehhst(int index); // calcualte score test for hapotype data
                void compute_allele_freq(int index);// calculate allele freq for locus "index"

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

                double ndist(double z, bool upper); //normal distribution function
                char *out_ehh;
                FILE *output_ehh;

// private:
                vector<char *> data;

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

                vector<float> p; //allele freq

                 vector<float> musav;
                 vector<float> sigmasav;
                 vector<float> Ssav;

                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

                double mean_L, mean_Lsq;
                void mean_L_Lsq_hap (int index); //to calculate E L and E L^2 for haplotype data

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