Skip to content

Commit

Permalink
Update github action; import future annotations in test scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
chtsai0105 committed Apr 25, 2024
1 parent e303a58 commit 2ac8cd4
Show file tree
Hide file tree
Showing 15 changed files with 181 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-aster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- name: Cache ASTER
id: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.local/bin/astral
key: ${{ runner.os }}-ASTER
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-fasttree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- name: Cache FastTree
id: cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.local/bin/FastTree
key: ${{ runner.os }}-FastTree
Expand Down
36 changes: 36 additions & 0 deletions .github/workflows/build-iqtree.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build IQTree

on: workflow_call

jobs:
build_IQTree:
name: Build IQTree
runs-on: ubuntu-latest

steps:
- name: Cache IQTree
id: cache
uses: actions/cache@v4
with:
path: ~/.local/bin/iqtree2
key: ${{ runner.os }}-IQTree

- name: Download IQTree executable
if: steps.cache.outputs.cache-hit != 'true'
run: |
sudo apt-get install wget
wget https://github.com/iqtree/iqtree2/releases/download/v2.3.2/iqtree-2.3.2-Linux-intel.tar.gz
tar zxf iqtree-2.3.2-Linux-intel.tar.gz
- name: Move executable
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: |
mkdir -p ~/.local/bin
cp iqtree-2.3.2-Linux-intel/bin/iqtree2 ~/.local/bin/
chmod +x ~/.local/bin/iqtree2
- name: Export IQTree to PATH and verify
run: |
export PATH=$PATH:$HOME/.local/bin
which iqtree2
36 changes: 36 additions & 0 deletions .github/workflows/build-muscle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Build muscle

on: workflow_call

jobs:
build_muscle:
name: Build muscle
runs-on: ubuntu-latest

steps:
- name: Cache muscle
id: cache
uses: actions/cache@v4
with:
path: ~/.local/bin/muscle
key: ${{ runner.os }}-muscle

- name: Download muscle executable
if: steps.cache.outputs.cache-hit != 'true'
run: |
sudo apt-get install wget
wget https://github.com/rcedgar/muscle/releases/download/5.1.0/muscle5.1.linux_intel64
mv muscle5.1.linux_intel64 muscle
- name: Move executable
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: |
mkdir -p ~/.local/bin
cp muscle ~/.local/bin/
chmod +x ~/.local/bin/muscle
- name: Export muscle to PATH and verify
run: |
export PATH=$PATH:$HOME/.local/bin
which muscle
41 changes: 41 additions & 0 deletions .github/workflows/build-raxml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Build RAxML

on: workflow_call

jobs:
build_RAxML:
name: Build RAxML
runs-on: ubuntu-latest

steps:
- name: Cache RAxML
id: cache
uses: actions/cache@v4
with:
path: ~/.local/bin/raxmlHPC-PTHREADS-AVX2
key: ${{ runner.os }}-RAxML

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: sudo apt-get install build-essential g++ wget unzip

- name: Compile RAxML
if: steps.cache.outputs.cache-hit != 'true'
run: |
wget https://github.com/stamatak/standard-RAxML/archive/refs/tags/v8.2.13.zip
unzip v8.2.13.zip
cd standard-RAxML-8.2.13
make -f Makefile.AVX2.PTHREADS.gcc
- name: Move executable
if: steps.cache.outputs.cache-hit != 'true'
working-directory: ${{ github.workspace }}
run: |
mkdir -p ~/.local/bin
cp standard-RAxML-8.2.13/raxmlHPC-PTHREADS-AVX2 ~/.local/bin/
chmod +x ~/.local/bin/raxmlHPC-PTHREADS-AVX2
- name: Export RAxML to PATH and verify
run: |
export PATH=$PATH:$HOME/.local/bin
which raxmlHPC-PTHREADS-AVX2
42 changes: 0 additions & 42 deletions .github/workflows/build-veryfasttree.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/conda-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,9 @@ on:
workflow_dispatch:

jobs:
call-build-aster:
uses: ./.github/workflows/build-aster.yml

build-conda:
runs-on: ubuntu-latest

needs: call-build-aster

steps:
- uses: actions/checkout@v3

Expand All @@ -31,7 +26,6 @@ jobs:
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=130 --statistics
shell: micromamba-shell {0}
Expand All @@ -40,12 +34,6 @@ jobs:
run: pip install .
shell: micromamba-shell {0}

- name: Cache ASTER
uses: actions/cache@v3
with:
path: ~/.local/bin/astral
key: ${{ runner.os }}-ASTER

- name: Test with pytest
run: pytest --runslow
shell: micromamba-shell {0}
51 changes: 47 additions & 4 deletions .github/workflows/python-versions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,32 @@ on:
workflow_dispatch:

jobs:
call-build-muscle:
uses: ./.github/workflows/build-muscle.yml

call-build-aster:
uses: ./.github/workflows/build-aster.yml

call-build-fasttree:
uses: ./.github/workflows/build-fasttree.yml

