Skip to content

Commit

Permalink
Merge pull request #291 from nickjcroucher/master
Browse files Browse the repository at this point in the history
Upgrade to version 3.0
  • Loading branch information
Christoph Püthe authored Jan 27, 2021
2 parents 69da2fa + e851a7d commit 21d70c8
Show file tree
Hide file tree
Showing 41 changed files with 2,886 additions and 783 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
on:
push:
branches:
- master

name: Push test

jobs:

test-osx:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies with conda
run: |
sudo chown -R $UID $CONDA && source $CONDA/etc/profile.d/conda.sh && conda env update --file environment.yml
- name: Install subunit from source
run: |
source $CONDA/etc/profile.d/conda.sh && conda activate gubbins_env && export LDFLAGS="-L${CONDA_PREFIX}/lib/ -Wl,-rpath,${CONDA_PREFIX}/lib/" && export CFLAGS="-I${CONDA_PREFIX}/include/" && export CPPUNIT_CFLAGS="-I${CONDA_PREFIX}/include/" && export CPPUNIT_LIBS="-L${CONDA_PREFIX}/lib/" && git clone https://github.com/testing-cabal/subunit.git && cd subunit && autoreconf -vi && CXXFLAGS="${CXXFLAGS} -I${CONDA_PREFIX}/include/" LDFLAGS="${LDFLAGS} -L${CONDA_PREFIX}/lib/ -lcppunit" ./configure --prefix=$CONDA_PREFIX && sudo make install && cd ..
- name: Run C++ and python tests
run: |
source $CONDA/etc/profile.d/conda.sh && conda activate gubbins_env && export PATH=$PATH:/lib/python3.9/site-packages/ && conda install pytest-cov && autoreconf -i && ./configure --prefix=$CONDA_PREFIX --exec_prefix $CONDA_PREFIX --enable-maintainer-mode CFLAGS="-O0 --coverage -I${CONDA_PREFIX}/include/" LDFLAGS="-L${CONDA_PREFIX}/lib/ -Wl,-rpath,${CONDA_PREFIX}/lib/" --host=x86_64-apple-darwin --build=x86_64-apple-darwin && make && sudo make install && make check
test-linux:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies with conda
run: |
$CONDA/bin/conda env update --file environment.yml && conda init
- name: Install subunit from source
run: |
source $CONDA/etc/profile.d/conda.sh && conda activate gubbins_env && export LDFLAGS="-L${CONDA_PREFIX}/lib/ -Wl,-rpath,${CONDA_PREFIX}/lib/" && export CFLAGS="-I${CONDA_PREFIX}/include/" && export CPPUNIT_CFLAGS="-I${CONDA_PREFIX}/include/" && export CPPUNIT_LIBS="-L${CONDA_PREFIX}/lib/" && git clone https://github.com/testing-cabal/subunit.git && cd subunit && autoreconf -vi && CXXFLAGS="${CXXFLAGS} -I${CONDA_PREFIX}/include/" LDFLAGS="${LDFLAGS} -L${CONDA_PREFIX}/lib/ -lcppunit" ./configure --prefix=$CONDA_PREFIX && sudo make install && cd ..
- name: Run C++ and python tests
run: |
source $CONDA/etc/profile.d/conda.sh && conda activate gubbins_env && export PATH=$PATH:/lib/python3.9/site-packages/ && conda install pytest-cov && autoreconf -i && ./configure --prefix=$CONDA_PREFIX --exec_prefix $CONDA_PREFIX --enable-maintainer-mode CFLAGS="-O0 --coverage -I${CONDA_PREFIX}/include/" LDFLAGS="-L${CONDA_PREFIX}/lib/ -Wl,-rpath,${CONDA_PREFIX}/lib/" --host=x86_64-linux-gnu --build=x86_64-linux-gnu && make && sudo make install && make check
- name: Upload python code coverage analysis
run: |
bash <(curl -s https://codecov.io/bash)
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

33 changes: 28 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,18 @@ RUN pip3 install certifi \
&& pip3 install nose \
&& pip3 install pillow \
&& pip3 install dendropy \
&& pip3 install biopython

# Install RAxML
&& pip3 install biopython \
&& pip3 install functools \
&& pip3 install multiprocess

# Get tree builder versions
ARG raxml_version='8.2.12'
ARG fasttree_version='2.1.11'
ARG iqtree_version='2.0.3'
ARG raxmlng_version='1.0.1'
ARG rapidnj_version='2.3.2'

# Install RAxML
RUN curl -L https://github.com/stamatak/standard-RAxML/archive/v${raxml_version}.tar.gz -o standard-RAxML-${raxml_version}.tar.gz \
&& tar xzf standard-RAxML-${raxml_version}.tar.gz \
&& cd standard-RAxML-${raxml_version} \
Expand All @@ -46,19 +54,31 @@ RUN curl -L https://github.com/stamatak/standard-RAxML/archive/v${raxml_version}
&& rm -rf standard-RAxML-${raxml_version}

# Install FastTree
ARG fasttree_version='2.1.10'
RUN curl http://www.microbesonline.org/fasttree/FastTree-${fasttree_version}.c -o FastTree.c \
&& gcc -O3 -finline-functions -funroll-loops -Wall -o FastTree FastTree.c -lm \
&& mv FastTree /usr/local/bin/ \
&& rm FastTree.c

# Install IQTree
ARG iqtree_version='1.6.6'
RUN curl -L https://github.com/Cibiv/IQ-TREE/releases/download/v${iqtree_version}/iqtree-${iqtree_version}-Linux.tar.gz -o iqtree-${iqtree_version}-Linux.tar.gz \
&& tar xzf iqtree-${iqtree_version}-Linux.tar.gz \
&& cp iqtree-${iqtree_version}-Linux/bin/iqtree /usr/local/bin \
&& rm -rf iqtree-${iqtree_version}-Linux

# Install RAxML-NG
RUN curl https://github.com/amkozlov/raxml-ng/releases/download/${raxmlng_version}/raxml-ng_v${raxmlng_version}_linux_x86_64.zip \
&& unzip raxml-ng_v${raxmlng_version}_linux_x86_64.zip \
&& cp raxml-ng /usr/local/bin

# Install RapidNJ
RUN curl https://github.com/johnlees/rapidnj/archive/${rapidnj_version}.zip \
&& unzip ${rapidnj_version}.zip \
&& cd rapidnj-${rapidnj_version} \
&& make \
&& cp bin/rapidnj /usr/local/bin \
&& cd .. \
&& rm -rf rapidnj-${rapidnj_version}

# Install Gubbins
ENV BUILD_DIR /opt/gubbins
RUN mkdir -p ${BUILD_DIR}
Expand All @@ -71,3 +91,6 @@ RUN cd ${BUILD_DIR} \
&& make install \
&& cd python \
&& python3 setup.py install

# Remove downloaded files
RUN rm standard-RAxML-${raxml_version}.tar.gz iqtree-${iqtree_version}-Linux.tar.gz iqtree-${iqtree_version}-Linux.tar.gz raxml-ng_v${raxmlng_version}_linux_x86_64.zip ${rapidnj_version}.zip
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.1
3.0.0
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ PKG_CHECK_MODULES([zlib], [zlib])
AC_CHECK_HEADERS([zlib.h math.h])

# Check for Python
AM_PATH_PYTHON([3.0],
AM_PATH_PYTHON([3.8],
[],
[AC_MSG_WARN([Python not found. Python is required to build presage python binding. Python can be obtained from http://www.python.org])])

Expand Down
32 changes: 32 additions & 0 deletions environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: gubbins_env
channels:
- conda-forge
- bioconda
- defaults
- r
dependencies:
# python
- python>=3.8
# installation
- autoconf
- automake
- pytest
- check
- libtool
- cppunit
- pkg-config
- wheel
- nose
- pillow
# algorithm
- scipy
- dendropy
- biopython
- multiprocess
- numpy
# phylogenetics
- raxml=8.2.12
- iqtree=2.0.3
- rapidnj
- raxml-ng=1.0.1
- fasttree=2.1.10
76 changes: 68 additions & 8 deletions install_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,57 @@ set -e

start_dir=$(pwd)

# Determine OS type
OS="Linux"
if [[ $OSTYPE == "darwin"* ]]; then
OS="OSX"
fi

# Alias wget on OSX
if [[ $OS == "OSX" ]]; then
function _wget() { curl "${1}" -o $(basename "${1}") ; };
alias wget='_wget'
fi

# Get tree builder options
RAXML_VERSION="8.2.12"
FASTTREE_VERSION="2.1.10"
IQTREE_VERSION="1.6.6"
FASTTREE_VERSION="2.1.11"
IQTREE_VERSION="2.0.3"
RAXMLNG_VERSION="1.0.1"
RAPIDNJ_VERSION="2.3.2"

RAXML_DIR="standard-RAxML-$RAXML_VERSION"
RAXML_ZIP_FILE="$RAXML_DIR.tar.gz"

IQTREE_DIR="iqtree-$IQTREE_VERSION-Linux"
IQTREE_ZIP_FILE="$IQTREE_DIR.tar.gz"
IQTREE_DIR=""
IQTREE_ZIP_FILE=""
if [[ $OS == "Linux" ]]; then
IQTREE_DIR="iqtree-$IQTREE_VERSION-Linux"
IQTREE_ZIP_FILE="$IQTREE_DIR.tar.gz"
elif [[ $OS == "OSX" ]]; then
IQTREE_DIR="iqtree-$IQTREE_VERSION-MacOSX"
IQTREE_ZIP_FILE="$IQTREE_DIR.zip"
fi

FASTTREE_DIR="FastTree-$FASTTREE_VERSION"
FASTTREE_SOURCE="$FASTTREE_DIR.c"

RAXMLNG_DIR="raxmlng_dir"
RAXMLNG_ZIP_FILE=""
if [[ $OS == "Linux" ]]; then
RAXMLNG_ZIP_FILE="raxml-ng_v${RAXMLNG_VERSION}_linux_x86_64.zip"
elif [[ $OS == "OSX" ]]; then
RAXMLNG_ZIP_FILE="raxml-ng_v${RAXMLNG_VERSION}_macos_x86_64.zip"
fi

RAPIDNJ_DIR="rapidnj-$RAPIDNJ_VERSION"
RAPIDNJ_ZIP_FILE="$RAPIDNJ_VERSION.zip"

RAXML_DOWNLOAD_URL="https://github.com/stamatak/standard-RAxML/archive/v$RAXML_VERSION.tar.gz"
FASTTREE_DOWNLOAD_URL="http://www.microbesonline.org/fasttree/$FASTTREE_SOURCE"
IQTREE_DOWNLOAD_URL="https://github.com/Cibiv/IQ-TREE/releases/download/v$IQTREE_VERSION/$IQTREE_ZIP_FILE"
RAXMLNG_DOWNLOAD_URL="https://github.com/amkozlov/raxml-ng/releases/download/$RAXMLNG_VERSION/$RAXMLNG_ZIP_FILE"
RAPIDNJ_DOWNLOAD_URL="https://github.com/johnlees/rapidnj/archive/$RAPIDNJ_ZIP_FILE"

# Make an install location
if [ ! -d 'build' ]; then
Expand All @@ -45,11 +80,11 @@ download () {
download $RAXML_DOWNLOAD_URL $RAXML_ZIP_FILE
download $FASTTREE_DOWNLOAD_URL $FASTTREE_SOURCE
download $IQTREE_DOWNLOAD_URL $IQTREE_ZIP_FILE
download $RAXMLNG_DOWNLOAD_URL $RAXMLNG_ZIP_FILE
download $RAPIDNJ_DOWNLOAD_URL $RAPIDNJ_ZIP_FILE

# Update dependencies
if [ "$TRAVIS" = 'true' ]; then
echo "Using Travis's apt plugin"
else
if [[ "$OS" == 'Linux' ]]; then
sudo apt-get update -q
sudo apt-get install -y -q autoconf \
check \
Expand Down Expand Up @@ -94,13 +129,36 @@ fi
## IQTree
cd $build_dir
if [ ! -d $IQTREE_DIR ]; then
tar xzf $IQTREE_ZIP_FILE
if [[ $OS == "Linux" ]]; then
tar xzf $IQTREE_ZIP_FILE
elif [[ $OS == "OSX" ]]; then
unzip $IQTREE_ZIP_FILE
fi
fi
cd $IQTREE_DIR
if [ -e "bin/iqtree" ]; then
cp bin/iqtree iqtree
fi

## RAxML-NG
cd $build_dir
if [ ! -d $RAXMLNG_DIR ]; then
mkdir $RAXMLNG_DIR
fi
unzip $RAXMLNG_ZIP_FILE
mv raxml-ng $RAXMLNG_DIR

## RapidNJ
cd $build_dir
if [ ! -d $RAPIDNJ_DIR ]; then
unzip $RAPIDNJ_ZIP_FILE
fi
cd $RAPIDNJ_DIR
make
if [ -e "bin/rapidnj" ]; then
cp bin/rapidnj rapidnj
fi

# Setup environment variables
update_path () {
new_dir=$1
Expand All @@ -112,6 +170,8 @@ update_path () {
update_path $build_dir/$RAXML_DIR
update_path $build_dir/$FASTTREE_DIR
update_path $build_dir/$IQTREE_DIR
update_path $build_dir/$RAXMLNG_DIR
update_path $build_dir/$RAPIDNJ_DIR

cd $start_dir

Expand Down
4 changes: 2 additions & 2 deletions python/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
EXTRA_DIST=gubbins/* setup.py scripts/*
EXTRA_DIST=gubbins/*

all-local:
${PYTHON} setup.py build
Expand All @@ -14,4 +14,4 @@ clean-local:
$(PYTHON) setup.py clean --all

check-local:
$(PYTHON) setup.py test
pytest --cov=gubbins gubbins/tests/
1 change: 1 addition & 0 deletions python/VERSION
5 changes: 1 addition & 4 deletions python/gubbins/ValidateFastaAlignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ def does_each_sequence_have_a_name_and_genomic_data(self):
if re.search('[^ACGTNacgtn-]', str(record.seq)) != None:
print("Error with the input FASTA file: One of the sequences contains odd characters, only ACGTNacgtn- are permitted")
return False
if number_of_sequences <= 3:
print("Error with input FASTA file: you need more than 3 sequences to build a meaningful tree")
return False
input_handle.close()
return True

Expand Down Expand Up @@ -79,4 +76,4 @@ def are_sequence_names_unique(self):
return False
input_handle.close()
return True


24 changes: 15 additions & 9 deletions python/gubbins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import sys
import os
import pkg_resources

###############################################################################
## Populate the 'gubbins' namespace
Expand All @@ -18,7 +19,6 @@
## PACKAGE METADATA

__project__ = "Gubbins"
__version__ = "0.1"

try:
try:
Expand All @@ -32,8 +32,8 @@
except:
__homedir__ = None

__author__ = "Andrew J. Page, Nicholas Croucher, Aidan Delaney and Simon Harris"
__copyright__ = "Copyright 2013 Wellcome Trust Sanger Institutue"
__author__ = "Andrew Page, Nicholas Croucher, Aidan Delaney, Christoph Puethe and Simon Harris"
__copyright__ = "Copyright 2020 Wellcome Trust Sanger Institute and Imperial College London"
__license__ = """
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
Expand All @@ -49,14 +49,20 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""
PACKAGE_VERSION = __version__

def version():
os.environ["PATH"] = os.environ["PATH"] + ":/usr/lib/gubbins/"
program_version = ""
try:
program_version = str(pkg_resources.get_distribution(__project__).version)
except pkg_resources.RequirementParseError:
pass
return "%s" % program_version

__version__ = version()

def description():
if __revision__.is_available:
revision_text = " (%s)" % str(__revision__)
else:
revision_text = ""
return "%s %s%s" % (__project__, __version__, revision_text)
return "%s %s" % (__project__, version())

if __name__ == "__main__":
sys.stdout.write("%s\n" % description())
Expand Down
Loading

0 comments on commit 21d70c8

Please sign in to comment.