Skip to content

Commit

Permalink
Merged branch release-0.1.1 into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Cooke committed Oct 12, 2016
2 parents ed49746 + 1508a94 commit fa8fb11
Show file tree
Hide file tree
Showing 14 changed files with 346 additions and 259 deletions.
131 changes: 80 additions & 51 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,69 +1,98 @@
sudo: required
dist: trusty

language: cpp
language: generic
osx_image: xcode8

before_install:
install:
############################################################################
# All the Linux dependencies are installed in ${TRAVIS_BUILD_DIR}/deps/
############################################################################
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}

- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export DEBIAN_FRONTEND=noninteractive; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qy; fi

- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi

############################################################################
# Install CMake
############################################################################
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo add-apt-repository ppa:george-edison55/cmake-3.x -y;
sudo apt-get update -q;
sudo apt-get upgrade cmake -y;
sudo apt-get install python3 -y;
sudo apt-get upgrade libboost-all-dev -y;
git clone https://github.com/samtools/htslib.git;
cd htslib && autoheader && autoconf && ./configure && make && sudo make install;
CMAKE_URL="https://cmake.org/files/v3.6/cmake-3.6.2-Linux-x86_64.tar.gz";
mkdir -p cmake && travis_retry wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tar --strip-components=1 -xz -C cmake;
export PATH=${DEPS_DIR}/cmake/bin:${PATH};
else
brew outdated cmake || brew upgrade cmake;
fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
brew update;
brew outdated cmake || upgrade cmake;

############################################################################
# Install Boost
############################################################################
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
BOOST_VERSION=trunk;
BOOST_DIR=${DEPS_DIR}/boost-${BOOST_VERSION};
BOOST_URL="http://github.com/boostorg/boost.git";
travis_retry git clone --depth 1 --recursive --quiet ${BOOST_URL} ${BOOST_DIR} || exit 1;
cd ${BOOST_DIR} && ./bootstrap.sh && ./b2 headers;
cd ${BOOST_DIR}/tools/build && ./bootstrap.sh && ./b2 install --prefix=${DEPS_DIR}/b2;
export PATH=${DEPS_DIR}/b2/bin:${PATH};
fi

############################################################################
# Install Python3
############################################################################
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
sudo apt-get install python3 -qy;
else
brew install python3;
brew outdated boost || upgrade boost;
fi

############################################################################
# Install htslib
############################################################################
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
git clone https://github.com/samtools/htslib.git;
cd htslib && autoheader && autoconf && ./configure && make && sudo make install;
else
brew tap homebrew/science;
brew install htslib;
fi

matrix:
include:
- os: linux
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
env: COMPILER=g++-6
- os: linux
compiler: clang
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
env: COMPILER=clang++-3.8
# - os: linux
# compiler: gcc
# addons:
# apt:
# sources:
# - ubuntu-toolchain-r-test
# packages:
# - g++-6
# env: COMPILER=g++
# - os: linux
# compiler: clang
# addons:
# apt:
# sources:
# - ubuntu-toolchain-r-test
# - llvm-toolchain-precise-3.8
# packages:
# - clang-3.8
# env: COMPILER=clang++
- os: osx
compiler: clang
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
install: export PATH=/usr/local/clang/bin:$PATH
env: COMPILER=clang++-3.8
- os: osx
compiler: gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-6
env: COMPILER=g++-6
before_install:
- brew install --with-clang llvm
- brew outdated boost || brew upgrade boost
env: COMPILER=clang++

before_script:
- cd "${TRAVIS_BUILD_DIR}"

script:
- ./install.py --compiler=$COMPILER
- ./install.py --compiler=$COMPILER

notifications:
email: false
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Octopus Logo](logo.png)

[![Build Status](https://travis-ci.com/luntergroup/octopus.svg?token=U9L3a7MWio2P3XpPT3JV&branch=master)](https://travis-ci.com/luntergroup/octopus)
[![Build Status](https://travis-ci.org/luntergroup/octopus.svg?branch=master)](https://travis-ci.org/luntergroup/octopus)
[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT)
[![Gitter](https://badges.gitter.im/octopus-caller/Lobby.svg)](https://gitter.im/octopus-caller/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)

Expand Down
3 changes: 2 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ set(BASICS_SOURCES
basics/aligned_read.hpp
basics/aligned_read.cpp
basics/mappable_reference_wrapper.hpp
)
basics/ploidy_map.hpp
basics/ploidy_map.cpp)

set(CONTAINERS_SOURCES
containers/mappable_flat_multi_set.hpp
Expand Down
46 changes: 46 additions & 0 deletions src/basics/ploidy_map.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) 2016 Daniel Cooke
// Use of this source code is governed by the MIT license that can be found in the LICENSE file.

#include "ploidy_map.hpp"

#include <iterator>

namespace octopus {

PloidyMap::PloidyMap(unsigned organism)
: organism_ {organism}
{}

void PloidyMap::set(const ContigName& contig, unsigned ploidy)
{
contigs_.emplace(contig, ploidy);
}

void PloidyMap::set(const SampleName& sample, const ContigName& contig, unsigned ploidy)
{
sample_contigs_[sample].emplace(contig, ploidy);
}

unsigned PloidyMap::organism() const noexcept
{
return organism_;
}

unsigned PloidyMap::operator()(const SampleName& sample, const ContigName& contig) const noexcept
{
const auto sample_itr = sample_contigs_.find(sample);
if (sample_itr != std::cend(sample_contigs_)) {
const auto contig_itr = sample_itr->second.find(contig);
if (contig_itr != std::cend(sample_itr->second)) {
return contig_itr->second;
}
} else {
const auto contig_itr = contigs_.find(contig);
if (contig_itr != std::cend(contigs_)) {
return contig_itr->second;
}
}
return organism_;
}

} // namespace octopus
41 changes: 41 additions & 0 deletions src/basics/ploidy_map.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright (c) 2016 Daniel Cooke
// Use of this source code is governed by the MIT license that can be found in the LICENSE file.

#ifndef ploidy_map_hpp
#define ploidy_map_hpp

#include <unordered_map>

#include "config/common.hpp"

namespace octopus {

class PloidyMap
{
public:
PloidyMap(unsigned organism = 2);

PloidyMap(const PloidyMap&) = default;
PloidyMap& operator=(const PloidyMap&) = default;
PloidyMap(PloidyMap&&) = default;
PloidyMap& operator=(PloidyMap&&) = default;

~PloidyMap() = default;

void set(const SampleName& sample, const ContigName& contig, unsigned ploidy);
void set(const ContigName& contig, unsigned ploidy);

unsigned organism() const noexcept;
unsigned operator()(const SampleName& sample, const ContigName& contig) const noexcept;

private:
using ContigPloidyMap = std::unordered_map<ContigName, unsigned>;

unsigned organism_;
ContigPloidyMap contigs_;
std::unordered_map<SampleName, ContigPloidyMap> sample_contigs_;
};

} // namespace octopus

#endif
Loading

0 comments on commit fa8fb11

Please sign in to comment.