Changeset 3987


Ignore:
Timestamp:
Aug 26, 2020, 6:42:10 AM (3 years ago)
Author:
Peter
Message:

merge release 0.17.2 into trunk

Location:
trunk
Files:
13 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/Makefile.am

    r3417 r3987  
    88# Copyright (C) 2006 Jari Häkkinen
    99# Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    10 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Peter Johansson
     10# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2020 Peter Johansson
    1111#
    1212# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    6565
    6666clean-local:
    67   rm -rf doc/$(DX_HTML_OUTPUT) test/yathello test/testSubDir test/lib
     67  rm -rf doc/html test/yathello test/testSubDir test/lib
    6868
    6969installcheck-local: $(INSTALL_CHECK_TARGETS)
  • trunk/NEWS

    r3980 r3987  
    2525yat 0.17.x series from http://dev.thep.lu.se/yat/svn/branches/0.17-stable
    2626
    27 version 0.17.2 (released NOT YET)
     27version 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)
    2833  - Generating documentation now works with Doxygen 1.8.19 (bug #954)
    2934  - GSL, HTSLIB, Boost.Thread and Boost.System are not declated private
  • trunk/build_support/Makefile.am

    r3966 r3987  
    11## $Id$
    22
    3 # Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017, 2019 Peter Johansson
     3# Copyright (C) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2016, 2017, 2019, 2020 Peter Johansson
    44#
    55# This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/doc/Makefile.am

    r3968 r3987  
    44# Copyright (C) 2005 Peter Johansson
    55# Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
    6 # Copyright (C) 2009, 2010, 2011, 2012 Peter Johansson
     6# Copyright (C) 2009, 2010, 2011, 2012, 2020 Peter Johansson
    77#
    88# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    8888  || { echo "no documentation installed" 1>&2; exit 1; }
    8989
     90MOSTLYCLEANFILES += doc/doxygen.config
    9091MOSTLYCLEANFILES += doc/doxygen.error
  • trunk/doc/doxygen.config.in

    r3966 r3987  
    55# Copyright (C) 2006, 2007 Jari Häkkinen, Peter Johansson
    66# Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
    7 # Copyright (C) 2009, 2010, 2012, 2014, 2017, 2018 Peter Johansson
     7# Copyright (C) 2009, 2010, 2012, 2014, 2017, 2018, 2020 Peter Johansson
    88#
    99# This file is part of the yat library, http://dev.thep.lu.se/yat
  • trunk/m4/version.m4

    r3930 r3987  
    9494# yat-0.17   14:0:0
    9595# yat-0.17.1 14:1:0
     96# yat-0.17.2 14:2:0
    9697#
    9798# *Accidently, the libtool number was not updated for yat 0.5
  • trunk/test/Makefile.am

    r3966 r3987  
    55# Copyright (C) 2005 Jari Häkkinen, Peter Johansson
    66# 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 Johansson
     7# Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020 Peter Johansson
    88#
    99# This file is part of the yat library, http://dev.thep.lu.se/yat
     
    188188test/cmd_test.log: test/help.test $(shell_test_deps)
    189189test/help_test.log: test/help.test $(shell_test_deps)
     190test/kendall.log: $(top_srcdir)/test/data/kendall.txt
    190191test/pileup.log: test/data/foo.sorted.bam
    191192test/static_test.log: $(srcdir)/m4/yat.m4 $(shell_test_deps)
     
    312313test/data/foo.vcf \
    313314test/data/isoform.peaks \
     315test/data/kendall.txt \
    314316test/data/knni_matrix.data \
    315317test/data/knni_result.data \
  • trunk/test/Suite.h

    r3883 r3987  
    66/*
    77  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009, 2010, 2011, 2013, 2014, 2015, 2016, 2018, 2019 Peter Johansson
     8  Copyright (C) 2009, 2010, 2011, 2013, 2014, 2015, 2016, 2018, 2019, 2020 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    191191
    192192  /**
    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
    198196     \return absolute path to file
    199197     \param local_path path relative to srcdir
  • trunk/test/kendall.cc

    r2881 r3987  
    22
    33/*
    4   Copyright (C) 2011, 2012 Peter Johansson
     4  Copyright (C) 2011, 2012, 2020 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2424#include "Suite.h"
    2525
     26#include "yat/random/random.h"
    2627#include "yat/statistics/Kendall.h"
     28#include "yat/utility/Matrix.h"
    2729
    2830#include <gsl/gsl_cdf.h>
    2931
    3032#include <cmath>
     33#include <fstream>
    3134
    3235using namespace theplu::yat;
     
    3740void test_p(test::Suite&);
    3841void test_p_exact(test::Suite&);
     42void test_p_with_ties(test::Suite&);
    3943void test_score(test::Suite&);
    4044void test_score_with_ties(test::Suite&);
     
    4852  test_p(suite);
    4953  test_p_exact(suite);
     54  test_p_with_ties(suite);
    5055  test_score(suite);
    5156  test_score_with_ties(suite);
     
    110115  kendall.add(8,1.5);
    111116  suite.add(suite.equal_fix(0.031, kendall.p_right(true), 0.0005));
     117}
     118
     119
     120void 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  }
    112147}
    113148
     
    158193  double vu = 3*2*11 + 2*1*9;
    159194  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));
    161196  double v = (v0-vt-vu)/18 + v1 + v2;
    162197  double z = (nc - nd)/std::sqrt(v);
  • trunk/test/vector.cc

    r3871 r3987  
    354354    theplu::yat::utility::Vector vec(0, 1.2);
    355355    theplu::yat::utility::Vector vec2(vec);
     356    // test ticket #956
     357    vec.resize(0);
    356358  }
    357359
  • trunk/yat/statistics/Kendall.cc

    r3915 r3987  
    22
    33/*
    4   Copyright (C) 2011, 2012 Peter Johansson
     4  Copyright (C) 2011, 2012, 2020 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    102102      // avoid overflow
    103103      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));
    112136        }
    113137      }
    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));
    115140    }
    116141
  • trunk/yat/utility/VectorMutable.cc

    r3743 r3987  
    66  Copyright (C) 2005, 2006, 2007 Jari Häkkinen, Peter Johansson, Markus Ringnér
    77  Copyright (C) 2008, 2009 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2010, 2012, 2016, 2017, 2018 Peter Johansson
     8  Copyright (C) 2010, 2012, 2016, 2017, 2018, 2020 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/trac/yat
     
    6969  void VectorMutable::all(double value)
    7070  {
    71     assert(vec_);
    72     gsl_vector_set_all(vec_,value);
     71    if (vec_)
     72      gsl_vector_set_all(vec_,value);
    7373  }
    7474
Note: See TracChangeset for help on using the changeset viewer.