Skip to content

rbturnbull/terrier

https://raw.githubusercontent.com/rbturnbull/terrier/main/docs/images/terrier-banner.png

PyPI - Version colab badge testing badge docs badge black badge torchapp badge doi badge

Transposable Element Repeat Result classifIER

Terrier is a Neural Network model to classify transposable element sequences.

It is based on ‘corgi’ which was trained to do hierarchical taxonomic classification of DNA sequences.

This model was trained using the Repbase library of repetitive DNA elements and trained to do hierarchical classification according to the RepeatMasker schema.

An online version of Terrier (using CPUs only) is available at https://portal.cpg.unimelb.edu.au/tools/terrier.

Installation

Install using pip:

pip install bio-terrier

Warning

Do not try just pip install terrier because that is a different package.

Or install the latest version from GitHub:

pip install git+https://github.com/rbturnbull/terrier.git

Google Colab Version

Follow this link to launch a Google Colab notebook where you can run the model on your own data: colab badge2

Usage

To run inference on a FASTA file, run this command:

terrier --file INPUT.fa --output-fasta OUTPUT.fa

That will add the classification to after the sequence ID in the OUTPUT.fa FASTA file.

If you want to save the probabilities for all classes run this:

terrier --file INPUT.fa --output-csv OUTPUT.csv

The columns will be the probability of each classification and the rows correspond to each sequence in INPUT.fa.

If you want to output a visualization of the prediction probabilities:

terrier --file INPUT.fa --image-dir OUTPUT-IMAGES/

The outputs for the above can be combined together. For more options run

terrier --help

To see the options to train the model, run:

terrier-tools --help

Programmatic Usage

You can also use the model programmatically:

from terrier import Terrier

terrier = Terrier()
terrier(file="INPUT.fa", output_fasta="OUTPUT.fa")

Potential Use Case

A potential workflow is to use RepeatModeler first to generate a repeat library. Then you can use Terrier to attempt to classify the remaining unknown repeats. If you only want highly confident classifications from Terrier, you can set the threshold to 0.9 or higher. If you wish to have more coverage, then you can set the threshold lower (or keep it at the default value of 0.7). The modified repeat library can then be used with RepeatMasker to mask the repeats in your genome assembly.

Credits

Terrier was developed by:

If you use this software, please cite the following preprint:

Robert Turnbull, Neil D. Young, Edoardo Tescari, Lee F. Skerratt, and Tiffany A. Kosch. (2025). 'Terrier: A Deep Learning Repeat Classifier'. arXiv:2503.09312.

Wytamma Wirth set up Terrier as a tool at the Centre for Pathogen Genomics Portal at the University of Melbourne.

This command will generate a bibliography for the Terrier project.

terrier --bibliography

Here it is in BibTeX format:

@article{terier,
    author = {Turnbull, Robert and Young, Neil D and Tescari, Edoardo and Skerratt, Lee F and Kosch, Tiffany A},
    title = {Terrier: a deep learning repeat classifier},
    journal = {Briefings in Bioinformatics},
    volume = {26},
    number = {4},
    pages = {bbaf442},
    year = {2025},
    month = {08},
    abstract = {Repetitive DNA sequences underpin genome architecture and evolutionary processes, yet they remain challenging to classify accurately. Terrier is a deep learning model designed to overcome these challenges by classifying repetitive DNA sequences using a publicly available, curated repeat sequence library trained under the RepeatMasker schema. Poor representation of taxa within repeat databases often limits the classification accuracy and reproducibility of current repeat annotation methods, limiting our understanding of repeat evolution and function. Terrier overcomes these challenges by leveraging deep learning for improved accuracy. Trained on Repbase, which includes over 100,000 repeat families—four times more than Dfam—Terrier maps 97.1\% of Repbase sequences to RepeatMasker categories, offering the most comprehensive classification system available. When benchmarked against DeepTE, TERL, and TEclass2 in model organisms (rice, fruit flies, humans, and mice), Terrier achieved superior accuracy while classifying a broader range of sequences. Further validation in non-model amphibian, flatworm, and Northern krill genomes highlights its effectiveness in improving classification in non-model species, facilitating research on repeat-driven evolution, genomic instability, and phenotypic variation.},
    issn = {1477-4054},
    doi = {10.1093/bib/bbaf442},
    url = {https://doi.org/10.1093/bib/bbaf442},
    eprint = {https://academic.oup.com/bib/article-pdf/26/4/bbaf442/64143069/bbaf442.pdf},
}

Run the following command to get the latest BibTeX entry:

terrier --bibtex

This will be updated with the final publication details when available.

Created using torchapp (https://github.com/rbturnbull/torchapp).

About

Transposable Element Repeat Result classifIER

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages