Package: trtools
TRToolsTRTools includes a variety of utilities for filtering, quality control and analysis of tandem repeats downstream of genotyping them from next-generation sequencing. It supports multiple recent genotyping tools (see below).See full documentation and examples athttps://trtools.readthedocs.io/en/stable/.If you use TRTools in your work, please cite: Nima Mousavi, Jonathan Margoliash, Neha Pusarla, Shubham Saini, Richard Yanicky, Melissa Gymrek. (2020) TRTools: a toolkit for genome-wide analysis of tandem repeats. Bioinformatics. (https://doi.org/10.1093/bioinformatics/btaa736)InstallNote: TRTools supports Python versions 3.8 and up. We do not officially support python version 3.7 as it isend of life, but we believe TRTools likely works with it from previous testing results.With condaconda install -c conda-forge -c bioconda trtoolsOptionally installbcftoolswhich is used to prepare input files for TRTools (andARTwhich is used by simTR) by running:conda install -c conda-forge -c bioconda bcftools artWith pipFirst installhtslib(which containstabixandbgzip). Optionally installbcftools.
These are used to prepare input files for TRTools and aren’t installed by pip.Then run:pip install --upgrade pip
pip install trtoolsNote: TRTools installation may fail for pip version 10.0.1, hence the need to upgrade pip firstNote: if you will run or testsimTR, you will also need to installART. The simTR tests will only run if the executableart_illuminais found on yourPATH. If it has been installed,which art_illuminashould return a path.From sourceTo install from source (only recommended for development) clone the TRTools repository fromgithuband checkout the branch you’re interested in:git clone -b master https://github.com/gymrek-lab/TRTools
cd TRTools/Now, create 1) a conda environment with our development tools and 2) a virtual environment with our dependencies and an editable install of TRTools:conda env create -n trtools -f dev-env.yml
conda run -n trtools poetry installNow, whenever you’d like to run/import pytest or TRTools, you will first need to activate both environments:conda activate trtools
poetry shellWith DockerPlease refer tothe biocontainers registry for TRToolsfor all of our images. To use the most recent release, run the following command:docker pull quay.io/biocontainers/trtools:latestToolsTRTools includes the following tools.mergeSTR: a tool to merge VCF files across multiple samples genotyped using the same tooldumpSTR: a tool for filtering VCF files with TR genotypesqcSTR: a tool for generating various quality control plots for a TR callsetstatSTR: a tool for computing various statistics on VCF filescompareSTR: a tool for comparing TR callsetsassociaTR: a tool for testing TR length-phenotype associations (e.g., running a TR GWAS)prancSTR: a tool for identifying somatic mosacisim at TRs. Currently only compatible with HipSTR VCF files. (beta mode)simTR: a tool for simulating next-generation sequencing reads from TR regions. (beta mode)Type<command> --helpto see a full set of options.It additionally includes a python library,trtools, which can be accessed from within Python scripts. e.g.:import trtools.utils.utils as stls
allele_freqs = {5: 0.5, 6: 0.5} # 50% of alleles have 5 repeat copies, 50% have 6
stls.GetHeterozygosity(allele_freqs) # should return 0.5UsageWe recommend new users start with the example commands described in thecommand-line interface for each tool.
We also suggest going through ourvignettesthat walk through some example workflows using TRTools.Supported TR CallersTRTools supports VCFs from the following TR genotyping tools:AdVNTRExpansionHunterGangSTRversion 2.4 or higherHipSTRPopSTRversion 2 or higherSee our description of thefeatures and example use-casesof each of these tools.TestingAfter you’ve installed TRTools, we recommend running our tests to confirm that TRTools works properly on your system. Just execute the following:test_trtools.shDevelopment NotesTRTools only currently supports diploid genotypes. Haploid calls, such as those on male chrX or chrY, are not yet supported but should be coming soon.Contact UsPlease submit an issue on thetrtools githubContributingWe appreciate contributions to TRTools. If you would like to contribute a fix or new feature, follow these guidelines:Considerdiscussingyour solution with us first so we can provide help or feedback if necessary.Install TRTools from sourceas above.Fork the TRTools repository.Create a branch off ofmastertitled with the name of your feature.Make your changes.If you need to add a dependency or update the version of a dependency, you can use thepoetry addcommand.You should specify aversion constraintwhen adding a dependency. Use the oldest version compatible with your code. Don’t worry if you’re not sure at first, since you can (and should!) always update it later. For example, to specify a version ofnumpy>=1.23.0, you can runpoetry add 'numpy>=1.23.0'.Afterwards, double-check that thepoetry.lockfile contains 1.23.0 in it.All of our dependencies should be locked to their minimum versions at all times.To downgrade to a specific version ofnumpyin our lock file, you can explicitly add the version viapoetry add 'numpy==1.23.0', manually edit the pyproject.toml file to use a>=sign in front of the version number, and then runpoetry lock --no-update.Document your changes.Ensure all functions, modules, classes etc. conform tonumpy docstring standards.If applicable, update the REAMDEs in the directories of the files you changed with new usage information.New doc pages forthe websitecan be created under<project-root>/docand linked to as appropriate.If you have added significant amounts of documentation in any of these ways, build the documentation locally to ensure it looks good.cdto thedocdirectory and runmake clean && make html, then viewdoc/_build/html/index.htmland navigate from thereAdd tests to test any new functionality. Add them to thetests/folder in the directory of the code you modified.cdto the root of the project and runpoetry run pytest --cov=. --cov-report term-missingto make sure that (1) all tests pass and (2) any code you have added is covered by tests. (Code coverage maynotgo down).cdto the root of the project and runnoxto make sure that the tests pass on all versions of python that we support.Submit a pull request (PR)to the master branchof the central repository with a description of what changes you have made. Prefix the title of the PR according to theconventional commits spec.
A member of the TRTools team will reply and continue the contribution process from there, possibly asking for additional information/effort on your part.If you are reviewing a pull request, please double-check that the PR addresses each item inour PR checklistPublishingIf you are a TRTools maintainer and wish to publish changes and distribute them to PyPI and bioconda, please see PUBLISHING.rst in the root of the git repo.
If you are a community member and would like that to happen, contact us (see above).