GithubHelp home page GithubHelp logo

lucidrains / bonito Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nanoporetech/bonito

2.0 2.0 0.0 831 KB

A PyTorch Basecaller for Oxford Nanopore Reads

Home Page: https://nanoporetech.com/

License: Other

Python 83.57% Jupyter Notebook 14.94% Makefile 1.49%

bonito's Introduction

Bonito

PyPI version

A PyTorch Basecaller for Oxford Nanopore Reads.

$ pip install ont-bonito
$ bonito basecaller dna_r9.4.1 /data/reads > basecalls.fasta

If a reference is provided in either .fasta or .mmi format then bonito will output in sam format.

$ bonito basecaller dna_r9.4.1 --reference reference.mmi /data/reads > basecalls.sam

The default ont-bonito package is built against CUDA 10.2 however a CUDA 11.1 build is available.

$ pip install -f https://download.pytorch.org/whl/torch_stable.html ont-bonito-cuda111

Developer Quickstart

$ git clone https://github.com/nanoporetech/bonito.git  # or fork first and clone that
$ cd bonito
$ python3 -m venv venv3
$ source venv3/bin/activate
(venv3) $ pip install --upgrade pip
(venv3) $ pip install -r requirements.txt
(venv3) $ python setup.py develop
(venv3) $ bonito download --models --latest

Models

The following pretrained models are available to download with bonito download.

Model Type Bonito Version
[email protected], [email protected] CRF-CTC RNN (fixed blank score) v0.3.7
[email protected], [email protected] CRF-CTC RNN v0.3.6
dna_r10.3@v3 CRF-CTC RNN v0.3.2
[email protected] CRF-CTC RNN v0.3.1
dna_r9.4.1@v3 CRF-CTC RNN v0.3.0
dna_r9.4.1@v2 CTC CNN (Custom QuartzNet) v0.2.0
dna_r9.4.1@v1 CTC CNN (5x5 QuartzNet) v0.1.2

All models can be downloaded with bonito download --models or if you just want the latest version then bonito download --models --latest -f.

Training your own model

To train a model using your own reads, first basecall the reads with the additional --save-ctc flag and use the output directory as the input directory for training.

$ bonito basecaller dna_r9.4.1 --save-ctc --reference reference.mmi /data/reads > /data/training/ctc-data/basecalls.sam
$ bonito train --directory /data/training/ctc-data /data/training/model-dir

In addition to training a new model from scratch you can also easily fine tune one of the pretrained models.

bonito train --epochs 1 --lr 5e-4 --pretrained [email protected] --directory /data/training/ctc-data /data/training/fine-tuned-model

If you are interested in method development and don't have you own set of reads then a pre-prepared set is provide.

$ bonito download --training
$ bonito train /data/training/model-dir

All training calls use Automatic Mixed Precision to speed up training. To disable this, set the --no-amp flag to True.

Duplex

Duplex calling takes template and complement reads and produces a single higher quality call.

$ bonito duplex dna_r9.4.1 /data/reads --pairs pairs.txt --reference ref.mmi > basecalls.sam

The pairs.csv file is expected to contain pairs of read ids per line (seperated by a single space).

Follow on reads can also be automatically paired if an alignment summary file is provided instead of a pairs.csv.

$ bonito duplex dna_r9.4.1 /data/reads --summary sequencing_summary.txt --reference ref.mmi > basecalls.sam

Interface

  • bonito view - view a model architecture for a given .toml file and the number of parameters in the network.
  • bonito train - train a bonito model.
  • bonito convert - convert a hdf5 training file into a bonito format.
  • bonito evaluate - evaluate a model performance.
  • bonito download - download pretrained models and training datasets.
  • bonito basecaller - basecaller (.fast5 -> .fasta).

References

Licence and Copyright

(c) 2019 Oxford Nanopore Technologies Ltd.

Bonito is distributed under the terms of the Oxford Nanopore Technologies, Ltd. Public License, v. 1.0. If a copy of the License was not distributed with this file, You can obtain one at http://nanoporetech.com

Research Release

Research releases are provided as technology demonstrators to provide early access to features or stimulate Community development of tools. Support for this software will be minimal and is only provided directly by the developers. Feature requests, improvements, and discussions are welcome and can be implemented by forking and pull requests. However much as we would like to rectify every issue and piece of feedback users may have, the developers may have limited resource for support of this software. Research releases may be unstable and subject to rapid iteration by Oxford Nanopore Technologies.

bonito's People

Contributors

chawater avatar cjw85 avatar davidcpage avatar epislim avatar iiseymour avatar lucidrains avatar rmp avatar sirelkhatim avatar sry002 avatar vellamike avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.