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

fast_ctc_decode-0.3.6-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (293.5 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

fast_ctc_decode-0.3.6-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (283.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64

fast_ctc_decode-0.3.6-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (293.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

fast_ctc_decode-0.3.6-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (283.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ ARM64

fast_ctc_decode-0.3.6-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (470.2 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.6-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (294.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

fast_ctc_decode-0.3.6-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (284.3 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ ARM64

fast_ctc_decode-0.3.6-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (472.1 kB view details)

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

fast_ctc_decode-0.3.6-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (294.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

fast_ctc_decode-0.3.6-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (284.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ ARM64

fast_ctc_decode-0.3.6-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (472.1 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.6-cp39-none-win_amd64.whl (173.9 kB view details)

Uploaded CPython 3.9Windows x86-64

fast_ctc_decode-0.3.6-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (294.5 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

fast_ctc_decode-0.3.6-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (284.3 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ ARM64

fast_ctc_decode-0.3.6-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (472.0 kB view details)

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

fast_ctc_decode-0.3.6-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (294.5 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

fast_ctc_decode-0.3.6-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.whl (284.3 kB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ ARM64

fast_ctc_decode-0.3.6-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl (472.0 kB view details)

Uploaded CPython 3.8macOS 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.6-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.6-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 a9237395389c962c808437a605343e07554ea6ad2520888657a1179bdad18166
MD5 89da64a0fa115046973436ac5bcd0b21
BLAKE2b-256 700e9acb9b74da4f0e319b31ca6b1b763cd2373722efab1c580ae360055576dc

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.6-cp313-cp313-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 6ffd2d7d903c9a95b94ba4b1ed33662a8129723ff4db08478cb2fbadc2ce47b3
MD5 0f101b57c389d94f4ff40bf07f913a6a
BLAKE2b-256 bfcdcbe176c5c99729f258aa0e2f23fd53bfed449b13706f128f37ed6be69e00

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.6-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 87d182ea81b89b3ec2ec428aae4d8e516ff93b799cf7b09ae917d894b9349401
MD5 b6809e33bb4b646da50e16241daab0b8
BLAKE2b-256 89dd528121e9ac950d2897ec66f0193ec3a15e9d1d9099dbdbf2288464279c32

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.6-cp312-cp312-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 7d6cc2ef6d19781542c8898162baa1875c687ffdbb6c58bb504a98eb42b3ef3d
MD5 6ed25d4256adc5fe1e8ece1a7e42e456
BLAKE2b-256 176802ad94839676aa204f0f333c1d797504c587a15a377ea7797374142372ee

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-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.6-cp312-cp312-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 09ec4bcd93b20571e3f5fcbd7414e4061af601cb4b7bad90842c41296d9a5b10
MD5 6155e5412d8299ec4450e14ce66a9eb8
BLAKE2b-256 7835a54fa9b7dd4f5a2a73f19708a3f72f966125c4e3c2a5657d714bed134ddb

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.6-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 f49994a475866edf0e61f0d9e1b41185c035ba559b8c2aa68f83342d2c80ee6b
MD5 c95de30a241721c1db109867d870af16
BLAKE2b-256 8895d141474ce47d0bf3d32a873af2ec048ce71a6fdc98c61233156c26c50e1d

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.6-cp311-cp311-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 558e33f414a9f630248b4754e916220443a0da330f5ae7a8feab49f3ccd71e73
MD5 b78aaff1fee9e4b26f7a2d375475cfc2
BLAKE2b-256 2037101e0ee75db025b9702f6d397940515caf20d1cf10c6ebf7c2beb711a51e

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp311-cp311-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.6-cp311-cp311-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 b12d02ab9bd38cadbe0073043034cf6cfa4baddd51a75ae5031991e708238c14
MD5 0f8cd6e63b59c7aa28b50b47c32ae553
BLAKE2b-256 6ae761d3b4db951644b8c1a6a7e21c3d4c7d7288b8cef11565dd87c99d7401a5

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.6-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 8740b3f3c50381e2810bfd1d7eead27226ca4ee17be58af0754ac552dcf2e5b8
MD5 2241ea225957e76b85c90f11bcbf4532
BLAKE2b-256 e1446b6bed32325ebf964cb035550bb666a501919180b96876841f405128de0a

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.6-cp310-cp310-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 b476d806e7f5e0cdc126cb4e1b5b79e829eecc46aa2de978b91878ec157ef2fe
MD5 fc99ed8f517d79ec1abde3a8d3050e0d
BLAKE2b-256 96547c177bd4122072e4f9490f0b3a8487ac8fb35a8bfd2656e3b7b2152119f2

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-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.6-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 108ea2d07163d8ba9cdc2c7b4ae72454fb88e666ce375ec3172bb7095202690d
MD5 280d939e95544aa1576ccca4e818ff47
BLAKE2b-256 38565aa70c4ea7df6725cab0b9e9cc80c100bfcb223b7b74f46a56ba39cc804e

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp39-none-win_amd64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.6-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 4bbcf7853febee8a346eed6732a4f79bd95410c2dd20ccbc5a458c484bfb4d1c
MD5 a11e8b5134c31dd7acd7284fc48164eb
BLAKE2b-256 e5342890cb6cc3ebb0ad665e34ad3977aa4fe62de78cab51ec88bc6abe18d1af

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.6-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 7cf3c685fc278cef005d83812ae2f5a4eda831839b97ef60862deb15048a39c2
MD5 39f9b778a2b66332e6e3ff9ba70fb47f
BLAKE2b-256 a7aeda1b808ca81b653f111c7ff5b65a1059771c1415eef4e93558f2aef059aa

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.6-cp39-cp39-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 9f63392f32d73d85973f9f5ec58931a674074bc43e02ce0c65af6631b8f03ac3
MD5 8591a2fb527af0ad95458a0264a81fac
BLAKE2b-256 7ece5ddd0975bb36469c580e355c17d5441c214859321cf6e3e76c65095263fb

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-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.6-cp39-cp39-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 f73ed38903fdaa330864161110cfb8cf0b7e8404b1979c48f28011f34eba30fb
MD5 0644b63f330f410e74a7a8cbd8794f7b
BLAKE2b-256 74268da14f9a2a61984a5df217759f6e422b64f68cff190f794e65f93f6f68e1

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.6-cp38-cp38-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 e4b2eeba27d8f55f55fb3989e1b7314b67f4ed1287073836f05e2aad39b96f96
MD5 59cc593559e5c31a856df50ab0a6d085
BLAKE2b-256 223c916058c5b87548f30fb15f95e8c66a4d76263585977a8f746c090735b511

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for fast_ctc_decode-0.3.6-cp38-cp38-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 0371b35c5ba1f168e9a937f730b46a0b1db58d7d8485e9aebe8857edf3c374f6
MD5 6d1a62523e3c5a3c4d5439df171a69b4
BLAKE2b-256 40f632c4c0654610abeee21e35a0bca6afee545b4116168042e3c8c2cc6e1cc8

See more details on using hashes here.

File details

Details for the file fast_ctc_decode-0.3.6-cp38-cp38-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.6-cp38-cp38-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl
Algorithm Hash digest
SHA256 e15230dc5370cca95a46006fb8d63a94c284da0894f9c16079522cc8cd2baf1e
MD5 4014b94b35df1f16106cdd7a4e69c3b1
BLAKE2b-256 9890a15cf3a3b7c47154d4934018e4d7a2a45d4675815bccc48cd2ce95eae958

See more details on using hashes here.

Supported by

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