Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
Fixes for #228 and #229. Many thanks
to @knokknok for helping find and resolve
these bugs.
  • Loading branch information
Rob Patro committed Jun 1, 2018
2 parents ec23567 + 9f1fce1 commit 6126f9a
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 62 deletions.
119 changes: 78 additions & 41 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,52 +1,29 @@
#whitelist
sudo: required
dist: precise

branches:
only:
- master
- develop

sudo: false
language: cpp

compiler: gcc

addons:
apt:
sources:
- boost-latest
- kalakris-cmake
- ubuntu-toolchain-r-test
- george-edison55-precise-backports
packages:
- cmake
- cmake-data
- gcc-4.9
- g++-4.9

before_install:
# - echo "yes" | sudo apt-add-repository ppa:boost-latest
# - echo "yes" | sudo apt-add-repository ppa:mapnik/boost-backports-1-54
# - echo "yes" | sudo apt-add-repository ppa:h-rayflood/gcc-upper
# - echo "yes" | sudo add-apt-repository ppa:george-edison55/precise-backports
# - sudo apt-get clean -qq
# - sudo apt-get update -qq
# - sudo apt-mark showhold -qq
# - sudo apt-get install -qq cmake
# - sudo apt-get install -qq gcc-4.9 g++-4.9
- export CC="gcc-4.9"
- export CXX="gcc-4.9"
- sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50
- sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 50
matrix:
include:
- os : linux
compiler : gcc-7
addons:
apt:
sources: ['ubuntu-toolchain-r-test']
packages: ['g++-7', 'gcc-7', 'cmake', 'cmake-data', 'zlib1g-dev', 'libbz2-dev']

install:
- export CXX="g++-4.9"
- export CC="gcc-4.9"
- export CXX="g++-7"
- export CC="gcc-7"
- mkdir -p latest-gcc-symlinks
- ln -s /usr/bin/g++-7 latest-gcc-symlinks/g++
- ln -s /usr/bin/gcc-7 latest-gcc-symlinks/gcc
- export PATH=$PWD/latest-gcc-symlinks:$PATH
- export AR=gcc-ar-7
- export RANLIB=gcc-ranlib-7

script:
- mkdir build
- cd build
- cmake -DCONDA_BUILD=TRUE -DFETCH_BOOST=TRUE -DNO_RTM=TRUE ..
- cmake -DFETCH_BOOST=TRUE -DNO_RTM=TRUE ..
- travis_wait 45 make
- travis_wait make install
- travis_wait make test VERBOSE=1
Expand All @@ -57,3 +34,63 @@ after_success:

after_failure:
- cat $TRAVIS_BUILD_DIR/build/Testing/Temporary/LastTest.log

#whitelist
#sudo: required
#dist: precise
#
#branches:
# only:
# - master
# - develop
#
#language: cpp
#
#compiler: gcc
#
#addons:
# apt:
# sources:
# - boost-latest
# - kalakris-cmake
# - ubuntu-toolchain-r-test
# - george-edison55-precise-backports
# packages:
# - cmake
# - cmake-data
# - gcc-4.9
# - g++-4.9
#
#before_install:
## - echo "yes" | sudo apt-add-repository ppa:boost-latest
## - echo "yes" | sudo apt-add-repository ppa:mapnik/boost-backports-1-54
## - echo "yes" | sudo apt-add-repository ppa:h-rayflood/gcc-upper
## - echo "yes" | sudo add-apt-repository ppa:george-edison55/precise-backports
## - sudo apt-get clean -qq
## - sudo apt-get update -qq
## - sudo apt-mark showhold -qq
## - sudo apt-get install -qq cmake
## - sudo apt-get install -qq gcc-4.9 g++-4.9
# - export CC="gcc-4.9"
# - export CXX="gcc-4.9"
# - sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50
# - sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 50
#
#install:
# - export CXX="g++-4.9"
# - export CC="gcc-4.9"
#
#script:
# - mkdir build
# - cd build
# - cmake -DCONDA_BUILD=TRUE -DFETCH_BOOST=TRUE -DNO_RTM=TRUE ..
# - travis_wait 45 make
# - travis_wait make install
# - travis_wait make test VERBOSE=1
#
#after_success:
# - cd $TRAVIS_BUILD_DIR
# - ./scripts/push-binary.sh
#
#after_failure:
# - cat $TRAVIS_BUILD_DIR/build/Testing/Temporary/LastTest.log
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ enable_testing()

