Skip to main content

A fast tool to calculate Hamming distances

Project description

A small C++ tool to calculate pairwise distances between gene sequences given in fasta format.

DOI pypi releases python versions

Python interface

To use the Python interface, you should install it from PyPI:

python -m pip install hammingdist

Then, you can e.g. use it in the following way from Python:

import hammingdist

# To see the different optional arguments available:
help(hammingdist.from_fasta)

# To import all sequences from a fasta file
data = hammingdist.from_fasta("example.fasta")

# To import only the first 100 sequences from a fasta file
data = hammingdist.from_fasta("example.fasta", n=100)

# To import all sequences and remove any duplicates
data = hammingdist.from_fasta("example.fasta", remove_duplicates=True)

# To import all sequences from a fasta file, also treating 'X' as a valid character
data = hammingdist.from_fasta("example.fasta", include_x=True)

# The distance data can be accessed point-wise, though looping over all distances might be quite inefficient
print(data[14,42])

# The data can be written to disk in csv format (default `distance` Ripser format) and retrieved:
data.dump("backup.csv")
retrieval = hammingdist.from_csv("backup.csv")

# It can also be written in lower triangular format (comma-delimited row-major, `lower-distance` Ripser format):
data.dump_lower_triangular("lt.txt")
retrieval = hammingdist.from_lower_triangular("lt.txt")

# If the `remove_duplicates` option was used, the sequence indices can also be written.
# For each input sequence, this prints the corresponding index in the output:
data.dump_sequence_indices("indices.txt")

# Finally, we can pass the data as a list of strings in Python:
data = hammingdist.from_stringlist(["ACGTACGT", "ACGTAGGT", "ATTTACGT"])

OpenMP on linux

The latest version of hammingdist on linux is now built with OpenMP (multithreading) support. If this causes any issues, you can install the previous version of hammingdist without OpenMP support:

pip install hammingdist==0.11.0

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

hammingdist-0.12.0-pp37-pypy37_pp73-win_amd64.whl (88.1 kB view details)

Uploaded PyPy Windows x86-64

hammingdist-0.12.0-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (157.6 kB view details)

Uploaded PyPy manylinux: glibc 2.12+ x86-64

hammingdist-0.12.0-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (83.4 kB view details)

Uploaded PyPy macOS 10.9+ x86-64

hammingdist-0.12.0-cp39-cp39-win_amd64.whl (88.3 kB view details)

Uploaded CPython 3.9 Windows x86-64

hammingdist-0.12.0-cp39-cp39-win32.whl (77.4 kB view details)

Uploaded CPython 3.9 Windows x86

hammingdist-0.12.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (157.9 kB view details)

Uploaded CPython 3.9 manylinux: glibc 2.12+ x86-64

