Skip to content

Commit

Permalink
GitHub workflows, RTD patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfjlaros committed Nov 21, 2021
1 parent e9e9710 commit 2babd6b
Show file tree
Hide file tree
Showing 9 changed files with 66 additions and 24 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: build
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version:
- 3.6
- 3.7
- 3.8
- 3.9
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install --upgrade pip
pip install flake8 pytest fake_open .
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest
6 changes: 1 addition & 5 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
from subprocess import call

call('pip install ..', shell=True)

from mutalyzer_backtranslate import _get_metadata


Expand All @@ -11,5 +7,5 @@
release = _get_metadata('Version')

autoclass_content = 'both'
extensions = ['sphinx.ext.autodoc']
extensions = ['sphinx.ext.autodoc', 'sphinx_autodoc_typehints', 'sphinxarg.ext']
master_doc = 'index'
3 changes: 3 additions & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
docutils==0.17.1
sphinx-argparse
sphinx-autodoc-typehints
2 changes: 1 addition & 1 deletion mutalyzer_backtranslate/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


def _get_metadata(name):
pkg = get_distribution(__package__)
pkg = get_distribution('mutalyzer_backtranslate')

for line in pkg.get_metadata_lines(pkg.PKG_INFO):
if line.startswith('{}: '.format(name)):
Expand Down
5 changes: 3 additions & 2 deletions mutalyzer_backtranslate/backtranslate.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,9 @@ def improvable(self):
substitutions_with_dna = self.with_dna(
codon, sample_amino_acid)
if (substitutions_with_dna and not
cmp_subst(substitutions_without_dna,
substitutions_with_dna) and
cmp_subst(
substitutions_without_dna,
substitutions_with_dna) and
reference_amino_acid != sample_amino_acid):
substitutions.add(
(reference_amino_acid, sample_amino_acid))
Expand Down
9 changes: 5 additions & 4 deletions mutalyzer_backtranslate/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ def find_stops(input_handle, output_handle, offset, compact):
output_handle.write('{}\t{}\t{}\n'.format(
offset + (index * 3) + position,
list(stop_positions[position])[0][0],
','.join(map(lambda x: x[1],
sorted(stop_positions[position])))))
','.join(map(
lambda x: x[1],
sorted(stop_positions[position])))))


def main():
Expand Down Expand Up @@ -137,7 +138,7 @@ def main():

try:
args.func(
**dict((k, v) for k, v in vars(args).items() if k not in
('func', 'subcommand')))
**dict((k, v) for k, v in vars(args).items() if k not in (
'func', 'subcommand')))
except IOError as error:
parser.error(error)
3 changes: 2 additions & 1 deletion mutalyzer_backtranslate/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ def _three_to_one():
:returns dict: Three letter to one letter amino acids table.
"""
return dict(list(map(lambda x: (str(x[0]), str(x[1])),
return dict(list(map(
lambda x: (str(x[0]), str(x[1])),
IUPACData.protein_letters_3to1_extended.items())) + [('Ter', '*')])


Expand Down
21 changes: 16 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = mutalyzer_backtranslate
version = 0.1.3
version = 0.1.4
description = Functions for reverse translation.
long_description = file: README.rst
author = LUMC, Jeroen F.J. Laros
Expand All @@ -20,12 +20,23 @@ classifiers =
[options]
packages = find:
install_requires =
biopython==1.76
python-Levenshtein==0.12.0
biopython>=1.76
python-Levenshtein>=0.12.0
tests_require =
fake-open==0.0.1
pytest==4.0.1
fake-open>=0.0.1
pytest-cov>=2.10.0
pytest-pep8>=1.0.6
pytest>=4.0.1

[options.entry_points]
console_scripts =
backtranslate = mutalyzer_backtranslate.cli:main

[tool:pytest]
pep8ignore = docs/conf.py ALL

[coverage:report]
exclude_lines = def main()

[coverage:run]
source = mutalyzer_backtranslate
6 changes: 0 additions & 6 deletions tox.ini

This file was deleted.

0 comments on commit 2babd6b

Please sign in to comment.