[med-svn] [scrm] 01/05: Imported Upstream version 1.7.2

Andreas Tille tille at debian.org
Thu May 19 16:03:26 UTC 2016


This is an automated email from the git hooks/post-receive script.

tille pushed a commit to branch master
in repository scrm.

commit ad9ebe701368814e641fc4e3b1521233a4c023b4
Author: Andreas Tille <tille at debian.org>
Date:   Thu May 19 17:52:53 2016 +0200

    Imported Upstream version 1.7.2
---
 .travis.yml                              |  1 +
 .travis/build_static_binaries.sh         |  3 ++-
 NEWS.md                                  | 13 +++++++++++++
 README.md                                | 11 ++++-------
 configure.ac                             |  2 +-
 doc/scrm.1                               |  2 +-
 src/contemporaries_container.h           | 20 +++++++++++++-------
 src/forest.cc                            |  4 +++-
 src/summary_statistics/oriented_forest.h |  1 +
 src/time_interval.cc                     |  4 ++--
 tests/test_binaries.sh                   | 12 ++++++++----
 11 files changed, 49 insertions(+), 24 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index 5da88cd..277f129 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -31,6 +31,7 @@ deploy:
     secure: UrEhKzTdSr7NB4ptDYcWKN02XjfgJgN1fNFu8G2a52Jpk1Z3UeenbmKxIDLj11JUlU427br7t1oQyScYSYEGEM5VEI0aWf7D2i9cPfSRD9QYnHOPG2XZE/xgkwWAm0s4TjnTBmudGSxs9g2KRjDXLz1f191jVGIghnHlxw/C9Ok=
   file:
     - "scrm-src.tar.gz"
+    - "scrm-x64-static"
     - "scrm-x64-static.tar.gz"
     - "scrm-win32.zip"
     - "scrm-win64.zip"
diff --git a/.travis/build_static_binaries.sh b/.travis/build_static_binaries.sh
index 4731b38..c220ad2 100755
--- a/.travis/build_static_binaries.sh
+++ b/.travis/build_static_binaries.sh
@@ -3,5 +3,6 @@
 # Build statically linked binaries
 CXXFLAGS="-O3" LDFLAGS='-static' ./configure || exit 1 
 make clean && make && \
-  tar -zcvf "scrm-x64-static.tar.gz" scrm doc/manual.html
+  tar -zcvf "scrm-x64-static.tar.gz" scrm doc/manual.html &&
+  cp scrm scrm-x64-static
 
diff --git a/NEWS.md b/NEWS.md
index 73781d2..2e5b8d9 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -1,6 +1,18 @@
 scrm Version History
 ========================
 
