Skip to content

Commit

Permalink
Merge pull request #23 from Ulthran/master
Browse files Browse the repository at this point in the history
Add CI/CD
  • Loading branch information
kylebittinger authored Feb 9, 2023
2 parents 064f427 + 71ea74c commit 817ec52
Show file tree
Hide file tree
Showing 27 changed files with 1,176 additions and 636 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CodeCov

on:
pull_request:
branches: [master, main]
push:
branches: [master, main]
schedule:
- cron: "0 13 * * 1"

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Python 3.10
uses: actions/setup-python@v2
with:
python-version: '3.10'
- name: setup-conda
uses: s-weigand/[email protected]
with:
conda-channels: ''
- name: Install dependencies
run: |
conda install -c bioconda vsearch
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install pytest-cov
python -m pip install .
- name: Run tests and collect coverage
run: pytest --cov tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
28 changes: 28 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Super-Linter

on:
pull_request:
branches: [master, main]
push:
branches: [master, main]

jobs:
super-linter:
name: Lint Codebase
runs-on: ubuntu-latest

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Run Super-Linter
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

VALIDATE_PYTHON_BLACK: true

FILTER_REGEX_EXCLUDE: tests/test_align.py
# align.py has some weirdly spaced strings to show alignment
# To reformat, `black . --exclude="test_align.py"`
39 changes: 39 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: PyPi

on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Tests

on:
pull_request:
branches: [master, main]
push:
branches: [master, main]
schedule:
- cron: "0 13 * * 1"

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: setup-conda
uses: s-weigand/[email protected]
with:
conda-channels: ''
- name: Install dependencies
run: |
conda install -c bioconda vsearch
python -m pip install --upgrade pip
python -m pip install pytest
python -m pip install .
- name: Test with pytest
run: |
pytest -vvl tests/
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Unassigner

[![Tests](https://github.com/Ulthran/unassigner/actions/workflows/tests.yml/badge.svg)](https://github.com/Ulthran/unassigner/actions/workflows/tests.yml)
[![Super-Linter](https://github.com/Ulthran/unassigner/actions/workflows/linter.yml/badge.svg)](https://github.com/Ulthran/unassigner/actions/workflows/linter.yml)
[![codecov](https://codecov.io/gh/Ulthran/unassigner/branch/master/graph/badge.svg?token=76YWJFWGON)](https://codecov.io/gh/Ulthran/unassigner)
[![PyPi](https://github.com/Ulthran/unassigner/actions/workflows/python-publish.yml/badge.svg)](https://github.com/Ulthran/unassigner/actions/workflows/python-publish.yml)

Evaluate consistency with named bacterial species for short 16S rRNA
marker gene sequences.

Expand Down Expand Up @@ -54,6 +59,32 @@ sequence alignments. It's available through
[conda](https://anaconda.org/bioconda/vsearch), and this is our
recommended method for installation.

```bash
conda create --name unassigner
conda activate unassigner
conda install -c bioconda vsearch
pip install unassigner
```

### Alternative Installation

If `pip install unassigner` isn't working or if you want to use a development
version, you can also install via git.

```bash
conda create --name unassigner
conda activate unassigner
conda install -c bioconda vsearch
git clone https://github.com/kylebittinger/unassigner.git
cd unassigner
pip install -r requirements.txt
pip install .
```

If you don't want to use conda, see the
[vsearch repo](https://github.com/torognes/vsearch) for alternative install
methods.

## Usage

The `unassign` program requires one argument, a FASTA-formatted file
Expand All @@ -66,7 +97,8 @@ unassign my_sequences.fasta
If the program has not been run before, it will automatically download
the bacterial species data it needs, format its reference files,
create an output directory named `my_sequences_unassigned`, and write
a table of results there, along with some auxiliary output files.
a table of results there, along with some auxiliary output files. Note
that the output directory will be in the same directory as `my_sequences.fasta`.

Please see the output of `unassign --help` for a list of the available
options.
Expand Down
65 changes: 33 additions & 32 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,39 @@
from setuptools import setup

PACKAGE_DIR = os.path.abspath(os.path.dirname(__file__))
README_FP = os.path.join(PACKAGE_DIR, 'README.md')
with open(README_FP, encoding='utf-8') as f:
README_FP = os.path.join(PACKAGE_DIR, "README.md")
with open(README_FP, encoding="utf-8") as f:
long_description = f.read()

setup(name='unassigner',
version='0.0.5',
description='Bacterial species unassigner',
long_description=long_description,
long_description_content_type='text/markdown',
author='Kyle Bittinger',
author_email='[email protected]',
url='https://github.com/kylebittinger/unassigner',
packages=['unassigner'],
install_requires=[
'biopython',
'scipy',
],
entry_points={
'console_scripts': [
'unassign=unassigner.command:main',
'trimragged=unassigner.trim:main',
'count_mismatches=unassigner.mismatch_db:main',
'pctid_ani_sample=unassigner.ani:main_sampling',
],
},
classifiers=[
'Intended Audience :: Science/Research',
'License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)',
'Operating System :: POSIX :: Linux',
'Operating System :: MacOS :: MacOS X',
'Programming Language :: Python :: 3',
'Topic :: Scientific/Engineering :: Bio-Informatics',
],
license='GPLv2+',
setup(
name="unassigner",
version="0.0.5",
description="Bacterial species unassigner",
long_description=long_description,
long_description_content_type="text/markdown",
author="Kyle Bittinger",
author_email="[email protected]",
url="https://github.com/kylebittinger/unassigner",
packages=["unassigner"],
install_requires=[
"biopython",
"scipy",
],
entry_points={
"console_scripts": [
"unassign=unassigner.command:main",
"trimragged=unassigner.trim:main",
"count_mismatches=unassigner.mismatch_db:main",
"pctid_ani_sample=unassigner.ani:main_sampling",
],
},
classifiers=[
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU General Public License v2 or later (GPLv2+)",
"Operating System :: POSIX :: Linux",
"Operating System :: MacOS :: MacOS X",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Bio-Informatics",
],
license="GPLv2+",
)
Loading

0 comments on commit 817ec52

Please sign in to comment.