Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trigger action execution #2

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 41 additions & 9 deletions .github/workflows/sepp_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ on:

jobs:
python_tests:
strategy:
matrix:
python-version: ["3.9", "3.10"]
runs-on: ubuntu-latest

steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
- name: setup conda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
# This uses *miniforge*, rather than *minicond*. The primary difference
# is that the defaults channel is not enabled at all
Expand All @@ -26,22 +26,54 @@ jobs:
# conda CLI
use-mamba: true
mamba-version: "*"
python-version: "3.9"
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
environment-file: ci/environment.yml
auto-activate-base: true
activate-environment: sepp_ci
- name: install sepp
shell: bash -el {0}
run: |
python setup.py config -c
python setup.py install
- name: run python tests
- name: run tests
shell: bash -el {0}
run: |
nosetests test/unittest --with-doctest --with-coverage
conda list
nosetests -w test/unittest --with-doctest --with-coverage
- name: convert coverage
shell: bash -el {0}
run: |
coverage lcov
- name: send coverage report
- name: send coverage report.
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "coverage.lcov"

linting:
strategy:
matrix:
python-version: ["3.9", "3.10"]
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: setup conda
uses: conda-incubator/setup-miniconda@v3
with:
# This uses *miniforge*, rather than *minicond*. The primary difference
# is that the defaults channel is not enabled at all
miniforge-version: latest
# These properties enable the use of mamba, which is much faster and far
# less error prone than conda while being completely compatible with the
# conda CLI
use-mamba: true
mamba-version: "*"
python-version: ${{ matrix.python-version }}
environment-file: ci/env_lint.yml
auto-activate-base: true
activate-environment: sepp_lint
- name: linting
shell: bash -el {0}
run: |
flake8 setup.py split_sequences.py distribute_setup.py run_ensemble.py run_sepp.py run_upp.py merge_script.py test/unittest/ sepp/
37 changes: 0 additions & 37 deletions .travis.yml

This file was deleted.

4 changes: 0 additions & 4 deletions ci/conda_requirements.txt

This file was deleted.

6 changes: 6 additions & 0 deletions ci/env_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
channels:
- bioconda
- conda-forge
- defaults
dependencies:
- flake8
2 changes: 2 additions & 0 deletions sepp/environment.yml → ci/environment.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
name: sepp
channels:
- bioconda
- conda-forge
- defaults
dependencies:
Expand All @@ -8,3 +9,4 @@ dependencies:
- coverage >= 6 # to ensure lcov option is available
- java-jdk
- pep8
- setuptools
1 change: 0 additions & 1 deletion ci/pip_requirements.txt

This file was deleted.

28 changes: 14 additions & 14 deletions sepp/alignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
try:
from collections.abc import Mapping # noqa
except ImportError:
from collections import Mapping
from collections import Mapping

import copy
from sepp import get_logger
import io
Expand Down Expand Up @@ -771,8 +771,8 @@ def merge_in(self, other, convert_to_string=True):
if me != me_len and self.is_insertion_column(me):
''' We both have a series of insertion columns'''
start = me
while(me != me_len and self.is_insertion_column(me) and
she != she_len and other.is_insertion_column(she)):
while (me != me_len and self.is_insertion_column(me) and
she != she_len and other.is_insertion_column(she)):
me += 1
she += 1
merged_insertion_columns += 1
Expand Down Expand Up @@ -805,24 +805,24 @@ def merge_in(self, other, convert_to_string=True):
self.col_labels[start:me] = list(
range(insertion, insertion-run, -1))
insertion -= run
elif(she == she_len or (me != me_len and
self.col_labels[me] < other.col_labels[she])):
elif (she == she_len or (me != me_len and
self.col_labels[me] < other.col_labels[she])):
''' My column is not present (i.e. was allgap) in the
"other"'''
start = me
while(me < me_len and (she == she_len or me != me_len and
self.col_labels[me] < other.col_labels[she])):
while (me < me_len and (she == she_len or me != me_len and
self.col_labels[me] < other.col_labels[she])):
me += 1
run = me - start
ins = bytearray(b"-") * run
for v in selfother.values():
v[start:start] = ins
elif(me == me_len or (she != she_len and
self.col_labels[me] > other.col_labels[she])):
elif (me == me_len or (she != she_len and
self.col_labels[me] > other.col_labels[she])):
''' Her column is not present (i.e. was allgap) in "me"'''
start = she
while(she < she_len and (me == me_len or she != she_len and
self.col_labels[me] > other.col_labels[she])):
while (she < she_len and (me == me_len or she != she_len and
self.col_labels[me] > other.col_labels[she])):
she += 1
run = she - start
ins = bytearray(b"-") * run
Expand All @@ -833,8 +833,8 @@ def merge_in(self, other, convert_to_string=True):
me_len += run
elif self.col_labels[me] == other.col_labels[she]:
''' A shared column'''
while(me < me_len and she < she_len and
self.col_labels[me] == other.col_labels[she]):
while (me < me_len and she < she_len and
self.col_labels[me] == other.col_labels[she]):
she += 1
me += 1
else:
Expand Down
1 change: 1 addition & 0 deletions sepp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

