Skip to main content

No project description provided

Project description

fast-ctc-decode

test-fast-ctc-decode PyPI version

Blitzing fast CTC decoding library.

$ pip install fast-ctc-decode
$ npm i @nanopore/fast-ctc-decode

Usage

Python

>>> from fast_ctc_decode import beam_search, viterbi_search
>>>
>>> alphabet = "NACGT"
>>> posteriors = np.random.rand(100, len(alphabet)).astype(np.float32)
>>>
>>> seq, path = viterbi_search(posteriors, alphabet)
>>> seq
'ACACTCGCAGCGCGATACGACTGATCGAGATATACTCAGTGTACACAGT'
>>>
>>> seq, path = beam_search(posteriors, alphabet, beam_size=5, beam_cut_threshold=0.1)
>>> seq
'ACACTCGCAGCGCGATACGACTGATCGAGATATACTCAGTGTACACAGT'

Node / Web

import init, { beam_search, viterbi_search } from 'fast-ctc';

const floatArr = [0.0, 0.4, 0.6, 0.0, 0.3, 0.7, 0.3, 0.3, 0.4, 0.4, 0.3, 0.3, 0.4, 0.3, 0.3, 0.3, 0.3, 0.4, 0.1, 0.4, 0.5, 0.1, 0.5, 0.4, 0.8, 0.1, 0.1, 0.1, 0.1, 0.8];
const alphabet = ["N","A","G"];
const beamSize = 5;
const beamCutThreshold = Number(0.0).toPrecision(2);
const collapseRepeats = true;
const shape = [10, 3];
const string = false;
const qBias = Number(0.0).toPrecision(2);
const qScale = Number(1.0).toPrecision(2);

// On web, note the base path will be your public folder
init('fast_ctc_decode_wasm_bg.wasm');

const viterbisearch = await beam_search(floatArr, alphabet, string, qScale, qBias, collapseRepeats, shape);

const beamsearch = await beam_search(floatArr, alphabet, beamSize, beamCutThreshold, collapseRepeats, shape);

console.log(viterbisearch); // GGAG
console.log(beamsearch); // GAGAG

Benchmark

Implementation Time (s) URL
Viterbi (Rust) 0.0003 nanoporetech/fast-ctc-decode
Viterbi (Python) 0.0022
Beam Search (Rust) 0.0033 nanoporetech/fast-ctc-decode
Beam Search (C++) 0.1034 parlance/ctcdecode
Beam Search (Python) 3.3337 githubharald/CTCDecoder

Developer Quickstart

Python

$ git clone https://github.com/nanoporetech/fast-ctc-decode.git
$ cd fast-ctc-decode
$ pip install --user maturin
$ make test

JavaScript / Node

npm i
npm test

Note: You'll need a recent rust compiler on your path to build the project.

By default, a fast (and less accurate) version of exponentiation is used for the 2D search. This can be disabled by passing --cargo-extra-args="--no-default-features" to maturin, which provides more accurate calculations but makes the 2D search take about twice as long.

Credits

The original 1D beam search implementation was developed by @usamec for deepnano-blitz.

The 2D beam search is based on @jordisr and @ihh work in their pair consensus decoding paper.

Licence and Copyright

(c) 2019 Oxford Nanopore Technologies Ltd.

fast-ctc-decode is distributed under the terms of the MIT License. If a copy of the License was not distributed with this file, You can obtain one at https://github.com/nanoporetech/fast-ctc-decode/

Research Release

Research releases are provided as technology demonstrators to provide early access to features or stimulate Community development of tools. Support for this software will be minimal and is only provided directly by the developers. Feature requests, improvements, and discussions are welcome and can be implemented by forking and pull requests. However much as we would like to rectify every issue and piece of feedback users may have, the developers may have limited resource for support of this software. Research releases may be unstable and subject to rapid iteration by Oxford Nanopore Technologies.

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

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