project (Salmon)

set(CPACK_PACKAGE_VERSION "0.10.0")
set(CPACK_PACKAGE_VERSION "0.10.1")
set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "10")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(CPACK_PACKAGE_VERSION_PATCH "1")
set(PROJECT_VERSION ${CPACK_PACKAGE_VERSION})
set(CPACK_GENERATOR "TGZ")
set(CPACK_SOURCE_GENERATOR "TGZ")
Expand All @@ -33,6 +33,7 @@ set (WARNING_IGNORE_FLAGS "")
endif()

if(CONDA_BUILD)
message("Building with CONDA_BUILD flag")
set (CXXSTDFLAG "-std=c++11")
set (GCCVERSION "4.8.5")
else ()
Expand Down
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MAINTAINER [email protected]

ENV PACKAGES git gcc make g++ cmake libboost-all-dev liblzma-dev libbz2-dev \
ca-certificates zlib1g-dev curl unzip autoconf
ENV SALMON_VERSION 0.10.0
ENV SALMON_VERSION 0.10.1

# salmon binary will be installed in /home/salmon/bin/salmon

Expand Down
2 changes: 1 addition & 1 deletion docker/build_test.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#! /bin/bash
docker build -t combinelab/salmon:0.10.0 .
docker build -t combinelab/salmon:0.10.1 .
4 changes: 2 additions & 2 deletions include/SalmonConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@
namespace salmon {
constexpr char majorVersion[] = "0";
constexpr char minorVersion[] = "10";
constexpr char patchVersion[] = "0";
constexpr char version[] = "0.10.0";
constexpr char patchVersion[] = "1";
constexpr char version[] = "0.10.1";
constexpr uint32_t indexVersion = 2;
constexpr char requiredQuasiIndexVersion[] = "q5";
} // namespace salmon
Expand Down
6 changes: 2 additions & 4 deletions scripts/fetchRapMap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ if [ -d ${INSTALL_DIR}/src/rapmap ] ; then
rm -fr ${INSTALL_DIR}/src/rapmap
fi

SVER=salmon-v0.10.0
SVER=salmon-v0.10.1
#SVER=develop-salmon

mkdir -p ${EXTERNAL_DIR}
#curl -k -L https://github.com/COMBINE-lab/RapMap/archive/salmon-v0.8.2.zip -o ${EXTERNAL_DIR}/rapmap.zip
curl -k -L https://github.com/COMBINE-lab/RapMap/archive/${SVER}.zip -o ${EXTERNAL_DIR}/rapmap.zip
#curl -k -L https://github.com/COMBINE-lab/RapMap/archive/develop-salmon.zip -o ${EXTERNAL_DIR}/rapmap.zip

hashcheck=""
if exists sha256sum; then
Expand All @@ -42,7 +40,7 @@ fi
if [ -z "${hashcheck-}" ]; then
echo "Couldn't find shasum command; can't verify contents of downloaded RapMap";
else
echo "c45140a8efc9258a1d52121c0f00e7ebb00c9165cf47bd52493540639d7a6d9b ${EXTERNAL_DIR}/rapmap.zip" | ${hashcheck} -c - || { echo "rapmap.zip did not match expected SHA1! Exiting."; exit 1; }
echo "fca1323154b884a81bd61e3bdda06502fd3593f1622ad3b2dc98ef14dc4e6b6a ${EXTERNAL_DIR}/rapmap.zip" | ${hashcheck} -c - || { echo "rapmap.zip did not match expected SHA1! Exiting."; exit 1; }
#echo "not testing sha in develop branch"
fi