root_p = open(os.path.join(os.path.split(
os.path.split(__file__)[0])[0], "home.path")).readlines()[0].strip()
print("root_p='%s'" % root_p)
main_config_path = os.path.join(root_p, "main.config")


Expand Down
8 changes: 4 additions & 4 deletions sepp/exhaustive.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
from sepp.algorithm import AbstractAlgorithm
from sepp.config import options
from sepp.tree import PhylogeneticTree
from sepp.alignment import MutableAlignment, ExtendedAlignment,\
hamming_distance
from sepp.alignment import (MutableAlignment, ExtendedAlignment,
hamming_distance)
from sepp.problem import SeppProblem, RootProblem
from dendropy.datamodel.treemodel import Tree
from sepp.jobs import HMMBuildJob, HMMSearchJob, HMMAlignJob, PplacerJob,\
MergeJsonJob
from sepp.jobs import (HMMBuildJob, HMMSearchJob, HMMAlignJob, PplacerJob,
MergeJsonJob)
from sepp.scheduler import JobPool, Join
from sepp import get_logger
from sepp.math_utils import lcm
Expand Down
6 changes: 3 additions & 3 deletions sepp/exhaustive_upp.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def generate_backbone(self):
fragments = MutableAlignment()
if options().median_full_length is not None \
or options().full_length_range is not None:
if options().median_full_length == -1 \
if options().median_full_length == -1 \
or 0 < options().median_full_length < 1:
# for backward compatibility, -1 is mapped to 0.5 quantile.
if options().median_full_length == -1:
Expand Down Expand Up @@ -415,8 +415,8 @@ def augment_parser():
help="Consider all fragments that are 25%% longer or shorter than N "
"to be excluded from the backbone. If value is -1, then UPP will"
" use the median of the sequences as the median full length. "
"Use 0 < N < 1 for UPP to use quartiles. e.g. 0.25 for the first "
" quartile and 0.75 for the third quartile. "
"Use 0 < N < 1 for UPP to use quartiles. e.g. 0.25 for the "
"first quartile and 0.75 for the third quartile. "
"[default: None]")
decompGroup.add_argument(
"-T", "--backbone_threshold", type=float,
Expand Down
2 changes: 1 addition & 1 deletion sepp/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -447,5 +447,5 @@ def is_valid_tree(t):
if num_children == 2:
# What is with this code? Why do we check the same variable twice?
# Bug? NN
assert((not rc[0].child_nodes()) and (not rc[0].child_nodes()))
assert ((not rc[0].child_nodes()) and (not rc[0].child_nodes()))
return True
4 changes: 2 additions & 2 deletions test/unittest/TestFork.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ def run():

# Test one of the jobs, to see if it is successful
if sample_job.ready() and sample_job.successful():
assert(jobs[3].result_set is True)
assert (jobs[3].result_set is True)
else:
assert(jobs[3].result_set is False)
assert (jobs[3].result_set is False)

errors = pool.get_all_job_errors()
# print("Following job errors were raised:", errors)
Expand Down
4 changes: 2 additions & 2 deletions test/unittest/testAlignment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
@author: smirarab
'''
import unittest
from sepp.alignment import MutableAlignment, ReadonlySubalignment,\
ExtendedAlignment
from sepp.alignment import (MutableAlignment, ReadonlySubalignment,
ExtendedAlignment)
from sepp.problem import SeppProblem
from sepp.filemgr import get_data_path
from tempfile import mkstemp
Expand Down
4 changes: 2 additions & 2 deletions test/unittest/testConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,12 @@ def testLog(self):
sepp._DEBUG = True
sepp.reset_loggers()
sepp.jobs._LOG.debug("test debugging works")
assert(sepp.jobs._LOG.getEffectiveLevel() == logging.DEBUG)
assert (sepp.jobs._LOG.getEffectiveLevel() == logging.DEBUG)

sepp._DEBUG = False
sepp.reset_loggers()
sepp.jobs._LOG.debug("test debugging is disabled")
assert(sepp.jobs._LOG.getEffectiveLevel() == logging.INFO)
assert (sepp.jobs._LOG.getEffectiveLevel() == logging.INFO)

sepp._DEBUG = sdb
sepp.reset_loggers()
Expand Down
7 changes: 3 additions & 4 deletions test/unittest/testUPP.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,11 @@ def tearDown(self):
shutil.rmtree(self.x.options.outdir, ignore_errors=True)

def test_id_collision_working(self):

self.x.run()
self.assertTrue(self.x.results is not None)
assert(len(self.x.results) == 490)
assert(300 < len(self.x.results['SEQ396']) < 600)
assert(len(self.x.results['SEQ554'].replace('-', '')) == 57)
assert (len(self.x.results) == 490)
assert (300 < len(self.x.results['SEQ396']) < 600)
assert (len(self.x.results['SEQ554'].replace('-', '')) == 57)


if __name__ == "__main__":
Expand Down
Loading