call-build-raxml:
uses: ./.github/workflows/build-raxml.yml

call-build-iqtree:
uses: ./.github/workflows/build-iqtree.yml

test_pythons:
name: Test on different python versions
runs-on: ubuntu-latest
needs: [call-build-aster, call-build-fasttree]
needs:
[
call-build-muscle,
call-build-aster,
call-build-fasttree,
call-build-raxml,
call-build-iqtree,
]
strategy:
fail-fast: false
matrix:
Expand All @@ -29,7 +45,7 @@ jobs:
- uses: actions/checkout@v3

- name: Cache Python packages
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: pip-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
Expand All @@ -53,17 +69,44 @@ jobs:
- name: Install package
run: pip install .

- name: Cache muscle
uses: actions/cache@v4
with:
path: ~/.local/bin/muscle
key: ${{ runner.os }}-muscle

- name: Cache ASTER
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.local/bin/astral
key: ${{ runner.os }}-ASTER

- name: Cache FastTree
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.local/bin/FastTree
key: ${{ runner.os }}-FastTree

- name: Cache RAxML
uses: actions/cache@v4
with:
path: ~/.local/bin/raxmlHPC-PTHREADS-AVX2
key: ${{ runner.os }}-RAxML

- name: Cache IQTree
uses: actions/cache@v4
with:
path: ~/.local/bin/iqtree2
key: ${{ runner.os }}-IQTree

- name: Export to PATH and verify
run: |
export PATH=$PATH:$HOME/.local/bin
which muscle
which FastTree
which raxmlHPC-PTHREADS-AVX2
which iqtree2
which astral
- name: Test with pytest
run: pytest --runslow
3 changes: 2 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ channels:
- bioconda
- defaults
dependencies:
- aster>=1.16
- biopython>=1.81
- clipkit>=2.1.1
- fasttree>=2.1.11
Expand All @@ -13,5 +14,5 @@ dependencies:
- numpy>=1.26.0
- phykit>=1.12.5
- pyhmmer>=0.10.4
- python>=3.7.12
- python>=3.9
- raxml>=8.2.12
7 changes: 3 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
biopython>=1.81
clipkit>=2.1.1
importlib-metadata; python_version<"3.8"
phykit>=1.12.5
pyhmmer>=0.10.2
matplotlib>=3.5.3
numpy
numpy>=1.26.0
phykit>=1.12.5
pyhmmer>=0.10.4
9 changes: 5 additions & 4 deletions src/phyling/phylotree.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def _with_FastTree(self, *, verbose: bool) -> Tree:

if not fasttree:
raise exception.BinaryNotFoundError(
'FastTree not found. Please install it through "conda install -c bioconda fasttree"'
'FastTree not found. Please install it through "conda install bioconda::fasttree"'
)

cmd = [fasttree, "-gamma", str(self.path)]
Expand Down Expand Up @@ -260,7 +260,7 @@ def _with_RAxML(self, output: Path, *, threads: int, verbose: bool) -> Tree:
break

if not raxml:
raise exception.BinaryNotFoundError('RAxML not found. Please install it through "conda install -c bioconda raxml"')
raise exception.BinaryNotFoundError('RAxML not found. Please install it through "conda install bioconda::raxml"')

if output is None:
tempdir = Path(tempfile.mkdtemp())
Expand Down Expand Up @@ -322,7 +322,7 @@ def _with_IQTree(self, output: Path, *, threads: int, verbose: bool) -> Tree:
break

if not iqtree:
raise exception.BinaryNotFoundError('IQTree not found. Please install it through "conda install -c bioconda iqtree"')
raise exception.BinaryNotFoundError('IQTree not found. Please install it through "conda install bioconda::iqtree"')

if output is None:
tempdir = Path(tempfile.mkdtemp())
Expand Down Expand Up @@ -508,7 +508,8 @@ def get_consensus_tree(self) -> Tree:
if not shutil.which("astral"):
raise exception.BinaryNotFoundError(
"ASTRAL not found. "
"Please build the C++ version from the source following the instruction on https://github.com/chaoszhang/ASTER"
'Please install it through "conda install bioconda::aster" '
"or build the source following the instruction on https://github.com/chaoszhang/ASTER"
)

logging.info("Run ASTRAL to resolve consensus among multiple trees.")
Expand Down
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import shutil
import tarfile

Expand Down
2 changes: 2 additions & 0 deletions tests/libphyling_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import logging
import shutil
from copy import deepcopy
Expand Down
4 changes: 3 additions & 1 deletion tests/phylotree_test.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
from __future__ import annotations

import logging
import shutil
from copy import deepcopy
from itertools import permutations, product
from pathlib import Path
import shutil

import pytest
from Bio.AlignIO import MultipleSeqAlignment
Expand Down
2 changes: 2 additions & 0 deletions tests/pipeline_test.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import logging
from itertools import product
from pathlib import Path
Expand Down

0 comments on commit 2ac8cd4

Please sign in to comment.