https://github.com/bacpop/beebop_py

Python API for beebop

https://github.com/bacpop/beebop_py

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.8%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Python API for beebop

Basic Info
  • Host: GitHub
  • Owner: bacpop
  • Language: Python
  • Default Branch: main
  • Size: 4.72 MB
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 3
  • Releases: 0
Created over 4 years ago · Last pushed about 1 year ago
Metadata Files
Readme

README.md

Python application CI

beebop_py

Python API for beebop

Usage

Databases

To update the database being used for a species, update the dbname json property in args.json. Note: for development you may prefer to use the ref database to speed up PopPUNK runs.

Adding a new species

The current species can be seen in args.json in the species object. To add a new species do the following:

  1. Add new database to mrcdata.
  2. Add new species to args.json in beebop_py with properties.

A note on Assign Cluster Quality Control

The app assigns clusters with quality control (qc) on. This is to enable the --run-qc flag as per here. The arguments along with --qc-run can be found at args.json in the qc_dict json object. These are species dependent and can be changed as per the species requirements.

Clone the repository

git clone git@github.com:bacpop/beebop_py.git

Get the database

You will need species databases, please download and extract it into /storage. You can download all databases with the following command:

./scripts/download_databases

or just the reference databases with:

./scripts/download_databases --refs

Install dependencies

Poetry

You will need Python installed, as well as Poetry, which you can get on Linux with curl -sSL https://install.python-poetry.org | python3 -

PopPUNK

To install PopPUNK, follow these steps:

First, create a new conda environment: conda create --name beebop_py python=3.10 and activate it with conda activate beebop_py

Then install PopPUNK to your computer - either the latest version: pip3 install git+https://github.com/bacpop/PopPUNK#egg=PopPUNK

..or a specific version: pip3 install git+https://github.com/bacpop/PopPUNK@v2.7.5#egg=PopPUNK # for PopPUNK v2.7.5. replace with desired version

If there are problems installing PopPUNK, you may need to install one or more of the following packages with sudo apt get install: - cmake - libhdf5-dev - libeigen3-dev - libopenblas-dev

Please install the dependencies for PopPUNK with: conda install requests pandas networkx pp-sketchlib scikit-learn hdbscan biopython tqdm treeswift rapidnj

The graph-tool and mandrake packages must be installed from conda-forge: conda install -c conda-forge graph-tool mandrake

Other dependencies

To install all other required dependencies go into the beeboppy project folder and run (having the conda environment 'beeboppy' activated) poetry install

Run the app

Start the flask app with ./scripts/run_app

In a second terminal, you can now query the flask endpoints, e.g.:

  • /version

bash curl http://127.0.0.1:5000/version

Testing

Before testing, Redis and rqworker must be running. From the root of beeboppy, run (with 'beeboppy' env activated) ./scripts/run_test_dependencies Testing can be done in a second terminal (make sure to activate 'beebop_py') by running TESTING=True poetry run pytest

Linting and Formatting

To run the linter and formatter, you can use the following commands:

  • Linting: poetry run ruff check
  • Linting with Fix: poetry run ruff check --fix
  • Formatting: poetry run ruff format

Diagrams

  • There is a .drawio graph in the diagrams folder illustrating the process of running a analysis. This includes all the files created and how they are used in each job. You can open and view the diagram at draw.io.

Use/Deploy specific version of PopPUNK

To use a specific version, commit or branch of PopPUNK in a beeboppy deployment, you can update `POPPUNKVERSIONincommon`.

The new dev images built with /docker/build --with-dev will have a -dev postfix.

Local Development

You can build the image with /docker/build --with-dev, this new image can now be used by Beebop.

Deployment

A pull request can be created so GHA pushes the images to the docker hub. Add --with-dev to the build & push commands pipeline.yaml. Ensure to remove the --with-dev flag before merging the PR. Then on the beebop-deploy the api image can be updated with the new dev image.

GPU

To use GPU, ensure the following conditions are met:

  • The host machine has a GPU and the NVIDIA drivers and cuda-toolkit are installed with correct versions. Check the NVIDIA documentation
  • The necessary libraries for GPU support are installed in your environment.RAPIDS,numba, cupy
  • Ensure any new PopPUNK databases have graph.csv.gz file. If not run script in scripts folder: python gt-to-csv-gz.py with
    • --input the path to the graph .gt file

