Skip to main content

A fast, user-friendly analysis and evaluation pipeline for some DNA sequence classification tasks.

Project description


kameris
Kameris

A fast, user-friendly analysis and evaluation pipeline for some DNA sequence classification tasks.

PyPI License   Travis Appveyor
Coveralls Codecov   Codacy Codebeat Codeclimate

Installing

There are three ways to install this software. Choose whichever one is best for your needs:

1. If you already have Python 2.7 or 3.4+ installed (recommended):

Run pip install kameris.

2. If you do not have Python installed or are unable to install software:

Click here and download the version corresponding to your operating system. If you use Linux or macOS, you may need to run chmod +x "path to downloaded program".

3. If you are a developer or want to build your own version of Kameris:

Clone this repository then run make install.

Citing

If you use this software in your research, please cite:

An open-source k-mer based machine learning tool for fast and accurate subtyping of HIV-1 genomes
Stephen Solis-Reyes, Mariano Avino, Art Poon, Lila Kari
https://www.biorxiv.org/content/early/2018/07/05/362780

Quick demo

This software is able to train sequence classification models and use them to make predictions.

Before following these instructions, make sure you've installed the software. If you followed option 1 above and the command kameris doesn't work for you, try using python -m kameris instead. If you followed option 2 above and downloaded an executable, replace kameris in the instructions below with the name of the executable you downloaded.

Classifying sequences with an existing model

First, let's classify some HIV-1 sequences.

  1. Start by downloading this zip file containing HIV-1 genomes, and extract it to a folder: https://raw.githubusercontent.com/stephensolis/kameris/master/demo/hiv1-genomes.zip.
  2. Run kameris classify hiv1-mlp "path to extracted files"

This will output the top subtype match for each sequence and write all results to a new file results.json.

The hiv1-mlp model is able to give class probabilities and a ranked list of predictions, but some models are only able to report the top match. For example, try kameris classify hiv1-linearsvm "path to extracted files"

To see other available models, go to https://github.com/stephensolis/kameris-experiments/tree/master/models.

Training a new model

Now, let's train our own HIV-1 sequence classification models.

  1. Create an empty folder and open a terminal in the folder.
  2. Create folders data and output.
  3. Run kameris run-job https://raw.githubusercontent.com/stephensolis/kameris/master/demo/hiv1-lanl.yml https://raw.githubusercontent.com/stephensolis/kameris/master/demo/settings.yml

Depending on your computer's performance and internet speed, it may take 5-10 minutes to run. This will automatically download the required datasets and train a simpler version of the hiv1/lanl-whole experiment from kameris-experiments. This was the exact job used to train the models from the previous section, and these are the same models used in the paper "An open-source k-mer based machine learning tool for fast and accurate subtyping of HIV-1 genomes".

Now, open output/hiv1-lanl-whole. You will notice folders were created for each value of k. Within each folder are several files:

  • fasta contains the FASTA files extracted from the downloaded dataset used for model training and evaluation.
  • metadata.json contains metadata on the FASTA files used to determine the class for each sequence.
  • cgrs.mm-repr contains feature vectors for each sequence. See the mentioned paper for more details on the computation of the vectors, and kameris-formats for reader/writer implementations and a description of the file format.
  • classification-kmers.json contains evaluation results after using cross-validation on the dataset. See the mentioned paper for more technical details.
  • The .mm-model files contain trained models which may be passed to kameris classify in order to classify new sequences. Note that models trained using Python 2 will not run under Python 3 and vice-versa.
  • log.txt is a log file containing all the output printed during job execution.
  • rerun-experiment.yml is a file which may be passed to kameris run-job in order to re-run the job and obtain exactly the files found in this directory.

Kameris also includes functionality to summarize results in easy-to-read tables. Try it by running kameris summarize output/hiv1-lanl-whole.

You can change the settings used to train the model: first download the files hiv1-lanl.yml and settings.yml. Training settings are found in hiv1-lanl.yml -- try changing the value of k or uncommenting different classifier types. File storage and logging settings are found in settings.yml. After making changes, run kameris run-job hiv1-lanl.yml settings.yml to train your model.

Dependencies

This project uses:

License License

The MIT License (MIT)

Copyright (c) 2017 Stephen

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

kameris-1.2.1-py2.py3-none-win_amd64.whl (1.6 MB view hashes)

Uploaded Python 2 Python 3 Windows x86-64

kameris-1.2.1-py2.py3-none-manylinux1_x86_64.whl (6.1 MB view hashes)

Uploaded Python 2 Python 3

kameris-1.2.1-py2.py3-none-macosx_10_6_intel.whl (416.9 kB view hashes)

Uploaded Python 2 Python 3 macOS 10.6+ intel

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page