Skip to content

Commit

Permalink
fixing code style check
Browse files Browse the repository at this point in the history
  • Loading branch information
shajoezhu authored and bredelings committed Mar 29, 2021
1 parent 507f9b0 commit fd1a513
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
6 changes: 5 additions & 1 deletion src/ibd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,11 @@ void IBDpath::makeLlkSurf(vector <double> altCount, vector <double> refCount,

vector <double> ll;
for ( double unadjustedP : pGrid ) {
ll.push_back(log(calcSiteLikelihood(ref, alt, unadjustedP, err, scalingConst)));
ll.push_back(log(calcSiteLikelihood(ref,
alt,
unadjustedP,
err,
scalingConst)));
}

double llmax = max_value(ll);
Expand Down
2 changes: 1 addition & 1 deletion src/mcmc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include <iostream>
#include <iomanip> // std::setw
#include <string>
#include <utility> // std::pair <>
#include <utility> // std::pair<>
#include "random/mersenne_twister.hpp"
#include "dEploidIO.hpp"
#include "panel.hpp"
Expand Down
38 changes: 26 additions & 12 deletions tests/unittest/test_utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,32 +253,46 @@ class TestUtility : public CppUnit::TestCase {

void testCalcLLK() {
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0,
log(calcSiteLikelihood(0, 0, 0.0, this->err_, this->scalingFactor_)), ep2);
log(calcSiteLikelihood(0, 0, 0.0, this->err_, this->scalingFactor_)),
ep2);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0,
log(calcSiteLikelihood(0, 0, 1.0, this->err_, this->scalingFactor_)), ep2);
log(calcSiteLikelihood(0, 0, 1.0, this->err_, this->scalingFactor_)),
ep2);
CPPUNIT_ASSERT_DOUBLES_EQUAL(0.0,
log(calcSiteLikelihood(0, 0, 0.5, this->err_, this->scalingFactor_)), ep2);
log(calcSiteLikelihood(0, 0, 0.5, this->err_, this->scalingFactor_)),
ep2);

CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.09622803,
log(calcSiteLikelihood(10, 0, 0.0, this->err_, this->scalingFactor_)), ep2);
log(calcSiteLikelihood(10, 0, 0.0, this->err_, this->scalingFactor_)),
ep2);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-31.38367782,
log(calcSiteLikelihood(10, 0, 1.0, this->err_, this->scalingFactor_)), ep2);
log(calcSiteLikelihood(10, 0, 1.0, this->err_, this->scalingFactor_)),
ep2);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-6.520005876,
log(calcSiteLikelihood(10, 0, 0.5, this->err_, this->scalingFactor_)), ep2);
log(calcSiteLikelihood(10, 0, 0.5, this->err_, this->scalingFactor_)),
ep2);

CPPUNIT_ASSERT_DOUBLES_EQUAL(-92.39749823,
log(calcSiteLikelihood(0, 50, 0.0, this->err_, this->scalingFactor_)), ep2);
log(calcSiteLikelihood(0, 50, 0.0, this->err_, this->scalingFactor_)),
ep2);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-0.4088264558,
log(calcSiteLikelihood(0, 50, 1.0, this->err_, this->scalingFactor_)), ep2);
log(calcSiteLikelihood(0, 50, 1.0, this->err_, this->scalingFactor_)),
ep2);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-26.30680376,
log(calcSiteLikelihood(0, 50, 0.5, this->err_, this->scalingFactor_)), ep2);
log(calcSiteLikelihood(0, 50, 0.5, this->err_, this->scalingFactor_)),
ep2);

CPPUNIT_ASSERT_DOUBLES_EQUAL(-39.454802987,
log(calcSiteLikelihood(11, 13, 0.0, this->err_, this->scalingFactor_)), ep2);
log(calcSiteLikelihood(11, 13, 0.0, this->err_,
this->scalingFactor_)),
ep2);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-82.7561739077,
log(calcSiteLikelihood(41, 2, 1.0, this->err_, this->scalingFactor_)), ep2);
log(calcSiteLikelihood(41, 2, 1.0, this->err_, this->scalingFactor_)),
ep2);
CPPUNIT_ASSERT_DOUBLES_EQUAL(-71.6257227,
log(calcSiteLikelihood(23, 99, 0.5, this->err_, this->scalingFactor_)), ep2);
log(calcSiteLikelihood(23, 99, 0.5, this->err_,
this->scalingFactor_)),
ep2);
}


Expand Down

0 comments on commit fd1a513

Please sign in to comment.