Skip to main content

Map profile HMMs of transposon termini to genomic sequences for annotation of cryptic transposon variants.

Project description

License: GPL v3 PyPI version codecov install with bioconda Downloads

TIRmite

Autonomous examples of transposons, belonging to many distinct superfamilies, share two features: A gene or genes encoding the mode of transposition; and terminal sequence features that are recognised by said gene products as the element boundaries.

Proper classification of transposons and grouping into families relies on both phylogeny of conserved sequences and conservation of transposition mechanism.

However, not all TE instances are created equal — inhabiting the nulear soup of their host genome, where your brother's transposase is as good as your own, non-autonomous variants lacking their own functional hardware proliferate.

MITEs are a classic example of this - derived from autonomous DNA elements with Terminal Inverted Repeats, they are Miniature Inverted-repeat Transposable Elements, sometimes little more than a pair of TIRs.

When non-autonomous structural variants of a TE vastly outnumber their parent element, and include forms that capture novel genes (or other full transposons!), it becomes difficult to correctly cluster related elements based on the limited signal present in terminal sequences (TIRs, LTRs, etc).

TIRmite employs profile Hidden Markov Models (HMMs) to model natural variation in transposon termini and recover divergent and degraded hits that are often missed by sequence-based aligners like BLAST.

An iterative pairing algorithm is then used to annotate cryptic transposon variants with variable internal sequence compositions.

Table of contents

About TIRmite

TIRmite will use profile-HMM models of Transposon Terminal Repeats for genome-wide annotation of transposon families. You can search for TE families with symmetrical termini (i.e. TIRs or LTRs) or asymmetrical elements with different conserved features at either end (i.e. Helitrons, Helentrons, and Starship elements).

Three classes of output are produced:

  1. All significant termini hit sequences are written to fasta (per query HMM).
  2. Candidate elements comprised of paired termini are written to fasta (per query HMM).
  3. Genomic annotations of candidate elements and, optionally, HMM hits (paired and unpaired) are written as a single GFF3 file.

Options and usage

Installing TIRmite

TIRmite requires Python >= v3.8

Dependencies:

You can create a Conda environment with these dependencies using the environment.yml file in this repo.

conda env create -f environment.yml

conda activate tirmite

Installation options:

  1. pip install the latest development version directly from this repo.
pip install git+https://github.com/Adamtaranto/TIRmite.git
  1. Install latest release from PyPi.
pip install tirmite
  1. Install latest release (with dependencies) from Bioconda.
conda install -c bioconda tirmite

Test installation.

# Print version number and exit.
% tirmite --version
tirmite 1.3.0

# Get usage information
% tirmite --help

Example usage

First, you will need to build a pHMM of your element's terminal sequence/s.

If you have a draft TE model (i.e. from RepeatModeler or EDTA) and want to identify the TIR's or LTR's to use with TIRmite - I recommend using tSplit a tool for extraction of terminal repeats from complete transposons.

  1. Extract single TIR from sample element:
# Uses BLASTn to detect TIRs of min 40% identity and min 10 bp length
tsplit TIR -i TIR_element.fa -d tsplit_results --minid 0.4 --method blastn --minterm 10 --splitmode external
  1. Build a pHMM from the seed:
GENOME="genome.fa" # Path to fasta containing one or more genomes to search for matches to seed sequence.

tirmite seed --left-seed tsplit_results/TIR_element_tsplit_output.fasta --model-name MY_TIR --outdir MY_TIR_HMM --genome $GENOME --max-gap 10 --save-blast-hits --threads 8

# Note: Setting `--flank-size 10` will output additional flanking bases outside the TIR, conservation in the flank accross many independent insertions may indicate your seed was truncated. Always check and adjust seed as required.
  1. Use nhmmer to locate hits to the TIR-pHMM in a target genome.
HMMFILE="MY_TIR_HMM/MY_TIR.hmm"
NHMMERFILE="MY_TIR_nhmmer_hits.tab"
nhmmer --dna --cpu 8 --tblout $NHMMERFILE $HMMFILE $GENOME

Custom DNA Matrices

