Python bindings around the TM-align code for structural alignment of proteins
Project description
TM-Tools
Python bindings for the TM-align algorithm and code developed by Zhang et al for protein structure comparison.
Installation
You can install the released version of the package directly from PyPI by running
pip install tmtools
Pre-built wheels are available for Linux, macOS, and Windows, for Python 3.6 and up.
To build the package from scratch, e.g. because you want to contribute to it, clone this repository, and then from the root of the repository, run
pip install -e . -v
This requires a C++ compiler to be installed with support for C++ 14.
Usage
The function tmtools.tm_align
takes two NumPy arrays with coordinates for the
residues (with shape (N, 3)
) and two sequences of peptide codes, performs the
alignment, and returns the optimal rotation matrix and translation, along with
the TM score:
>>> import numpy as np
>>> from tmtools import tm_align
>>>
>>> coords1 = np.array(
... [[1.2, 3.4, 1.5],
... [4.0, 2.8, 3.7],
... [1.2, 4.2, 4.3],
... [0.0, 1.0, 2.0]])
>>> coords2 = np.array(
... [[2.3, 7.4, 1.5],
... [4.0, 2.9, -1.7],
... [1.2, 4.2, 4.3]])
>>>
>>> seq1 = "AYLP"
>>> seq2 = "ARN"
>>>
>>> res = tm_align(coords1, coords2, seq1, seq2)
>>> res.t
array([ 2.94676159, 5.55265245, -1.75151383])
>>> res.u
array([[ 0.40393231, 0.04161396, -0.91384187],
[-0.59535733, 0.77040999, -0.22807475],
[ 0.69454181, 0.63618922, 0.33596866]])
>>> res.tm_norm_chain1
0.3105833326322145
>>> res.tm_norm_chain2
0.414111110176286
If you already have some PDB files, you can use the functions from tmalign.io
to retrieve the coordinate and sequence data. These functions rely on
BioPython
, which is not installed by default to keep dependencies
lightweight. To use them, you have to install BioPython
first (pip install biopython
). Then run:
>>> from tmtools.io import get_structure, get_residue_data
>>> from tmtools.testing import get_pdb_path
>>> s = get_structure(get_pdb_path("2gtl"))
>>> s
<Structure id=2gtl>
>>> chain = next(s.get_chains())
>>> coords, seq = get_residue_data(chain)
>>> seq
'DCCSYEDRREIRHIWDDVWSSSFTDRRVAIVRAVFDDLFKHYPTSKALFERVKIDEPESGEFKSHLVRVANGLKLLINLLDDTLVLQSHLGHLADQHIQRKGVTKEYFRGIGEAFARVLPQVLSCFNVDAWNRCFHRLVARIAKDLP'
>>> coords.shape
(147, 3)
Credits
This package arose out of a personal desire to better understand both the TM-score algorithm and the pybind11 library to interface with C++ code. At this point in time it contains no original research code.
If you use the package for research, you should cite the original TM-score papers:
- Y. Zhang, J. Skolnick, Scoring function for automated assessment of protein structure template quality, Proteins, 57: 702-710 (2004).
- J. Xu, Y. Zhang, How significant is a protein structure similarity with TM-score=0.5? Bioinformatics, 26, 889-895 (2010).
License
The original TM-align software (version 20210224, released under the MIT
license) is bundled with this repository (src/extern/TMalign.cpp
). Some small
tweaks had to be made to compile the code on macOS and to embed it as a
library. This modifications are also released under the MIT license.
The rest of the codebase is released under the GPL v3 license.
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
Built Distributions
Hashes for tmtools-0.1.1-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bf1064fe00620a822e6cac4aced488e6ccc9cb27da34ebdf7a45099d8aded71 |
|
MD5 | 8688c59b4881c4bf542eb832aeeb45cf |
|
BLAKE2b-256 | eb1e254bb3136e3d40235dc359595123a937c7bd0f97c1f18d0945d9bafc0135 |
Hashes for tmtools-0.1.1-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26b46a1d5a1de47b6dbe0fae6a4b0b5a42dfa8b57dc265df68bf1bfb3612837f |
|
MD5 | 5b459a654fd2ae38ff0bb47cc781a5cf |
|
BLAKE2b-256 | fbdf9fdf1e5c3d7e83f59cedf0e1bbe89ba0f9a17c77cd6b03039cddffb71596 |
Hashes for tmtools-0.1.1-cp312-cp312-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70ed54af0bd989b3d0845d951c10374bcddb92bbf95dbd18b633537b77d13594 |
|
MD5 | fbdafa32b01d93420e93a8136d5e9ed1 |
|
BLAKE2b-256 | cabc188056275cca4bc9ed3d111e348155bbdc4b8673f5c9de7fc5c8e445f728 |
Hashes for tmtools-0.1.1-cp312-cp312-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | be27b224d7bf464e319e9a3806b6ef91b4faf0e8b5d4b542f21cfc115d001eee |
|
MD5 | c877c08f443c23843b749413adf2621d |
|
BLAKE2b-256 | daf3236c9845c44a601eb1cba80690ae4f6e54177228975676836cf6d40c56a8 |
Hashes for tmtools-0.1.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c4147ed91f63b2e1b1ca1f1f5d8788926ee7e62ef61d9a3d1030e6f44e4a05a |
|
MD5 | 27fd69f3ace74f67352eeb3836437c83 |
|
BLAKE2b-256 | b8580aedebc9475f2af442cebff9ebc22069cfbeff468cdc342ed64f9c818bdc |
Hashes for tmtools-0.1.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 388594fb9d4a1c623547060e8c5989f07c412eaaebe27367d1e8d9d183512cba |
|
MD5 | f1ee3895c4745327e9227568c5dc5fdd |
|
BLAKE2b-256 | f958cd209d6b157ca440a5ee69e74728bddc23a9562874ca3db53186c46518d4 |
Hashes for tmtools-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1151a826665dfc040b5c01bd279b9f89280f37430330351886a208add79d6a9b |
|
MD5 | d5d5ebc16c02146d931c2b10ea54e20d |
|
BLAKE2b-256 | ff8fcfdb32a7d8a45db6f47ab70b8c812facd62b571b7c179c3f54b18b2453a0 |
Hashes for tmtools-0.1.1-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49293d406833d9ceb0d6b5660f26c5b9ca276908f1a9fdb1f435f91b845f88b5 |
|
MD5 | 12e5ba2d26c7e23105abe665bbcf7a82 |
|
BLAKE2b-256 | 94582a008a60293517aa43731a8240a521ea380b8c250ebe91796233fcdb1f36 |
Hashes for tmtools-0.1.1-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0501d196fbae01c2ea15a968731e44e71a14fb78e47d363d3073d9fb945bc9d8 |
|
MD5 | 684fd518cfd06620c8af8639f68e0aad |
|
BLAKE2b-256 | e0c96b36b49a41074ecb21f75eaacfbc27dd997fd3d27adcbce75c2a1339ebc5 |
Hashes for tmtools-0.1.1-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e5dd70aec1f82650dd2368126b69f5dc2a635966ce2b59a62d73b42014e7d51 |
|
MD5 | 52f7d271587a2b0e63d8f703f63a4c3b |
|
BLAKE2b-256 | dabc1b2c1a465c31596674178882b82b03aefe677cf24390df743c537c0d5c6b |
Hashes for tmtools-0.1.1-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c78b72f41920306e0b4f6dd388b0bff84cf1a253e1c349c0e72ea7fa798ce089 |
|
MD5 | df70323ebee631a088749fa3932381ae |
|
BLAKE2b-256 | d47b87e36cf62250a781f1622857a80643a8b0dd6255b8ae4c5c23514be6126b |
Hashes for tmtools-0.1.1-cp311-cp311-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 765b9956f9176d08b78fbe09913dcbf66d2eee35fae6d8ea71092de64c0f7976 |
|
MD5 | ef6ecdd702bac077d7f8c3aa562233ef |
|
BLAKE2b-256 | 61441181010dae177da324ae6786d835e1774b1e09c4c803227d5c356ef268e9 |
Hashes for tmtools-0.1.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c9a5f872a9002e9ee82ef2484fb720e4458ada6de71a926091b88510bfe4972f |
|
MD5 | a2f13927d45756e6559f256f4f975b68 |
|
BLAKE2b-256 | 768c4ab1cd1dd645bec8a58976978d5f10a8a203754e08ed0f7f7f093a1be1fd |
Hashes for tmtools-0.1.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4579b6f38bef1ad6437f1d686189a7d5316d394d3b362cf7bd32531ebf3004d |
|
MD5 | 228fc97f29e277fa354ca28d89d4ba14 |
|
BLAKE2b-256 | 5c4787d7c50b2700de17a68a05a7e322cbc7fc93207c3bbc637cf820851ef596 |
Hashes for tmtools-0.1.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e993ed875404b4e53d7a7ab03494bcbb28048d4a09ca69c5945d3cb063d43937 |
|
MD5 | 0ede9692cdafdf0c274b2d9de99a6cb4 |
|
BLAKE2b-256 | 5434db1e7ca49d8e7d527ddd9a9b16ab4541e7dcb57356e653b89439718e440f |
Hashes for tmtools-0.1.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e1ecb91251fd9fdbdcabe44a040b45f0165c7aa48655feed3f478dc3e7757b5 |
|
MD5 | a610f57ad6b8ef1b3a3ff130f46d90ea |
|
BLAKE2b-256 | 8b3e0c0e2fadbb003b24487c15f9eff253a7c712787d621907e60a80229bfb38 |
Hashes for tmtools-0.1.1-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 064d1ceba4bb661981ebfcfdd69b9024995ff1891c080c14f3e599529aa58e65 |
|
MD5 | 30ddb88f708e8915fc9ec3b5c31d0ee1 |
|
BLAKE2b-256 | 3812d076068b4699d7d64735da611ee418b527e36e4cb40507d3de88e719ec7d |
Hashes for tmtools-0.1.1-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8cf793d3f460fe46a3915e019c8c7207839ab7920f06269b6b41fd193b5478cd |
|
MD5 | 669ad403d7fa6f3c7e38fe5288d7bbc2 |
|
BLAKE2b-256 | 326104af260cc20dcea408a0b5c5f7fa659e0139a91861bd1ecf15f8561a3501 |
Hashes for tmtools-0.1.1-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c2cb4d23b07003bd2254a120ce630c800be216721cb60e4458b05d7daf8bffe |
|
MD5 | dab2176e2474e975b0cf5dcd369a598c |
|
BLAKE2b-256 | 19db8df82bc8a66a4c7a91560ec733e6bef56361e166870a7378b2a2a3cc8b63 |
Hashes for tmtools-0.1.1-cp310-cp310-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f95b628ca38817705b82822507d8a1a8e14f6e5b254f63243e65ae4531b978e |
|
MD5 | fae0158f0c092a04a544a6ec8872fbfe |
|
BLAKE2b-256 | c2a7d8d353864caf939e6eff2598814047f49aa2dc6a7126d3a72b7ae81eab2f |
Hashes for tmtools-0.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8b3ffd877a082ec953f27885f289051f89d9eafd885b8ebbeac57c112572ca1c |
|
MD5 | a1c860e46e518ea9905d5befe1bb7e5e |
|
BLAKE2b-256 | bb19ea6b5343435fae7e8935f8a0b1a62f3924e4d8f4f531747ae34b3d0212c9 |
Hashes for tmtools-0.1.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 972dd03175260331475d0e8536770f9924a92af247b7e47a3014d25d8efd6f46 |
|
MD5 | 42ceb01200cdbaa4ce1f7cc7fcb6ec8e |
|
BLAKE2b-256 | 0341c81e810b84ac18104f70de24bd3e783f0effc487abadf4c4eb36edba4567 |
Hashes for tmtools-0.1.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2d9c59c3a883abddadefc79aba5c88cf5fcc5875b0714998d85028c0f55ff7c |
|
MD5 | 351fc41c72ab88e834e0923767570d39 |
|
BLAKE2b-256 | fb8edc16e3c3c005449906b7ec5fa2512667b8c9cb89d6565235d86d64826625 |
Hashes for tmtools-0.1.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0b4277c53e707d589a74a44d20e15a988ed38a27b0fc19b4d3f07151b4f5999 |
|
MD5 | 94b9372da497e1d882b7ec51d1ef179e |
|
BLAKE2b-256 | 469800350630193f47097cacd70fdb39aaee1bc084f5bd343f697208d840ae11 |
Hashes for tmtools-0.1.1-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a05e0f1e7d7e64f6f59e8b98f684d61aa9e77ce7260c45141dbf66475aef0378 |
|
MD5 | 5cddc3accd933c86374ac82882b78cca |
|
BLAKE2b-256 | bddf4a8a85f8210ff213dfae0ee5b53510d867242dd952797752bea1fd0cb8b3 |
Hashes for tmtools-0.1.1-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d45b5476c0eb911c2e14e01e07f3e949ae4018e82024f4051e827bfceac6506 |
|
MD5 | 6fa5572dd36af706a327d40c76c433d9 |
|
BLAKE2b-256 | db4b8ff0a821aa00886018c0e392b8e6ce7435f28369ce529761aa20e7c08500 |
Hashes for tmtools-0.1.1-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 698cc6fc89e2b7c78dee808eb9dbc60829926b41dd964703b3da5fc939783915 |
|
MD5 | e23d4efa8ce3a2aade673405538b4b87 |
|
BLAKE2b-256 | 472a3460319aa6202013e8787ed97ec6a6f1c70fd76f92dabea8c1f5d61b8df9 |
Hashes for tmtools-0.1.1-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86abcfdf675c0911199438511a78c70ae852c19c05ee990cf26b7dc79cb53f05 |
|
MD5 | 425d415d74ff403047914e0854c3f786 |
|
BLAKE2b-256 | 3c1ef2512c5389c198e1b1fe5479f00f9fe02e24406444cc42bbac0c95becc56 |
Hashes for tmtools-0.1.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a74fec9d6f2cf3bd8ffa6777bb923a6db2f366e9e9c50267acc88f746b4b7b8e |
|
MD5 | 3a0a3d7a38a2f47f059d4931d5c425da |
|
BLAKE2b-256 | 9e62cffafe62ff84e547287b971516f3c93c5380fb283129708baefb0fb8dad7 |
Hashes for tmtools-0.1.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7270ea7338eb691dd5692af492ab4bb02c3bc6330a1e8047a3e5d60250044743 |
|
MD5 | 21d6023caa79faec1dbb9d94b8a77906 |
|
BLAKE2b-256 | 7563ea0074932e88812059129dd39c2cf3fecf2fc583fb179043ef0bdf615893 |
Hashes for tmtools-0.1.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 355af01e6c9f3e42c8d48960f3931fa4740c4e11107d5ee3435c28a1805df889 |
|
MD5 | db5937dc831013a5bd94468ef1790298 |
|
BLAKE2b-256 | a75c21c1819b0e429ffb83881c96283c79ba98ff573634fb516098d7b2c63a81 |
Hashes for tmtools-0.1.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 482467586810a2d004ea08aefa7c8a96d5ac56da00593984dabc8196f903a622 |
|
MD5 | 13f0e9ddfa1d47a98d94507e5cb68c62 |
|
BLAKE2b-256 | bcbead0bdf132b381fffebcf1f4dcbfce9d51b3092a20284e03e4f55af14b038 |
Hashes for tmtools-0.1.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6887f6acca251c16cd81c0ecc15564f01a060ba0df7ea816762539824a6e57d1 |
|
MD5 | 4ff72a5a11510bfb22bc191cb020e4ba |
|
BLAKE2b-256 | 1b5f143d4b2398b4ebe21ea4971969d18a9c3d584ca063801a99ee54aca8d91a |
Hashes for tmtools-0.1.1-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf5fa508e2fb0d1679352c820f04757face305f7c3bbec66594958910b95df62 |
|
MD5 | 847c8643b2f7a2283235fa63dddfe1ea |
|
BLAKE2b-256 | 9fb3de2663b05c602558fe6223056a4a82864ef130988900259a10e3a7d42014 |
Hashes for tmtools-0.1.1-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0dbcb514855042eef3b532776ad48463cf9946ebc65aeda07486d6258af783bf |
|
MD5 | 0e03186424363bf86b9a04d79b2de47e |
|
BLAKE2b-256 | d0fd962217e403cd54acd3c8021aacfda9bfcafc1aef260bf67978f3773a1324 |
Hashes for tmtools-0.1.1-cp38-cp38-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ba2e4c76d7efd587d9a1a71c79b1c09df60cc7bd33547f7ba5a91cd1b64f6924 |
|
MD5 | 9495d5998075cc156e5c34e3a8c9d34b |
|
BLAKE2b-256 | e6e5432d423240d8a2407fd4fc70c9c2a9350578ab608c3f88f00116a14a6788 |
Hashes for tmtools-0.1.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5496012279a78371d388e6a54de051c618667bef562762d213c999db2d74c535 |
|
MD5 | ec964d2102d2b42ef7e7051ff9e3cd13 |
|
BLAKE2b-256 | 123b1cda8987b37f26df620443a1b8d093a06f384e9e5b74a5ce0e9336b51e2b |
Hashes for tmtools-0.1.1-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdf0c944e5ae3f94c8c1d7992767d490d3712d63331ac79cb01ddbfb8ff02d20 |
|
MD5 | 464d041582c04cb56cd64ec89527af32 |
|
BLAKE2b-256 | 3688b7c87d7b35d0d6aa09e52b1ee7680f6788a435cdcdb49f6c74ed8271a59b |
Hashes for tmtools-0.1.1-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23b6541098d9dcae9246acac39fce27e4cc4c97415d94839c13ed2a8bdeebbdc |
|
MD5 | 815b12962c536773baec1828a5bdae9c |
|
BLAKE2b-256 | 6645d2dcb24e666c91dfc1354e10e0299eafe432c0cb903dbaeff75ff58dbd88 |
Hashes for tmtools-0.1.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b117191ef932a10abca3a606897000046eacc61ba7759c545ddba4a14d8c8cb |
|
MD5 | e581419af6c2d934c90ae7cb3c70edcc |
|
BLAKE2b-256 | bfd64ed2e01d309dd36fb38261fc23a7c5411325d9e393bbb34298b961b8c047 |