fast_ctc_decode-0.3.7-cp314-cp314t-manylinux_2_28_x86_64.whl (293.4 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64

fast_ctc_decode-0.3.7-cp314-cp314t-manylinux_2_28_aarch64.whl (283.6 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ ARM64

fast_ctc_decode-0.3.7-cp314-cp314-manylinux_2_28_x86_64.whl (293.4 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ x86-64

fast_ctc_decode-0.3.7-cp314-cp314-manylinux_2_28_aarch64.whl (283.6 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.28+ ARM64

fast_ctc_decode-0.3.7-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (470.7 kB view details)

Uploaded CPython 3.14macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

fast_ctc_decode-0.3.7-cp313-cp313t-manylinux_2_28_x86_64.whl (293.4 kB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.28+ x86-64

fast_ctc_decode-0.3.7-cp313-cp313t-manylinux_2_28_aarch64.whl (283.6 kB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.28+ ARM64

fast_ctc_decode-0.3.7-cp313-cp313-manylinux_2_28_x86_64.whl (293.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ x86-64

fast_ctc_decode-0.3.7-cp313-cp313-manylinux_2_28_aarch64.whl (283.6 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.28+ ARM64

fast_ctc_decode-0.3.7-cp312-cp312-manylinux_2_28_x86_64.whl (293.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

fast_ctc_decode-0.3.7-cp312-cp312-manylinux_2_28_aarch64.whl (283.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ ARM64

fast_ctc_decode-0.3.7-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (470.7 kB view details)

Uploaded CPython 3.12macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

fast_ctc_decode-0.3.7-cp311-cp311-manylinux_2_28_x86_64.whl (294.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

fast_ctc_decode-0.3.7-cp311-cp311-manylinux_2_28_aarch64.whl (284.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ ARM64

fast_ctc_decode-0.3.7-cp310-cp310-manylinux_2_28_x86_64.whl (294.6 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

fast_ctc_decode-0.3.7-cp310-cp310-manylinux_2_28_aarch64.whl (284.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ ARM64

fast_ctc_decode-0.3.7-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (472.3 kB view details)

Uploaded CPython 3.10macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

fast_ctc_decode-0.3.7-cp39-cp39-win_amd64.whl (174.1 kB view details)

Uploaded CPython 3.9Windows x86-64

fast_ctc_decode-0.3.7-cp39-cp39-manylinux_2_28_x86_64.whl (294.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

fast_ctc_decode-0.3.7-cp39-cp39-manylinux_2_28_aarch64.whl (284.8 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ ARM64

fast_ctc_decode-0.3.7-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (472.3 kB view details)

Uploaded CPython 3.9macOS 10.12+ universal2 (ARM64, x86-64)macOS 10.12+ x86-64macOS 11.0+ ARM64

File details

Details for the file fast_ctc_decode-0.3.7-cp314-cp314t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp314-cp314t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 23f6230115bd81350fa2d4f07d8c0b4f4591391df969da6f5dce071073d5334a
MD5 834427a085ae355bcb2658c2121ea0ee
BLAKE2b-256 44ba1e8486b1ab727348c21a2a481dffa2ec6ee9e36fa0ac6a521be7b6861264

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp314-cp314t-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp314-cp314t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b2301dbe33a53cd91661932be8891dcfacde2b4186f16881aff350b89b1df347
MD5 98365e263878c3c8510176f61adab7e0
BLAKE2b-256 a9c0277d4bd85fb10beb97cfad619f83e7588502ee22413ed228ddcc152f6738

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp314-cp314-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp314-cp314-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a00c2bc431da0aa26c183afb3e385377c42a1447bdb94db4379d04d0a1c99bde
MD5 05a489bd1af6e19fbb73d2f26ddeddcf
BLAKE2b-256 456122ba524a63b8653102ce7230af3706f797b6a12919d077d1e5f6debb232e

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp314-cp314-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp314-cp314-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5638309edfe131ac2b4735e5f197746b7eb203c9dbc45432e92f6d7ad6e3b15c
MD5 c4577b829dd477b83ee0767b859cc1c1
BLAKE2b-256 ad08007cd3457db298528705778c645acfe62d0e05dfb66b859f5505fcdf27d7

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp314-cp314-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 0b07033c43f8c849592aec7b16d57faa6b803c694f4886e88fde611a0e33cd89
MD5 06ab1b17ccbe41b55108b62f177d46a3
BLAKE2b-256 44babd776c7fd3bff90002f82cc39ea270431348fafe621892f7700712526e3e

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp313-cp313t-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp313-cp313t-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c7ad81ae87e4bf70ce9094ba61da1dc71a5fe0518051ef5edb754340bae6ce0f
MD5 e3cbe2cdc0e3347d4cc2c51f98fc9f52
BLAKE2b-256 cd8538e56d1d75c391cc19e5203731bc7732f7899224af2bd592d784b78cb67b

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp313-cp313t-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp313-cp313t-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 94f0885a09b33902e3b6424b7480f562619d805d138beca0f2e25441250350e7
MD5 4c69dce5d541313928aff40036e2f5a8
BLAKE2b-256 c0485c68e8d79514ad64e16c8c1303e60c5cbc18b7bc255b38e42d42d0a5055b

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp313-cp313-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp313-cp313-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f9098c3bc33d880ce05438e939b967c01c16b1e556d43c60234ab0af6a820d7f
MD5 e5ebc4a5bb25491911bae2cbfdad01ff
BLAKE2b-256 4f076713c0c791d4e9c34ae1ec4cfc1550caa6ac1a3ee78d65305d779e7deb90

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp313-cp313-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp313-cp313-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 0b8eb8928f0b74aaef3ce3cdc376c73d924c11f0e08bcd68cd451f3dc697940c
MD5 8802aaa6b73f22ee362af4bd72e645bb
BLAKE2b-256 2e30a5128631860b5200ccada786715c408afdd8a3fb11e292c545c960d668f6

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 eb5f179a0bb6dfaa62175a7749424055bc66521adb36e46ac33cfef148180d2a
MD5 868af486ff9a3f7640ce52bf4b396f82
BLAKE2b-256 f38973348ccd9bd442aed0cdd39bad4383c22a6b2ecb0865e4bfd8d4a1beb820

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp312-cp312-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp312-cp312-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f31a78d3f52bab00bfd5e682a8b9ba4aa639f36d3a09a4a1d098d2de3c191d4e
MD5 96e8c615b9912b575e873e97ec517682
BLAKE2b-256 0e0fd232953c61ee87f6a9a0bbb9cdd80c31cdd1611c17cb7791d4d4964f1742

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 0e12c40e592da71647ae0fd4b6d0523213c37c6a3f002070cfa66256a6c26ea5
MD5 caca4e36e024b2b43340c0a79b9fb574
BLAKE2b-256 f9a79da6f396c4a7e0a9ca95bf325e4bb92f6fcd9b9309c48cc41d469e799f89

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ed54e4efe171398f57ee264d3d08e28911ef192aff5345b13238285e678ccf84
MD5 233ecabc9b307f79101ee371e8910c54
BLAKE2b-256 f0e7af2c35e646af77fd24c3045dbe35d9dbd89afcf1ea746036fa61cb60eab5

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp311-cp311-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp311-cp311-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c74b856575cd61f2373dbac57368fcb82d481b049476d341ad0fa0c18d61011d
MD5 b8be80ff401327f64c6390aa0cd053b7
BLAKE2b-256 d674aedc92545832d69d261a817a8d3750bc667b1d09a3b0a5b0e5e78182b13d

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5b05b1b636e4f211886c245879f9d49a36fad04be62e4e529f76ad4684bb3afa
MD5 6b2d4c313f764a69114c259371919a2b
BLAKE2b-256 3738afddd4b16b96a8d09b016bbf276e2c02c82a311690e848986349249a38a3

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp310-cp310-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp310-cp310-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c6eca68723252fc5e966cd3f875867b2e33695331b81686da801fb503bed39cf
MD5 82a74024aab0ea84b75734d3019cb7b8
BLAKE2b-256 b926f38ee87fd954c021ec63bc43342617e1ff6a087d34abd17de7d3ead58155

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 26765629995575d7e9b938220eb0cdab6241221aa071db321af36d45da447cab
MD5 3546a27a845ec8f8a3aee612f5ecdf92
BLAKE2b-256 793047dbb3aa2b371e4fa7a49f2896ad8c7d1f6120649cd20931736da802e0c9

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 5fdd4c132cd6589d185b1c09e5023187dc8a8661e7a7f693a61a543a18e896e4
MD5 7763f7c2f92641f1fa60bd02f09ff9b0
BLAKE2b-256 592450587546cedb24e8bc6ee7e027a957a651d9fbfe2584b6d4a8f18acbb758

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2cf8676b5172a1b5e3f6f12232b333e2eb50b196d611b59d366ed8c145b468a4
MD5 7bc02a07eb802db1f7efaf9cfd3e80b5
BLAKE2b-256 c533f743606d878248be9904044526252db01d8a367a4ac871112583fa881a7b

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp39-cp39-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp39-cp39-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 f8b437d5f9449942e1fcfbd845971984441ae166f889c2e61022a483b329da31
MD5 b0367f7deafc07a735bd4382d7d9742c
BLAKE2b-256 a45441450e39f81943b235db52020768ec68c6c4088f9bf1565cc3a3480bc852

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.7-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.7-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 09bfd828cd3865d130ea527872b954218c6999a3132595885431889fbf6a5991
MD5 b7a79999bab3a9498974d45c76042914
BLAKE2b-256 9dbe44a81ea53c221020acaf10fdcfad7ad87258f4ebe013de2396d6a69b8045

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