Expand Down
25 changes: 14 additions & 11 deletions src/CollapsedEMOptimizer.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include <atomic>
#include <unordered_map>
#include <vector>
#include <exception>

#include "tbb/blocked_range.h"
#include "tbb/parallel_for.h"
Expand Down Expand Up @@ -32,10 +33,11 @@

using BlockedIndexRange = tbb::blocked_range<size_t>;

// intelligently chosen value adopted from
// intelligently chosen value originally adopted from
// https://github.com/pachterlab/kallisto/blob/master/src/EMAlgorithm.h#L18
constexpr double minEQClassWeight = std::numeric_limits<double>::denorm_min();
constexpr double minWeight = std::numeric_limits<double>::denorm_min();
// later modified since denorm_min seems to be too permissive.
constexpr double minEQClassWeight = std::numeric_limits<double>::min();
constexpr double minWeight = std::numeric_limits<double>::min();
// A bit more conservative of a minimum as an argument to the digamma function.
constexpr double digammaMin = 1e-10;

Expand All @@ -46,7 +48,7 @@ double normalize(std::vector<tbb::atomic<double>>& vec) {
}

// too small!
if (sum < minWeight) {
if (sum < ::minWeight) {
return sum;
}

Expand Down Expand Up @@ -121,7 +123,8 @@ void VBEMUpdate_(std::vector<std::vector<uint32_t>>& txpGroupLabels,
for (size_t i = 0; i < M; ++i) {
auto ap = alphaIn[i] + priorAlphas[i];
if (ap > ::digammaMin) {
expTheta[i] = std::exp(boost::math::digamma(ap) - logNorm);
expTheta[i] =
std::exp(boost::math::digamma(ap) - logNorm);
} else {
expTheta[i] = 0.0;
}
Expand Down Expand Up @@ -347,7 +350,7 @@ size_t markDegenerateClasses(
<< ", aux = " << aux << "\n";
}
}
if (denom <= minEQClassWeight) {
if (denom <= ::minEQClassWeight) {
fmt::MemoryWriter errstream;

errstream << "\nDropping weighted eq class\n";
Expand Down Expand Up @@ -509,7 +512,7 @@ bool doBootstrap(
alphaSum = truncateCountVector(alphas, cutoff);
}

if (alphaSum < minWeight) {
if (alphaSum < ::minWeight) {
jointLog->error("Total alpha weight was too small! "
"Make sure you ran salmon correclty.");
return false;
Expand Down Expand Up @@ -784,8 +787,8 @@ bool CollapsedEMOptimizer::optimize(ExpT& readExp, SalmonOpts& sopt,
// a linear combination of the online estimates
// and the uniform distribution.
double uniformPrior = totalWeight / static_cast<double>(numActive);
// double fracObserved = 1.0;
double fracObserved = std::min(1.0, totalWeight / sopt.numRequiredFragments);
double maxFrac = 0.999;
double fracObserved = std::min(maxFrac, totalWeight / sopt.numRequiredFragments);
// Above, we placed the uniformative (uniform) initalization into the
// alphasPrime variables. If that's what the user requested, then copy those
// over to the alphas
Expand Down Expand Up @@ -961,7 +964,7 @@ bool CollapsedEMOptimizer::optimize(ExpT& readExp, SalmonOpts& sopt,
}

/* -- v0.8.x
if (alphaSum < minWeight) {
if (alphaSum < ::minWeight) {
jointLog->error("Total alpha weight was too small! "
"Make sure you ran salmon correclty.");
return false;
Expand All @@ -986,7 +989,7 @@ bool CollapsedEMOptimizer::optimize(ExpT& readExp, SalmonOpts& sopt,
alphaSum = truncateCountVector(alphas, cutoff);
}

if (alphaSum < minWeight) {
if (alphaSum < ::minWeight) {
jointLog->error("Total alpha weight was too small! "
"Make sure you ran salmon correclty.");
return false;
Expand Down

0 comments on commit 6126f9a

Please sign in to comment.