libsequence  1.9.5
testGarudStatistics.cc File Reference

unit tests for H1, H12, H2/H1 stats More...

#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <set>
#include <iostream>
#include <Sequence/VariantMatrix.hpp>
#include <Sequence/VariantMatrixViews.hpp>
#include <Sequence/summstats/garud.hpp>
#include <Sequence/summstats/classics.hpp>
#include "VariantMatrixFixture.hpp"
#include <boost/test/unit_test.hpp>

Go to the source code of this file.

Functions

 BOOST_REQUIRE_EQUAL (1.0 - hdiv, G.H1)
 
 for (auto i=0;i< m.nsam;++i)
 
std::set< std::string > uhaps (haps.begin(), haps.end())
 
 for (auto &u :uhaps)
 
 for (auto hc :hcounts)
 
 BOOST_CHECK_CLOSE (H1, G.H1, 1e-6)
 
decltype(hcounts) hcounts2 (hcounts.begin()+1, hcounts.end())
 
 for (auto hc :hcounts2)
 
 BOOST_CHECK_CLOSE (H12, G.H12, 1e-6)
 
 BOOST_CHECK_CLOSE (H2/H1, G.H2H1, 1e-6)
 

Variables

auto hdiv = Sequence::haplotype_diversity(m)
 
std::vector< std::string > haps
 
std::vector< int > hcounts
 
double H1 = 0.0
 
double nsam = static_cast<double>(m.nsam)
 
 hcounts2 [0] = hcounts[0]
 
double H12 = 0.0
 
double p1sq
 
double H2 = H1 - p1sq
 

Detailed Description

unit tests for H1, H12, H2/H1 stats

Definition in file testGarudStatistics.cc.

Variable Documentation

◆ p1sq

double p1sq
Initial value:
= static_cast<double>(hcounts[0] * (hcounts[0] - 1))
/ (nsam * (nsam - 1.0))

Definition at line 77 of file testGarudStatistics.cc.