.. image:: /ONT_logo.png
  :width: 800

******************

Rerio
"""""

Rerio is comprised of "research release" basecalling models and configuration files.
All models are compatible with Guppy (see `Nanopore Community page <https://community.nanoporetech.com/downloads>`_ for download/install instructions).
Since research models often utilise new features, the latest version of Guppy may be required.

The research models provide cutting-edge functions, speeds and accuracies that have not been productionised or validated by Oxford Nanopore Technologies in the Guppy executable basecaller. Nevertheless, models and config files can be run with the basecalling infrastructure in Guppy executable by using the instructions available in this repository.

Models are provided for DNA and RNA, various pore types and to basecall different modified bases in a variety of contexts.

Additionally, Rerio hosts research models for the short variant caller `Clair3 <https://github.com/HKU-BAL/Clair3>`_.


Features
--------

- New and advanced research models that are at the forefront of nanopore sequencing analyses (e.g. highest accuracies, quickest speeds, more modified basecalls in more contexts)
- Functions with `Megalodon <https://github.com/nanoporetech/megalodon>`_ (2.0 and above) to call modified DNA bases

**Note:** The results generated by research basecalling models have not been scrutinized nor validated and Oxford Nanopore cannot support each use case (see Research Release disclaimer)

*********************

Getting started
"""""""""""""""

Follow the instructions below to use research models with Guppy executable.
See further details for running Guppy `here <https://community.nanoporetech.com/protocols/Guppy-protocol>`_.

Dependencies
------------

You will require:

- Python-compatible environment (e.g. Terminal)
- The most recent Guppy version, available on the Nanopore Community `Software downloads page <https://community.nanoporetech.com/downloads>`_.

**Note:** Rerio is versioned by the minimum version of Guppy required to run _all_ models in the repository. 
A new release of Rerio will be tagged when a model is added that requires a more recent version of Guppy.


Installation
------------

Rerio can be downloaded by cloning from GitHub ``git clone https://github.com/nanoporetech/rerio``.
Once Rerio has been downloaded, models can be downloaded via the ``download_model.py`` script.

::

   # Download all models
   rerio/download_model.py
   # Download specific model(s)
   rerio/download_model.py rerio/basecall_models/res_dna_r941_min_modbases-all-context_v001

Once desired models have been downloaded, they can be run by specifying the Guppy data path option (``-d`` or ``--data_path``) and selecting the desired config file (``-c`` or ``--config``).

::

   ./ont-guppy/bin/guppy_basecaller -i fast5s/ -s basecalled_fast5s \
       -d ./rerio/basecall_models/ \
       -c res_dna_r941_min_modbases-all-context_v001.cfg

**************

Use and description of basecaller models
----------------------------------------

=============================================== ======= ====== ============== ============ ==========================
Config                                          DNA/RNA Pore   Device         Tested Guppy Notes
=============================================== ======= ====== ============== ============ ==========================
res_dna_r9.4.1_e8.1_{fast,hac,sup}_v033.cfg     DNA     R9.4.1 All            v5.0.11      Kit 12 E8.1 CRF Models
res_dna_r941_min_crf_v032.cfg                   DNA     R9.4.1 MinION/GridION v4.4.0       Bonito CRF
res_dna_r103_min_crf_v032.cfg                   DNA     R10.3  MinION/GridION v4.4.0       Bonito CRF
res_dna_r103_q20ea_crf_v033.cfg                 DNA     R10.3  PromethION     v5.0.11      Q20 early access CRF
res_dna_r103_q20ea_crf_v034.cfg                 DNA     R10.3  PromethION     v5.0.11      Q20 early access CRF
res_dna_r941_min_modbases_5mC_v001.cfg          DNA     R9.4.1 MinION/GridION v4.2.2       5mC in all context
res_dna_r941_prom_modbases_5mC_v001.cfg         DNA     R9.4.1 PromethION     v4.2.2       5mC in all context
res_dna_r103_prom_modbases_5mC_v001.cfg         DNA     R10.3  PromethION     v4.2.2       5mC in all context
res_dna_r941_min_modbases_5mC_5hmC_v001.cfg     DNA     R9.4.1 MinION/GridION v4.2.2       5hmC & 5mC in all context
res_dna_r941_min_flipflop_v001.cfg              DNA     R9.4.1 MinION/GridION v3.5.1
res_dna_r941_min_dUfast_v001.cfg                DNA     R9.4.1 MinION/GridION v3.5.1       Calls dU as dT (fast)
res_dna_r941_min_dUhac_v001.cfg                 DNA     R9.4.1 MinION/GridION v3.5.1       Calls dU as dT (high acc.)
res_dna_r941_min_rle_v001.cfg                   DNA     R9.4.1 MinION/GridION v3.5.1
res_dna_r103_min_flipflop_v001.cfg              DNA     R10.3  MinION/GridION v3.5.1
res_dna_r103_prom_rle_v001.cfg                  DNA     R10.3  PromethION     v3.5.1
res_rna2_r941_min_flipflop_v001.cfg             RNA2    R9.4.1 MinION/GridION v3.5.1
res_dna_r941_min_modbases-all-context_v001.cfg  DNA     R9.4.1 MinION/GridION v3.5.1       5mC & 6mA in all contexts
=============================================== ======= ====== ============== ============ ==========================

Megalodon Support
-----------------

Rerio research models can be run within megalodon by specifying the data directory in the ``--guppy-params`` argument.

::

   megalodon fast5s/ --guppy-params "-d ./rerio/basecall_models/" \
       --guppy-config res_dna_r941_min_modbases_5mC_5hmC_CpG_v001.cfg \
       --mod-motif mh CG 0

Barcoding Support
-----------------

The Rerio GitHub code repository includes a minimal barcoding stub to allow Guppy to run successfully.
In order to enable full Guppy barcoding capabilities, all barcoding files must be transferred from the guppy data directory to the rerio data directory.

::

   cp ont-guppy/data/barcoding/* rerio/basecall_models/barcoding/

Taiyaki Models
--------------

Taiyaki checkpoint files corresponding to Rerio research models are provided.
Not all of these are compatible with the public release of Taiyaki.

::

    #  Download all models
    python3 download_models.py --checkpoints
    #  Download particular model
    python3 download_models.py taiyaki_checkpoint/model


*********************

Clair3 Models
-------------

Clair3 models for the following configurations are available:

================== ========== ================
Config             Chemistry  Guppy basecaller
================== ========== ================
r104_e81_sup_g5015 R10.4 E8.1 v5.0.15 SUP
r104_e81_hac_g5015 R10.4 E8.1 v5.0.15 HAC
================== ========== ================

::

    #  Download all models
    python3 download_models.py --clair3
    #  Download particular model
    python3 download_models.py clair3_models/model

Each model will be downloaded to the folder ``clair3_models/ont_{config}``.

*******

Help
""""

Licence and Copyright
---------------------

|copy| 2020, 2021 Oxford Nanopore Technologies Ltd.

.. |copy| unicode:: 0xA9 .. copyright sign

Rerio 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.
