Skip to content

Commit 4cd327b

Browse files
authored
adding spades (#1)
* base files * add empty __init__.py * adding code * addressing @ElDeveloper comments
1 parent d43bc69 commit 4cd327b

15 files changed

+733
-2
lines changed

.github/workflows/qiita-plugin-ci.yml

+174
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
# name: Qiita Plugin CI
2+
3+
on:
4+
push:
5+
branches: [ dev ]
6+
pull_request:
7+
8+
jobs:
9+
# derived from https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml
10+
main:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
postgres:
15+
# Docker Hub image
16+
image: postgres:9.5
17+
env:
18+
POSTGRES_DB: postgres
19+
POSTGRES_USER: postgres
20+
POSTGRES_PASSWORD: postgres
21+
COVER_PACKAGE: ${{ matrix.cover_package }}
22+
23+
# Set health checks to wait until postgres has started
24+
options: >-
25+
--health-cmd pg_isready
26+
--health-interval 10s
27+
--health-timeout 5s
28+
--health-retries 5
29+
ports:
30+
# based on https://github.com/actions/example-services/blob/master/.github/workflows/postgres-service.yml#L44-L72
31+
- 5432/tcp
32+
33+
steps:
34+
# Downloads a copy of the code in your repository before running CI tests
35+
- name: Check out repository code
36+
uses: actions/checkout@v2
37+
38+
- name: Setup for conda
39+
uses: conda-incubator/setup-miniconda@v2
40+
with:
41+
auto-update-conda: true
42+
python-version: 3.6
43+
44+
- name: Basic dependencies install
45+
env:
46+
COVER_PACKAGE: ${{ matrix.cover_package }}
47+
shell: bash -l {0}
48+
run: |
49+
echo "Testing: " $COVER_PACKAGE
50+
51+
# we need to download qiita directly so we have "easy" access to
52+
# all config files
53+
wget https://github.com/biocore/qiita/archive/dev.zip
54+
unzip dev.zip
55+
56+
# pull out the port so we can modify the configuration file easily
57+
pgport=${{ job.services.postgres.ports[5432] }}
58+
sed -i "s/PORT = 5432/PORT = $pgport/" qiita-dev/qiita_core/support_files/config_test.cfg
59+
60+
# PGPASSWORD is read by pg_restore, which is called by the build_db process.
61+
export PGPASSWORD=postgres
62+
63+
# Setting up main qiita conda environment
64+
conda config --add channels conda-forge
65+
conda create -q --yes -n qiita python=3.6 pip libgfortran numpy nginx cython redis
66+
conda activate qiita
67+
pip install sphinx sphinx-bootstrap-theme nose-timer codecov Click
68+
69+
- name: Qiita install
70+
shell: bash -l {0}
71+
run: |
72+
conda activate qiita
73+
pip install qiita-dev/ --no-binary redbiom
74+
mkdir ~/.qiita_plugins
75+
76+
- name: Install plugins
77+
shell: bash -l {0}
78+
run: |
79+
conda config --add channels anaconda
80+
conda config --add channels bioconda
81+
82+
# installing qtp-sequencing
83+
conda create -q --yes -n qtp-sequencing python=3.6 pip pigz quast
84+
conda activate qtp-sequencing
85+
pip --quiet install https://github.com/qiita-spots/qtp-sequencing/archive/master.zip
86+
export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt
87+
export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg
88+
configure_qtp_sequencing --env-script "source /home/runner/.profile; conda activate qtp-sequencing" --server-cert $QIITA_SERVER_CERT
89+
90+
conda deactivate
91+
92+
# installing this plugin
93+
conda create -q --yes -n qp-spades python=3.6 cmake clang zlib flash spades
94+
conda activate qp-spades
95+
96+
# making sure the installed versions haven't changed
97+
flash_version=`flash --version`
98+
spades_version=`spades.py --version`
99+
if [[ $flash_version != *"v1.2.11"* ]]; then echo "wrong flash version", $flash_version; exit 1; fi
100+
if [[ $spades_version != *"v3.15.2"* ]]; then echo "wrong spades version", $spades_version; exit 1; fi
101+
102+
export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt
103+
export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg
104+
pip install -U pip
105+
pip install .
106+
configure_qp_spades --env-script "source /home/runner/.profile; conda activate qp-spades" --server-cert $QIITA_SERVER_CERT
107+
108+
- name: Starting services
109+
shell: bash -l {0}
110+
run: |
111+
conda activate qiita
112+
export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt
113+
export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg
114+
sed "s#/home/runner/work/qiita/qiita#${PWD}/qiita-dev/#g" `pwd`/qiita-dev/qiita_core/support_files/config_test.cfg > ${QIITA_CONFIG_FP}
115+
116+
export REDBIOM_HOST="http://localhost:7379"
117+
118+
echo "1. Setting up redis"
119+
redis-server --daemonize yes --port 7777
120+
121+
echo "2. Setting up nginx"
122+
mkdir -p ${CONDA_PREFIX}/var/run/nginx/
123+
export NGINX_FILE=`pwd`/qiita-dev/qiita_pet/nginx_example.conf
124+
export NGINX_FILE_NEW=`pwd`/qiita-dev/qiita_pet/nginx_example_local.conf
125+
sed "s#/home/runner/work/qiita/qiita#${PWD}/qiita-dev/#g" ${NGINX_FILE} > ${NGINX_FILE_NEW}
126+
nginx -c ${NGINX_FILE_NEW}
127+
128+
echo "3. Setting up qiita"
129+
conda activate qiita
130+
qiita-env make --no-load-ontologies
131+
qiita-test-install
132+
qiita plugins update
133+
134+
echo "4. Starting supervisord => multiple qiita instances"
135+
supervisord -c ${PWD}/qiita-dev/qiita_pet/supervisor_example.conf
136+
sleep 10
137+
cat /tmp/supervisord.log
138+
139+
- name: Main tests
140+
shell: bash -l {0}
141+
env:
142+
COVER_PACKAGE: ${{ matrix.cover_package }}
143+
run: |
144+
conda activate qp-spades
145+
export QIITA_SERVER_CERT=`pwd`/qiita-dev/qiita_core/support_files/server.crt
146+
export QIITA_CONFIG_FP=`pwd`/qiita-dev/qiita_core/support_files/config_test_local.cfg
147+
148+
nosetests $COVER_PACKAGE --with-doctest --with-coverage -vv --cover-package=$COVER_PACKAGE
149+
150+
# killing the qiita server to run the next commands
151+
QIITA_PID=`cat /tmp/supervisord.pid`
152+
kill $QIITA_PID
153+
sleep 10
154+
155+
- uses: codecov/codecov-action@v1
156+
with:
157+
token: ${{ secrets.CODECOV_TOKEN }}
158+
file: codecov.yml
159+
160+
lint:
161+
runs-on: ubuntu-latest
162+
steps:
163+
- name: flake8
164+
uses: actions/setup-python@v2
165+
with:
166+
python-version: 3.6
167+
- name: install dependencies
168+
run: python -m pip install --upgrade pip
169+
- name: Check out repository code
170+
uses: actions/checkout@v2
171+
- name: lint
172+
run: |
173+
pip install -q flake8
174+
flake8 qp_spades setup.py scripts/*

.gitignore

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
env/
12+
build/
13+
develop-eggs/
14+
dist/
15+
downloads/
16+
eggs/
17+
.eggs/
18+
lib/
19+
lib64/
20+
parts/
21+
sdist/
22+
var/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
27+
# PyInstaller
28+
# Usually these files are written by a python script from a template
29+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Unit test / coverage reports
38+
htmlcov/
39+
.tox/
40+
.coverage
41+
.coverage.*
42+
.cache
43+
nosetests.xml
44+
coverage.xml
45+
*,cover
46+
.hypothesis/
47+
48+
# Translations
49+
*.mo
50+
*.pot
51+
52+
# Django stuff:
53+
*.log
54+
local_settings.py
55+
56+
# Flask stuff:
57+
instance/
58+
.webassets-cache
59+
60+
# Scrapy stuff:
61+
.scrapy
62+
63+
# Sphinx documentation
64+
docs/_build/
65+
66+
# PyBuilder
67+
target/
68+
69+
# IPython Notebook
70+
.ipynb_checkpoints
71+
72+
# pyenv
73+
.python-version
74+
75+
# celery beat schedule file
76+
celerybeat-schedule
77+
78+
# dotenv
79+
.env
80+
81+
# virtualenv
82+
venv/
83+
ENV/
84+
85+
# Spyder project settings
86+
.spyderproject
87+
88+
# Rope project settings
89+
.ropeproject

README.md

-2
This file was deleted.

README.rst

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
qp-spades Qiita plugin to process metagenomic assemblies and isolates
2+
==============================
3+
4+
|Build Status| |Coverage Status|
5+
6+
7+
`Qiita <https://github.com/biocore/qiita/>`__ (canonically pronounced *cheetah*)
8+
is an analysis environment for microbiome (and other "comparative -omics")
9+
datasets.
10+
11+
This package includes the qp-spades Qiita plugin.
12+
13+
How to test this package?
14+
-------------------------
15+
In order to test the qp-spades package, a local
16+
installation of Qiita should be running in test mode on the address
17+
`https://localhost:21174`, with the default test database created in Qiita's
18+
test suite. Also, if Qiita is running with the default server SSL certificate,
19+
you need to export the variable `QIITA_SERVER_CERT` in your environment, so the
20+
Qiita Client can perform secure connections against the Qiita server:
21+
22+
.. code-block:: bash
23+
24+
$ export QIITA_SERVER_CERT=<QIITA_INSTALL_PATH>/qiita_core/support_files/server.crt
25+
26+
.. |Build Status| image:: https://travis-ci.org/qiita-spots/qp-spades.png?branch=master
27+
:target: https://travis-ci.org/qiita-spots/qp-spades
28+
.. |Coverage Status| image:: https://coveralls.io/repos/qiita-spots/qp-spades/badge.png?branch=master
29+
:target: https://coveralls.io/r/qiita-spots/qp-spades

qp_spades/__init__.py

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# -----------------------------------------------------------------------------
2+
# Copyright (c) 2021, Qiita development team.
3+
#
4+
# Distributed under the terms of the BSD 3-clause License License.
5+
#
6+
# The full license is in the file LICENSE, distributed with this software.
7+
# -----------------------------------------------------------------------------
8+
9+
from qiita_client import QiitaPlugin, QiitaCommand
10+
from .qp_spades import spades
11+
12+
13+
THREADS = "16"
14+
MEMORY = "200"
15+
KMERS = "21,33,55,77,99,127"
16+
17+
# Initialize the plugin
18+
plugin = QiitaPlugin('qp-spades', '2021.05', 'spades pipeline')
19+
20+
# Define the command
21+
req_params = {'input': ('artifact', ['per_sample_FASTQ'])}
22+
opt_params = {
23+
'type': ['choice:["meta", "isolate"]', "meta"],
24+
'merging': ['choice:["no merge", "flash 65%"]', "flash 65%"],
25+
'threads': ['integer', THREADS],
26+
'memory': ['integer', MEMORY],
27+
'k-mers': ['string', KMERS],
28+
}
29+
30+
outputs = {'Preprocessed FASTA': 'FASTA_preprocessed'}
31+
default_params = {
32+
'no merging + meta': {
33+
'type': 'meta', 'merging': 'no merge', 'threads': THREADS,
34+
'memory': MEMORY, 'k-mers': KMERS},
35+
'no merging + isolate': {
36+
'type': 'isolate', 'merging': 'no merge', 'threads': THREADS,
37+
'memory': MEMORY, 'k-mers': KMERS},
38+
'merge flash 65% + meta': {
39+
'type': 'meta', 'merging': 'flash 65%', 'threads': THREADS,
40+
'memory': MEMORY, 'k-mers': KMERS},
41+
'merge flash 65% + isolate': {
42+
'type': 'isolate', 'merging': 'flash 65%', 'threads': THREADS,
43+
'memory': MEMORY, 'k-mers': KMERS}}
44+
45+
spades_cmd = QiitaCommand(
46+
"spades v3.15.2", "Isolate and Metagenomic processing via spades", spades,
47+
req_params, opt_params, outputs, default_params)
48+
49+
plugin.register_command(spades_cmd)

0 commit comments

Comments
 (0)