+scrm 1.7.2
+------------------------
+Released: 2016-04-10
+
+### Bug Fixes
++ Fixes a different bug that could occur when using the "-eI" option.
+  The contemporaries buffer was always cleared correctly between 
+  repetitions, and could cause scrm to throw an error (#104).
+  Thanks again to @jackkamm for reporting this bug.
+
+
+
 scrm 1.7.1
 ------------------------
 Released: 2016-03-23
@@ -12,6 +24,7 @@ Released: 2016-03-23
   and the time of the "-eI" event (if any), and neglect all events 
   during that time. We recommend to repeat all simulations which
   used "-eI" with the updated version (#102).
+  Thanks to @jackkamm for reporting this bug.
 
 
 
diff --git a/README.md b/README.md
index 4d2ad57..43aa6cd 100644
--- a/README.md
+++ b/README.md
@@ -1,3 +1,6 @@
+[![Project Status: Active - The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active)
+[![Build Status](https://travis-ci.org/scrm/scrm.svg?branch=master)](https://travis-ci.org/scrm/scrm)
+
 scrm
 ====
 
@@ -14,12 +17,7 @@ You can download the latest stable release packaged for a variety of different
 platform from [_scrm_'s homepage][1]. 
 Instructions on building the binary from the source packages are available in the [wiki][3].
 
-### Stable/Development Version From GitHub
-
-Version             | Branch | Build Status
-------------------- | ------ | -----------------
-Stable Version      | stable | [![Build Status](https://travis-ci.org/scrm/scrm.png?branch=stable)](https://travis-ci.org/scrm/scrm)
-Development Version | master | [![Build Status](https://travis-ci.org/scrm/scrm.png?branch=master)](https://travis-ci.org/scrm/scrm)
+### Development Version From GitHub
 
 You can also install `scrm` directly from the git repository. Here, you need to install `autoconf` first:  
 
@@ -39,7 +37,6 @@ Afterwards you can build the binary using
 make
 ```
 
-
 ## Usage
 We designed scrm to be compatible to the famous program `ms` from Richard R. Hudson. 
 You can use it as a drop in replacement for `ms` if you avoid the options `-c` and `-s`. 
diff --git a/configure.ac b/configure.ac
index f348720..35ed415 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([scrm], [1.7.1],[https://github.com/paulstaab/scrm/issues])
+AC_INIT([scrm], [1.7.2],[https://github.com/paulstaab/scrm/issues])
 AM_INIT_AUTOMAKE([subdir-objects -Wall -Werror foreign])
 
 # Use -O3 as default optimization level
diff --git a/doc/scrm.1 b/doc/scrm.1
index 272c6d9..0adc252 100644
--- a/doc/scrm.1
+++ b/doc/scrm.1
@@ -1,4 +1,4 @@
-.TH SCRM 1 "Mar 2015" "Version 1.4.0" 
+.TH SCRM 1 "April 2016" "Version 1.7.2" 
 .SH NAME
 scrm \- An accurate coalescent simulator for genome-scale sequences
 
diff --git a/src/contemporaries_container.h b/src/contemporaries_container.h
index 75ff36c..ff84caa 100644
--- a/src/contemporaries_container.h
+++ b/src/contemporaries_container.h
@@ -111,7 +111,7 @@ class ContemporariesContainer {
   void remove(Node *node);
   void replaceChildren(Node *add_node);
   void replace(Node *add_node, Node *del_node_1, Node *del_node_2 = NULL);
-  void clear();
+  void clear(const bool clear_buffer = true);
   void buffer(const double current_time);
 
   Node* sample(const size_t pop) const;
@@ -261,18 +261,24 @@ inline void ContemporariesContainer::replace(Node *add_node, Node *del_node_1, N
   if (!add_node->is_root()) add(add_node);
 }
 
-inline void ContemporariesContainer::clear() {
+
+inline void ContemporariesContainer::clear(const bool clear_buffer) {
   if (use_set_) {
-    for (auto it = contemporaries_set().begin(); it != contemporaries_set().end(); ++it) {
-      if ((*it).size() > 0) (*it).clear();
+    for (auto & pop_container : contemporaries_set()) pop_container.clear();
+    if (clear_buffer) {
+      for (auto & pop_container : buffer_set()) pop_container.clear();
     }
   } else {
-    for (auto it = contemporaries_vector().begin(); it != contemporaries_vector().end(); ++it) {
-      if ((*it).size() > 0) (*it).clear();
+    for (auto & pop_container : contemporaries_vector()) pop_container.clear(); 
+    if (clear_buffer) {
+      for (auto & pop_container : buffer_vector()) pop_container.clear();  
     }
   }
+  if (clear_buffer) buffer_time_ = DBL_MAX;
+  assert(this->empty());
 }
 
+
 inline size_t ContemporariesContainer::size(const size_t pop) const {
   if (use_set_) return contemporaries_set().at(pop).size();
   else return contemporaries_vector().at(pop).size();
@@ -292,7 +298,7 @@ inline size_t ContemporariesContainer::size(const size_t pop) const {
 inline void ContemporariesContainer::buffer(const double current_time) {
   buffer_time_ = current_time;
   use_first_ = 1 - use_first_;
-  this->clear();
+  this->clear(false);
 }
 
 // Uniformly samples a random node from the current contemporaries.
diff --git a/src/forest.cc b/src/forest.cc
index 3f02869..9db3404 100644
--- a/src/forest.cc
+++ b/src/forest.cc
@@ -288,6 +288,7 @@ void Forest::buildInitialTree() {
   assert(this->segment_count() == 0);
   assert(this->rec_bases_.size() == 1);
   assert(this->model().getCurrentSequencePosition() == 0.0);
+  assert(this->contemporaries()->empty());
   this->set_next_base(0.0);
   ++current_rec_;
 
@@ -313,7 +314,7 @@ void Forest::buildInitialTree() {
     if (new_leaf->height() == 0.0) last_added_node = new_leaf;
     dout << "* starting coalescences" << std::endl;
 
-    //Coalesces the separate tree into the main tree
+    // Coalesces the separate tree into the main tree
     this->sampleCoalescences(new_leaf);
     dout << "* * Tree:" << std::endl;
 
@@ -1260,6 +1261,7 @@ void Forest::clear() {
 
   // Clear nodes
   nodes()->clear();
+  contemporaries()->clear(true);
 
   // Reset Position & Segment Counts
   this->rec_bases_.clear();
diff --git a/src/summary_statistics/oriented_forest.h b/src/summary_statistics/oriented_forest.h
index c8b7bbf..ad382ef 100644
--- a/src/summary_statistics/oriented_forest.h
+++ b/src/summary_statistics/oriented_forest.h
@@ -43,6 +43,7 @@ class OrientedForest : public SummaryStatistic
   void printSegmentOutput(std::ostream &output) const;
   void clear() { }
 
+  double segment_length() const { return segment_length_; }
   std::vector<int> parents() const { return parents_; }
   std::vector<double> heights() const { return heights_; }
 
diff --git a/src/time_interval.cc b/src/time_interval.cc
index 61d9a57..012ad83 100644
--- a/src/time_interval.cc
+++ b/src/time_interval.cc
@@ -49,7 +49,7 @@ TimeIntervalIterator::TimeIntervalIterator(Forest *forest) {
   // Used only for unit testing, and hence private.
   this->forest_ = forest;
   this->contemporaries_ = &(forest->contemporaries_);
-  this->contemporaries_->clear();
+  this->contemporaries_->clear(false);
   this->node_iterator_ = forest->nodes()->iterator();
   this->good_ = false;
   this->inside_node_ = NULL;
@@ -142,7 +142,7 @@ void TimeIntervalIterator::next() {
 }
 
 void TimeIntervalIterator::searchContemporariesBottomUp(Node* node, const bool use_buffer) {
-  contemporaries()->clear();
+  contemporaries()->clear(false);
   Node* start_node = NULL;
 
   if ( use_buffer ) {
diff --git a/tests/test_binaries.sh b/tests/test_binaries.sh
index 807304b..88e8641 100755
--- a/tests/test_binaries.sh
+++ b/tests/test_binaries.sh
@@ -39,12 +39,15 @@ echo "Testing Initial Tree"
  test_scrm 3 100 -t 5 -L -oSFS -transpose-segsites || exit 1
  test_scrm 50 20 -O || exit 1
  test_scrm 25 1 -T || exit 1
+ test_scrm 10 5 -I 1 5 -eI 1.0 5 -L || exit 1
+ test_scrm 10 5 -I 2 2 2 0.5 -eI 1.0 3 3 -L || exit 1
 echo ""
 
 echo "Testing Recombinations"
- test_scrm 4 10 -r 5 100 || exit 1
- test_scrm 6 10 -r 1 100 -t 5 -L -T -transpose-segsites || exit 1
- test_scrm 8 10 -r 1 100 -t 5 -oSFS -O || exit 1
+ test_scrm 4 10 -r 5 100 -l -1 || exit 1
+ test_scrm 6 10 -r 1 100 -t 5 -L -T -transpose-segsites -l -1 || exit 1
+ test_scrm 8 10 -r 1 100 -t 5 -oSFS -O -l -1 || exit 1
+ test_scrm 10 5 -r 5 100 -I 2 2 2 0.5 -eI 1.0 3 3 -L -l -1 || exit 1
 echo ""
 
 echo "Testing Pruning"
@@ -52,6 +55,7 @@ echo "Testing Pruning"
  test_scrm 3 50 -r 10 500 -l 0 -t 1 -oSFS || exit 1
  test_scrm 10 20 -r 10 500 -l 2r -L || exit 1
  test_scrm 10 20 -r 1 500 -l -1 -T || exit 1
+ test_scrm 10 5 -r 5 100 -I 2 2 2 0.5 -eI 1.0 3 3 -L -l 2r || exit 1
 echo ""
 
 echo "Testing Migration"
@@ -88,6 +92,6 @@ echo ""
 echo "Various Edge Cases"
  test_scrm 6 1 -I 2 3 3 0.5 -r 1 100 -es 0 2 0.5 -ej 1 3 1 -t 1  || exit 1
  test_scrm 10 1 -es 1.0 1 0.5 -ej 1.0 2 1 || exit 1
- test_scrm 4 1 -t 1.0 -I 2 2 0 -ej 1.0 1 2 -eI 3.5 0 2
+ test_scrm 4 1 -t 1.0 -I 2 2 0 -ej 1.0 1 2 -eI 3.5 0 2 || exit 1
 echo ""
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/scrm.git



More information about the debian-med-commit mailing list