a python package for finding tandem repeats from genomic sequences
  • C 59.2%
  • Python 29.1%
  • Shell 11.7%
Find a file
2026-06-11 21:33:39 +08:00
.github/workflows Update wheel.yml 2026-06-11 21:23:56 +08:00
benchmark Update perfect_imperfect_benchmark.sh 2025-02-25 20:57:53 +08:00
docs Update changelog.rst 2026-06-11 21:33:39 +08:00
src bump to 1.5.0 2026-06-11 21:01:38 +08:00
tests update 2024-09-24 20:00:06 +08:00
.gitignore bump to 1.5.0 2026-06-11 21:01:38 +08:00
.readthedocs.yaml added seq attribute 2023-09-16 22:20:25 +08:00
atrfinder.py update 2024-09-24 20:00:06 +08:00
LICENSE Create LICENSE 2021-04-26 23:18:43 +08:00
MANIFEST.in update objects 2023-05-04 21:43:05 +08:00
pytrfcli.py bump to 1.5.0 2026-06-11 21:01:38 +08:00
README.rst Update README.rst 2026-06-11 21:09:42 +08:00
requirements.txt bump to 1.5.0 2026-06-11 21:01:38 +08:00
setup.py bump to 1.5.0 2026-06-11 21:01:38 +08:00
test.py Update test.py 2024-12-05 16:48:11 +08:00

Pytrf
#####

.. image:: https://github.com/lmdu/pytrf/actions/workflows/wheel.yml/badge.svg
   :target: https://github.com/lmdu/pytrf/actions/workflows/wheel.yml
   :alt: Github Action

.. image:: https://readthedocs.org/projects/pytrf/badge/?version=latest
   :target: https://pytrf.readthedocs.io/en/latest/?badge=latest
   :alt: Readthedocs

.. image:: https://img.shields.io/pypi/v/pytrf.svg
   :target: https://pypi.org/project/pytrf
   :alt: PyPI

.. image:: https://img.shields.io/pypi/pyversions/pytrf
	:target: https://pypi.org/project/pytrf
	:alt: PyPI

.. image:: https://app.codacy.com/project/badge/Grade/bbe59e55f686465ca5824c69583e9718
	:target: https://app.codacy.com/gh/lmdu/pytrf/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade

*a fast Python package for finding tandem repeat sequences*

Introduction
============

A Tandem repeat (TR) in genomic sequence is a set of adjacent short DNA
sequence repeated consecutively. The pytrf is a lightweight Python C extension for identification of tandem repeats. The pytrf enables to fastly identify both exact
or perfect SSRs. It also can find generic tandem repeats with any size of motif,
such as with maximum motif length of 100 bp. Additionally, it has capability of finding approximate or imperfect tandem repeats. Furthermore, the pytrf not only can be used as Python package but also provides command line interface for users to facilitate the identification of tandem repeats.

Note: pytrf is not a Python binding to common used tool `TRF <https://tandem.bu.edu/trf/trf.html>`_.

Usage
=====

The pytrf can be used as Python package. It requires `pyfastx <https://github.com/lmdu/pyfastx>`_ to parse FASTA or FASTQ file.

.. code:: python

	>>> import pytrf
	>>> import pyfastx
	>>> fa = pyfastx.Fastx('test.fa', uppercase=True):
	>>> for name, seq in fa:
	>>> 	for ssr in STRFinder(name, seq):
	>>> 		print(ssr.as_string())

Command line
============

The pytrf also provides command line tools for you to find tandem repeats from given FASTA or FASTQ file.

.. code:: sh

	pytrf -h

	usage: pytrf command [options] fastx

	a python package for finding tandem repeats from genomic sequences

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

	commands:

	    findstr      find exact or perfect short tandem repeats
	    findgtr      find exact or perfect generic tandem repeats
	    findatr      find approximate or imperfect tandem repeats
	    extract      get tandem repeat sequence and flanking sequence

For example:

.. code:: sh

	pytrf findstr test.fa

Documentation
=============

For more detailed usage, see our manual: `https://pytrf.readthedocs.io <https://pytrf.readthedocs.io>`_

Citation
========

`Du et al. Pytrf: a python package for finding tandem repeats from genomic sequences. BMC Bioinformatics, 2025, 26: 151 <https://doi.org/10.1186/s12859-025-06168-3>`_