Note: nhmmer can be supplied with custom DNA score matrices for assessing hmm match scores. Standard NCBI-BLAST matrices such as NUC.4.4 are compatible. (See: ftp://ftp.ncbi.nlm.nih.gov/blast/matrices/NUC.4.4)

  1. Use tirmite pair to identify valid TIR pairs. Outputs hits, elements, and annotations.
tirmite pair --genome $GENOME  --nhmmerFile $NHMMERFILE --hmmFile $HMMFILE --orientation F,R --mincov 0.4 --report all  --maxdist 20000 --stableReps 2 --outdir MY_TIR_PAIRING_OUTPUT --padlen 20 --maxeval 0.001 --gffOut --logfile

Legacy mode

TIRmite legacy mode will take a TIR-pHMM and target genome fasta as input and run the full standard workflow, reporting all hits, valid pairings, and write GFF3 annotation file.

Note: This usage will be phased out in a later release in favour of custom workflows.

# Use HMM search to pull more divergent TIR hits from your query genome.
# TIR hits are paired in Fwd/Rev orientation
# Fwd/Rev pairs must be within 20Kbp of each other
# Hits must cover >= 40% of the TIR-pHMM
tirmite legacy --genome $GENOME --hmmFile $HMMFILE--orientation F,R \
--outdir results \
--stableReps 2 \
--report all \
--gffOut --maxdist 20000 --mincov 0.4

If you don't have a HMM of your TIR, tirmite legacy can create one for you using an aligned sample of your TIR provided with --alnFile.

TIRs should always be oriented 5`- 3` with the lefthand TIR.

In this example the two TIRs should be oriented to begin with "GA".

5` GA>>>>>>> ATGC <<<<<<<TC 3` 3` CT>>>>>>>> TACG <<<<<<<AG 5`

Standard options

Run tirmite --help to view the program's most commonly used options:

tirmite --help
usage: tirmite [-h] [--version] COMMAND ...

TIRmite: Transposon Terminal Repeat detection suite

positional arguments:
  COMMAND     Available subcommands
    legacy    Original TIRmite workflow (HMM search + pairing)
    seed      Build HMM models from seed sequences
    pair      Pair precomputed nhmmer hits

options:
  -h, --help  show this help message and exit
  --version   show program's version number and exit

Available subcommands:
  legacy    Original TIRmite workflow (HMM search + pairing)
  seed      Build HMM models from seed sequences
  pair      Pair precomputed nhmmer hits

Examples:
  tirmite legacy --genome genome.fa --hmmFile model.hmm
  tirmite seed --left-seed left.fa --model-name myTE --genome genome.fa
  tirmite pair --genome genome.fa --nhmmerFile hits.out --hmmFile model.hmm

Algorithm overview

  1. Use nhmmer to query genome with termini HMMs.
  2. Import all hits under --maxeval threshold.
  3. For each significant terminus match, identify candidate partners, where: - Hit is on the same sequence. - Hit is in coreect relative orientation. - Distance is <= --maxdist. - Hit length is >= (model length * --mincov prop)
  4. Rank candidate partners by distance downstream of positive-strand hits, and upstream of negative-strand hits.
  5. Pair reciprocal top candidate hits.
  6. For unpaired hits, find nearest unpaired candidate partner and check for reciprocity.
  7. If the first unpaired candidate is non-reciprocal, check for 2nd-order reciprocity (is outbound top-candidate of current candidate reciprocal.)
  8. Iterate steps 6-7 until all termini hits are paired OR number of iterations without new pairing exceeds --stableReps.

Contributing

If you would like to add a new feature or fix a bug, please see our contribution guidelines.

  • Open an issue
  • Fork the repo
  • Follow the dev env setup instructions below
# Clone this repo (or your own fork)
git clone https://github.com/Adamtaranto/TIRmite.git && cd TIRmite
# Install custom conda env
conda env create -f environment.yml
# Activate conda env
conda activate tirmite
# Install an editable copy of the package
pip install -e '.[dev]'
# Enable pre-commit checks
pre-commit install

Issues

Submit feedback to the Issue Tracker

License

Software provided under GPL-3 license.

Star History

Star History Chart

Project details


Download files

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

Source Distribution

tirmite-1.3.0.tar.gz (276.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tirmite-1.3.0-py3-none-any.whl (88.5 kB view details)

Uploaded Python 3

File details

Details for the file tirmite-1.3.0.tar.gz.

File metadata

  • Download URL: tirmite-1.3.0.tar.gz
  • Upload date:
  • Size: 276.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.12.12 HTTPX/0.28.1

File hashes

Hashes for tirmite-1.3.0.tar.gz
Algorithm Hash digest
SHA256 37fa0aaff11de3526cc3495a1782774e1fe533817c5baca22d18e7f54aebfa90
MD5 885b30f8d9c42a1cef66cf16d5c76eac
BLAKE2b-256 132149e8642cad460a25f5656716d17fce8acefa946fb4f1497541f240b14d14

See more details on using hashes here.

File details

Details for the file tirmite-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: tirmite-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 88.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.16.2 cpython/3.12.12 HTTPX/0.28.1

File hashes

Hashes for tirmite-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3887bdd3a172327a0194d380900f3d452df419c766abfdaf40dc644d3b3db6e2
MD5 4f26cc068a2979173a009af21baafed1
BLAKE2b-256 c3aa47bd33fddaa96ed7db5daea3adedfa68a23f3e4edc668930bc788931f512

See more details on using hashes here.

Supported by

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