hammingdist-0.12.0-cp39-cp39-macosx_10_9_x86_64.whl (84.0 kB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

hammingdist-0.12.0-cp38-cp38-win_amd64.whl (88.9 kB view details)

Uploaded CPython 3.8 Windows x86-64

hammingdist-0.12.0-cp38-cp38-win32.whl (77.2 kB view details)

Uploaded CPython 3.8 Windows x86

hammingdist-0.12.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (157.8 kB view details)

Uploaded CPython 3.8 manylinux: glibc 2.12+ x86-64

hammingdist-0.12.0-cp38-cp38-macosx_10_9_x86_64.whl (83.9 kB view details)

Uploaded CPython 3.8 macOS 10.9+ x86-64

hammingdist-0.12.0-cp37-cp37m-win_amd64.whl (89.4 kB view details)

Uploaded CPython 3.7m Windows x86-64

hammingdist-0.12.0-cp37-cp37m-win32.whl (78.3 kB view details)

Uploaded CPython 3.7m Windows x86

hammingdist-0.12.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (158.5 kB view details)

Uploaded CPython 3.7m manylinux: glibc 2.12+ x86-64

hammingdist-0.12.0-cp37-cp37m-macosx_10_9_x86_64.whl (83.3 kB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

hammingdist-0.12.0-cp36-cp36m-win_amd64.whl (89.4 kB view details)

Uploaded CPython 3.6m Windows x86-64

hammingdist-0.12.0-cp36-cp36m-win32.whl (78.3 kB view details)

Uploaded CPython 3.6m Windows x86

hammingdist-0.12.0-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (158.4 kB view details)

Uploaded CPython 3.6m manylinux: glibc 2.12+ x86-64

hammingdist-0.12.0-cp36-cp36m-macosx_10_9_x86_64.whl (83.4 kB view details)

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

Details for the file hammingdist-0.12.0-pp37-pypy37_pp73-win_amd64.whl.

File metadata

  • Download URL: hammingdist-0.12.0-pp37-pypy37_pp73-win_amd64.whl
  • Upload date:
  • Size: 88.1 kB
  • Tags: PyPy, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-pp37-pypy37_pp73-win_amd64.whl
Algorithm Hash digest
SHA256 9599795497e21854a1cc4dd3d952358e6a2dece3b0632e53a7f363deeb79a3a8
MD5 960f33f3834b449dc3cb187e42cef53b
BLAKE2b-256 74b140f18fa7cb966c71b6b553a1d09a715e3a7a8487a18c128f5d789b86d3c4

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for hammingdist-0.12.0-pp37-pypy37_pp73-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 f729955df41c05dd102f0cf9f9f96dbdd3a4fac60b1d28ae95762542628e36ee
MD5 d63afcfa6cf4b609e37e84ce0ec17994
BLAKE2b-256 d4649976071c89b91902e9651197b43f3eb3c0482be904846d13db9874616b9e

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-pp37-pypy37_pp73-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: hammingdist-0.12.0-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 83.4 kB
  • Tags: PyPy, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 797ee03ac333aff6a1b868120e310a541360d2354d9bfeb0f6a30ba13ba0fe18
MD5 55ce62fdf448c259db735e3dec2cc850
BLAKE2b-256 b71d18411d00e6f4ce7a3f3bd1acf30fdbd874aed818485ef62b6d79d9d0f18d

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: hammingdist-0.12.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 88.3 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 3d61c4dbe0ef35cf7c60a6f8764c775c38efaff1f946f51d0e07f54545bef24b
MD5 5b026fb699efb25839ab840d7711f784
BLAKE2b-256 f18726c3df5baf56b8da9876d36894a3cb255444d8504007edd1f1ae8f9d9ee3

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp39-cp39-win32.whl.

File metadata

  • Download URL: hammingdist-0.12.0-cp39-cp39-win32.whl
  • Upload date:
  • Size: 77.4 kB
  • Tags: CPython 3.9, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-cp39-cp39-win32.whl
Algorithm Hash digest
SHA256 1650072000dedd52846c8fd367b0af324772e547d6bc1ecbee161b9544164e7c
MD5 27d12fcded474f7a72228394bdfe214b
BLAKE2b-256 d0f43c22ab473b4a0a4b9b8a95031c4098599805d46cf12e4e66c959ccf5666d

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for hammingdist-0.12.0-cp39-cp39-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 a173194d9267043ac4a34a09a97b70667589e98e3b2322225b0b691cf64b2989
MD5 6a267b0905dd3f179aa97e95796cb5c1
BLAKE2b-256 d735fdf5f33aa2dd4ff35bbb9fec808c92e651a72470b87b922e1796bbeb02be

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: hammingdist-0.12.0-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 84.0 kB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 205d84dcccbf0136a1bd4fa0622c882cb8b364e349fbc1a0491384bba5eb8076
MD5 ff22232035c949171ac6601954db4a23
BLAKE2b-256 1e0c64e31aa506b3dc3679089c1b8cd7c13d829074ba30d689d40441c32f6038

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: hammingdist-0.12.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 88.9 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 292e757370a38e4aa9fde913faeaff47d5587cfa180a5011092964ff3f52320d
MD5 6896e976378858195dac987dbbd81a5f
BLAKE2b-256 09655b8a979a1dc7c60dca051b7217a81ca35c48d5bcaa23ade952d78be46796

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp38-cp38-win32.whl.

File metadata

  • Download URL: hammingdist-0.12.0-cp38-cp38-win32.whl
  • Upload date:
  • Size: 77.2 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 f77960d301c78072d6123738460f071c80d4cd351d46672a49c43ee691c758b3
MD5 9b2071fed998deff16c07c9f58d31b9e
BLAKE2b-256 ac856fa3664d6d66f455ee73f6505c6f5222d93e51623b528c82e81b46252625

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for hammingdist-0.12.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 5e02f4bdc6daa9a800b4b09fca0311e733edafe2268587b993f350311d879701
MD5 3fee6a76d2328d978e1bec806eb46da9
BLAKE2b-256 5eea7c94defbf028c3bfe5ea2bb8b4c8c0448d92889f1afab112933a860c3f42

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: hammingdist-0.12.0-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 83.9 kB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 cf367b33aa877e2fe8c3bf1443af98501371bf4a2a9d280640cff32fd5659229
MD5 129cc7451026b65f31dffda0308c2d6a
BLAKE2b-256 a37eabbf2ed68f89a57ea0ceb0f9293cd55821a5a340c60136e35be8de1fce22

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: hammingdist-0.12.0-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 89.4 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 21422528e3d4142f3a170a2822cacb474ca09cef3fa96ce99b236328bf5df1a5
MD5 378a9b121b9aaa08ba246df50a0c0b06
BLAKE2b-256 c3aa8e07926ed2b6bf159b5906182bed85b1cfced02daa699254222d2a8ce9f8

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp37-cp37m-win32.whl.

File metadata

  • Download URL: hammingdist-0.12.0-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 78.3 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 805b2ee4ecf85dc8b695d14a051ae8f642c2cb91820f646da29be594a328c30a
MD5 177d22691e581f1dbe5153d5c21a652a
BLAKE2b-256 fcd76870462c565929225d7350e268b18aca9f8d48f47bea441326c8306271d0

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for hammingdist-0.12.0-cp37-cp37m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 93896ea982d5c2b2bebce40076ff0c41042f992cd8ed0ce89fe067e1ae74c48c
MD5 116c4d468441e4ec62b972a0ecb9ea52
BLAKE2b-256 85dae18d8f625f2508b59bcf7940a3b191ce43abf7c4c0a2434045a2a147c663

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: hammingdist-0.12.0-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 83.3 kB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b7d98a77046f687bb1595a690b44dec6b2f28727c8f6ea304352776669bb1c90
MD5 50964c76322e040c7e1512608a418155
BLAKE2b-256 debb8b90bb6622d8814a3636727e192be5b7278535df724b6dd32e7c82adfe78

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: hammingdist-0.12.0-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 89.4 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 ee03652b373821c459cfde70c9ffececbfc42071aa3aab7dd5d9dc52111a1f21
MD5 aeb95231a44fdb23e2603dc63c32db1d
BLAKE2b-256 4545e528eedf004b9246cb21be892cea7d8bf20a9fa0ff5a1dda5680520c7bfe

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp36-cp36m-win32.whl.

File metadata

  • Download URL: hammingdist-0.12.0-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 78.3 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 0c839c3c6e45d60341f7e630c821820cfc5d3df7a65635af922338f0b6bb6dfc
MD5 04ff4c5d3b1a12ddc0603d1b4c39ae44
BLAKE2b-256 6914b29d947695777907112cec9dddd61e63a1f445833e67f9adfe5ca8cad112

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl.

File metadata

File hashes

Hashes for hammingdist-0.12.0-cp36-cp36m-manylinux_2_12_x86_64.manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 7c0cf6f775f7eea89fb9fb4b68e806e78e90ba1d2ebc62d571893962481ff9da
MD5 bf4abb64fcbc0d0842752936158afe90
BLAKE2b-256 4c2eb530c82fe3fadf03caf4a2712a8c26757fc4ab623c45e5a51f79807c7655

See more details on using hashes here.

Provenance

File details

Details for the file hammingdist-0.12.0-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: hammingdist-0.12.0-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 83.4 kB
  • Tags: CPython 3.6m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.6

File hashes

Hashes for hammingdist-0.12.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9c9073fd1d14cdf7fd14ec0bc49ae8d9769c90589898be00924eaa622f75f106
MD5 6963547e9834f6fe4960be43dd705d34
BLAKE2b-256 641b6ad24af9150d34026ed551be177686a7f98f182c916dadce124c0a9f3c88

See more details on using hashes here.

Provenance

Supported by

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