Note: If you installed pp-sketchlib, PopPUNK, and mandrake before installing CUDA, you will need to reinstall them to ensure CUDA-enabled versions are installed.

Owner

  • Name: Bacterial population genetics
  • Login: bacpop
  • Kind: organization
  • Email: contact@bacpop.org
  • Location: United Kingdom

Pathogen Informatics and Modelling @ EMBL-EBI / Bacterial Evolutionary Epidemiology Group @ Imperial College London

GitHub Events

Total
  • Delete event: 12
  • Issue comment event: 10
  • Push event: 224
  • Pull request review comment event: 73
  • Pull request review event: 85
  • Pull request event: 38
  • Create event: 13
Last Year
  • Delete event: 12
  • Issue comment event: 10
  • Push event: 224
  • Pull request review comment event: 73
  • Pull request review event: 85
  • Pull request event: 38
  • Create event: 13

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 0
  • Total pull requests: 13
  • Average time to close issues: N/A
  • Average time to close pull requests: 7 days
  • Total issue authors: 0
  • Total pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.31
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 13
  • Average time to close issues: N/A
  • Average time to close pull requests: 7 days
  • Issue authors: 0
  • Pull request authors: 1
  • Average comments per issue: 0
  • Average comments per pull request: 0.31
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • absternator (1)
Pull Request Authors
  • absternator (27)
  • EmmaLRussell (3)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

poetry.lock pypi
  • coverage 6.4.4 develop
  • async-timeout 4.0.2
  • atomicwrites 1.4.0
  • attrs 21.4.0
  • click 8.1.3
  • colorama 0.4.4
  • deprecated 1.2.13
  • flask 2.1.2
  • flask-expects-json 1.7.0
  • h5py 3.7.0
  • importlib-metadata 4.11.4
  • iniconfig 1.1.1
  • itsdangerous 2.1.2
  • jinja2 3.1.2
  • jsonschema 4.5.1
  • markupsafe 2.1.1
  • numpy 1.22.4
  • packaging 21.3
  • pluggy 0.13.1
  • py 1.11.0
  • pycodestyle 2.8.0
  • pyparsing 3.0.9
  • pyrsistent 0.18.1
  • pyside6 6.3.1
  • pyside6-addons 6.3.1
  • pyside6-essentials 6.3.1
  • pytest 7.1.2
  • pytest-mock 3.8.2
  • pytest-qt 4.0.2
  • pytest-unordered 0.5.1
  • pytest-xvfb 2.0.0
  • pyvirtualdisplay 3.0
  • redis 4.3.1
  • rq 1.10.1
  • shiboken6 6.3.1
  • six 1.16.0
  • tomli 2.0.1
  • waitress 2.1.2
  • werkzeug 2.1.2
  • wrapt 1.14.1
  • zipp 3.8.0
pyproject.toml pypi
  • coverage ^6.4.1 develop
  • Flask ^2.0
  • PySide6 ^6.3.1
  • flask-expects-json ^1.7.0
  • h5py ^3.6.0
  • jsonschema ^4.4
  • numpy ^1.22.3
  • pycodestyle ^2.8.0
  • pytest ^7.1.2
  • pytest-mock ^3.8.2
  • pytest-qt ^4.0.2
  • pytest-unordered ^0.5.1
  • pytest-xvfb ^2.0.0
  • python >=3.9,<3.11
  • redis ^4.3.1
  • rq ^1.10.1
  • six ^1.16.0
  • waitress ^2.0.0
.github/workflows/pycodestyle_workflow.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
  • snok/install-poetry v1.3.0 composite
.github/workflows/pytest.yml actions
  • actions/checkout v2 composite
  • actions/checkout v3 composite
  • actions/setup-python v2 composite
  • codecov/codecov-action v2 composite
  • conda-incubator/setup-miniconda v2.1.1 composite
  • snok/install-poetry v1 composite
docker/Dockerfile docker
  • mrcide/poppunk bacpop-43 build
tests/setup.py pypi