Changeset 3987
- Timestamp:
- Aug 26, 2020, 6:42:10 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/0.17-stable merged: 3971-3976,3978-3979,3981,3984-3985
- Property svn:mergeinfo changed
-
trunk/Makefile.am
r3417 r3987 8 8 # Copyright (C) 2006 Jari Häkkinen 9 9 # Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson 10 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Peter Johansson10 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2020 Peter Johansson 11 11 # 12 12 # This file is part of the yat library, http://dev.thep.lu.se/yat … … 65 65 66 66 clean-local: 67 rm -rf doc/ $(DX_HTML_OUTPUT)test/yathello test/testSubDir test/lib67 rm -rf doc/html test/yathello test/testSubDir test/lib 68 68 69 69 installcheck-local: $(INSTALL_CHECK_TARGETS) -
trunk/NEWS
r3980 r3987 25 25 yat 0.17.x series from http://dev.thep.lu.se/yat/svn/branches/0.17-stable 26 26 27 version 0.17.2 (released NOT YET) 27 version 0.17.2 (released 26 August 2020) 28 - Fixed bug in Kendall::p_value() that caused overstimation when 29 both variables contained triplets (see bug #955) 30 - VectorMutable::all(double) now works on zero-sized vector, which 31 means that Vector::resize(0) now works on a zero-sized vector (bug 32 #956) 28 33 - Generating documentation now works with Doxygen 1.8.19 (bug #954) 29 34 - GSL, HTSLIB, Boost.Thread and Boost.System are not declated private -
trunk/build_support/Makefile.am
r3966 r3987 1 1 ## $Id$ 2 2 3 # Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017, 2019 Peter Johansson3 # Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017, 2019, 2020 Peter Johansson 4 4 # 5 5 # This file is part of the yat library, http://dev.thep.lu.se/yat -
trunk/doc/Makefile.am
r3968 r3987 4 4 # Copyright (C) 2005 Peter Johansson 5 5 # Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson 6 # Copyright (C) 2009, 2010, 2011, 2012 Peter Johansson6 # Copyright (C) 2009, 2010, 2011, 2012, 2020 Peter Johansson 7 7 # 8 8 # This file is part of the yat library, http://dev.thep.lu.se/yat … … 88 88 || { echo "no documentation installed" 1>&2; exit 1; } 89 89 90 MOSTLYCLEANFILES += doc/doxygen.config 90 91 MOSTLYCLEANFILES += doc/doxygen.error -
trunk/doc/doxygen.config.in
r3966 r3987 5 5 # Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson 6 6 # Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér 7 # Copyright (C) 2009, 2010, 2012, 2014, 2017, 2018 Peter Johansson7 # Copyright (C) 2009, 2010, 2012, 2014, 2017, 2018, 2020 Peter Johansson 8 8 # 9 9 # This file is part of the yat library, http://dev.thep.lu.se/yat -
trunk/m4/version.m4
r3930 r3987 94 94 # yat-0.17 14:0:0 95 95 # yat-0.17.1 14:1:0 96 # yat-0.17.2 14:2:0 96 97 # 97 98 # *Accidently, the libtool number was not updated for yat 0.5 -
trunk/test/Makefile.am
r3966 r3987 5 5 # Copyright (C) 2005 Jari Häkkinen, Peter Johansson 6 6 # Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér 7 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Peter Johansson7 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Peter Johansson 8 8 # 9 9 # This file is part of the yat library, http://dev.thep.lu.se/yat … … 188 188 test/cmd_test.log: test/help.test $(shell_test_deps) 189 189 test/help_test.log: test/help.test $(shell_test_deps) 190 test/kendall.log: $(top_srcdir)/test/data/kendall.txt 190 191 test/pileup.log: test/data/foo.sorted.bam 191 192 test/static_test.log: $(srcdir)/m4/yat.m4 $(shell_test_deps) … … 312 313 test/data/foo.vcf \ 313 314 test/data/isoform.peaks \ 315 test/data/kendall.txt \ 314 316 test/data/knni_matrix.data \ 315 317 test/data/knni_result.data \ -
trunk/test/Suite.h
r3883 r3987 6 6 /* 7 7 Copyright (C) 2008 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2009, 2010, 2011, 2013, 2014, 2015, 2016, 2018, 2019 Peter Johansson8 Copyright (C) 2009, 2010, 2011, 2013, 2014, 2015, 2016, 2018, 2019, 2020 Peter Johansson 9 9 10 10 This file is part of the yat library, http://dev.thep.lu.se/yat … … 191 191 192 192 /** 193 \return absolute path to test src dir 194 */ 195 std::string abs_srcdir(void); 196 197 /** 193 If top source directory is located in /home/strangelove/yat, 194 function returns "/home/strangelove/yat" + "test/" + local_path 195 198 196 \return absolute path to file 199 197 \param local_path path relative to srcdir -
trunk/test/kendall.cc
r2881 r3987 2 2 3 3 /* 4 Copyright (C) 2011, 2012 Peter Johansson4 Copyright (C) 2011, 2012, 2020 Peter Johansson 5 5 6 6 This file is part of the yat library, http://dev.thep.lu.se/yat … … 24 24 #include "Suite.h" 25 25 26 #include "yat/random/random.h" 26 27 #include "yat/statistics/Kendall.h" 28 #include "yat/utility/Matrix.h" 27 29 28 30 #include <gsl/gsl_cdf.h> 29 31 30 32 #include <cmath> 33 #include <fstream> 31 34 32 35 using namespace theplu::yat; … … 37 40 void test_p(test::Suite&); 38 41 void test_p_exact(test::Suite&); 42 void test_p_with_ties(test::Suite&); 39 43 void test_score(test::Suite&); 40 44 void test_score_with_ties(test::Suite&); … … 48 52 test_p(suite); 49 53 test_p_exact(suite); 54 test_p_with_ties(suite); 50 55 test_score(suite); 51 56 test_score_with_ties(suite); … … 110 115 kendall.add(8,1.5); 111 116 suite.add(suite.equal_fix(0.031, kendall.p_right(true), 0.0005)); 117 } 118 119 120 void test_p_with_ties(test::Suite& suite) 121 { 122 suite.out() << YAT_TEST_PROLOGUE; 123 std::string fn = test::filename("data/kendall.txt"); 124 std::ifstream is(fn.c_str()); 125 if (!is.good()) { 126 suite.add(false); 127 suite.err() << "failed open '" << fn << "'\n"; 128 return; 129 } 130 utility::Matrix x(is); 131 is.close(); 132 Kendall kendall; 133 for (size_t i=0; i<x.rows(); ++i) 134 kendall.add(x(i,0), x(i, 1)); 135 double score = kendall.score(); 136 suite.out() << "score: " << score << "\n"; 137 double p = kendall.p_value(); 138 suite.out() << "p: " << p << "\n"; 139 if (p > 0.0001) { 140 suite.err() << "error: too large p\n"; 141 suite.add(false); 142 } 143 if (p < 0.00001) { 144 suite.err() << "error: too small p\n"; 145 suite.add(false); 146 } 112 147 } 113 148 … … 158 193 double vu = 3*2*11 + 2*1*9; 159 194 double v1 = (6+6)*(6+2)/(2.0*n*(n-1)); 160 double v2 = (3*2*1+3*2*1)*(3*2*1) ;195 double v2 = (3*2*1+3*2*1)*(3*2*1) / (9.0*n*(n-1)*(n-2)); 161 196 double v = (v0-vt-vu)/18 + v1 + v2; 162 197 double z = (nc - nd)/std::sqrt(v); -
trunk/test/vector.cc
r3871 r3987 354 354 theplu::yat::utility::Vector vec(0, 1.2); 355 355 theplu::yat::utility::Vector vec2(vec); 356 // test ticket #956 357 vec.resize(0); 356 358 } 357 359 -
trunk/yat/statistics/Kendall.cc
r3915 r3987 2 2 3 3 /* 4 Copyright (C) 2011, 2012 Peter Johansson4 Copyright (C) 2011, 2012, 2020 Peter Johansson 5 5 6 6 This file is part of the yat library, http://dev.thep.lu.se/yat … … 102 102 // avoid overflow 103 103 double n = this->n(); 104 double var = n*(n-1)*(2*n+5)/18; 105 if (have_ties()) { 106 var -= (v_correction(x_count_)+v_correction(y_count_))/18.0; 107 double v1 = count_pair(x_count_)*count_pair(y_count_)/(2*n*(n-1)); 108 if (v1) { 109 var += v1; 110 // v_corr3 is zero if v1=0 111 var += count_triple(x_count_)*count_triple(y_count_); 104 /* 105 According to wikipedia, 106 z = k / sqrt(v) 107 is approximately standard normal 108 v = (v0 - vt - vu)/18 + v1 + v2 109 v0 = n(n-1)(2n+5) 110 vt = \sum t(t-1)(2t+5) 111 vu = \sum u(u-1)(2u+5) 112 v1 = \sum t(t-1)) * \sum u(u-1) / (2n(n-1)) 113 v2 = sum t(t-1)(t-2) \sum u(u-1)(u-2) / (9n(n-1)(n-2)) 114 115 where t is number of equal values in group i 116 and similarly u for y. 117 */ 118 double v0 = n*(n-1)*(2*n+5); 119 double vt = 0; 120 double vu = 0; 121 double v1 = 0; 122 double v2 = 0; 123 // all correction terms above are zero in absence of ties 124 bool x_have_ties = x_.size() != x_count_.size(); 125 bool y_have_ties = y_.size() != y_count_.size(); 126 if (x_have_ties || y_have_ties) { 127 if (x_have_ties) 128 vt = v_correction(x_count_); 129 if (y_have_ties) 130 vu = v_correction(y_count_); 131 if (x_have_ties && y_have_ties) { 132 v1 = count_pair(x_count_) * (count_pair(y_count_) / (2*n*(n-1))); 133 v2 = count_triple(x_count_); 134 if (v2) 135 v2 *= count_triple(y_count_) / (9*n*(n-1)*(n-2)); 112 136 } 113 137 } 114 return gsl_cdf_gaussian_Q(k, std::sqrt(var)); 138 double v = (v0 - vt - vu)/18 + v1 + v2; 139 return gsl_cdf_gaussian_Q(k, std::sqrt(v)); 115 140 } 116 141 -
trunk/yat/utility/VectorMutable.cc
r3743 r3987 6 6 Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér 7 7 Copyright (C) 2008, 2009 Jari Häkkinen, Peter Johansson 8 Copyright (C) 2010, 2012, 2016, 2017, 2018 Peter Johansson8 Copyright (C) 2010, 2012, 2016, 2017, 2018, 2020 Peter Johansson 9 9 10 10 This file is part of the yat library, http://dev.thep.lu.se/trac/yat … … 69 69 void VectorMutable::all(double value) 70 70 { 71 assert(vec_);72 gsl_vector_set_all(vec_,value);71 if (vec_) 72 gsl_vector_set_all(vec_,value); 73 73 } 74 74
Note: See TracChangeset
for help on using the changeset viewer.