A fast, user-friendly analysis and evaluation pipeline for some DNA sequence classification tasks.
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):
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
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
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.
- 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.
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
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.
- Create an empty folder and open a terminal in the folder.
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".
output/hiv1-lanl-whole. You will notice folders were created for each value of
k. Within each folder are several files:
fastacontains the FASTA files extracted from the downloaded dataset used for model training and evaluation.
metadata.jsoncontains metadata on the FASTA files used to determine the class for each sequence.
cgrs.mm-reprcontains 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.jsoncontains evaluation results after using cross-validation on the dataset. See the mentioned paper for more technical details.
.mm-modelfiles contain trained models which may be passed to
kameris classifyin order to classify new sequences. Note that models trained using Python 2 will not run under Python 3 and vice-versa.
log.txtis a log file containing all the output printed during job execution.
rerun-experiment.ymlis a file which may be passed to
kameris run-jobin 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
After making changes, run
kameris run-job hiv1-lanl.yml settings.yml to train your model.
This project uses:
- stephensolis/kameris-backend to generate k-mer count vectors and distance matrices
- scikit-learn for supervised classifiers
- Wolfram Mathematica and code based on stephensolis/modmap-generator to generate interactive plots
- NumPy and SciPy for MultiDimensional Scaling (MDS)
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.