{ "info": { "author": "", "author_email": "", "bugtrack_url": null, "classifiers": [], "description": "# ScienceBeam Alignment\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)\n\nProvides sequence alignment utility functions to ScienceBeam projects.\n\n## Pre-requisites\n\n- Python 2 or 3\n\n## API\n\n### SequenceMatcher\n\nThe mostly drop-in replacement of Python's [SequenceMatcher](https://docs.python.org/3/library/difflib.html)\nis provided by [fuzzywuzzy](https://github.com/seatgeek/fuzzywuzzy)'s [StringMatcher](https://github.com/seatgeek/fuzzywuzzy/blob/master/fuzzywuzzy/StringMatcher.py).\n\nIn that respect, `sciencebeam-alignment` merely provides a wrapper with fallback.\n\n### WordSequenceMatcher\n\nA wrapper around the aforementioned `SequenceMatcher`, but matching on word level tokens only.\n\nIt currently only implements `get_matching_blocks`.\n\nThe main advantage is that it is much faster for long texts, because it won't have to match individual characters. It isn't recommended for short texts, where character level alignment is probably more desirable.\n\nexample match results:\n\n```python\n>>> from sciencebeam_alignment.word_sequence_matcher import (\n... WordSequenceMatcher\n... )\n>>> WordSequenceMatcher(a='word1', b='word2').get_matching_blocks()\n[]\n>>> WordSequenceMatcher(a='a word1 b', b='x word1 y').get_matching_blocks()\n[(2, 2, 5)]\n```\n\n### GlobalSequenceMatcher and LocalSequenceMatcher\n\nThe [GlobalSequenceMatcher and LocalSequenceMatcher](https://github.com/elifesciences/sciencebeam-alignment/blob/develop/sciencebeam_alignment/align.py) implements the [Needleman-Wunsch](https://en.wikipedia.org/wiki/Needleman%E2%80%93Wunsch_algorithm) [global alignment](https://en.wikipedia.org/wiki/Sequence_alignment#Global_and_local_alignments) as well as the [Smith-Waterman](https://en.wikipedia.org/wiki/Smith%E2%80%93Waterman_algorithm) local alignment algorithms. The implementation is somewhat inspired by [python-alignment](https://github.com/eseraygun/python-alignment).\n\nIt does implement `get_matching_blocks` to match Python's [SequenceMatcher](https://docs.python.org/3/library/difflib.html).\n\nBy passing in a scoring object, the results can be influenced (e.g. gaps can be peanilized more).\n\nIt does also provide an optimized implementation using [Cython](https://cython.org/). The level of optimization depends on the type of passed in sequences and scoring. The fastest being with integer sequences and simple scoring.\n\n```python\n>>> from sciencebeam_alignment.align import LocalSequenceMatcher, SimpleScoring\n>>> DEFAULT_SCORING = SimpleScoring(match_score=3, mismatch_score=-1, gap_score=-2)\n>>> LocalSequenceMatcher(a='a word1 b', b='x word2 y', scoring=DEFAULT_SCORING).get_matching_blocks()\n[(1, 1, 5), (7, 7, 1), (9, 9, 0)]\n```\n\nTo check whether the fast implementation is enabled:\n\n```python\n>>> from sciencebeam_alignment.align import native_enabled\n>>> native_enabled\nTrue\n```\n\n## Development\n\nDevelopment can be done either using Docker (default) or a virtual environment.\n\nAll commands are available via `make`.\n\n### Development using Docker\n\nBuild and run tests:\n\n```bash\nmake build test\n```\n\nOr intended for CI:\n\n```bash\nmake ci-build-and-test\n```\n\n### Development using a virtual environment\n\n`make` targets with the `dev-` prefix are intended for the use with the virtual environment.\n\nThis requires that you already have Python installed.\n\n#### Setup (virtual environment)\n\n```bash\nmake dev-venv\n```\n\nTo update the dependencies:\n\n```bash\nmake dev-install\n```\n\n#### Cython (virtual environment)\n\nCompile code using Cython:\n\n```bash\nmake dev-cython-clean dev-cython-compile\n```\n\n#### Tests (virtual environment)\n\n```base\nmake dev-test\n```\n\nOr:\n\n```base\nmake dev-watch\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "sciencebeam-alignment", "package_url": "https://pypi.org/project/sciencebeam-alignment/", "platform": "", "project_url": "https://pypi.org/project/sciencebeam-alignment/", "project_urls": null, "release_url": "https://pypi.org/project/sciencebeam-alignment/0.0.4/", "requires_dist": null, "requires_python": "", "summary": "ScienceBeam Alignment", "version": "0.0.4" }, "last_serial": 5723165, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "6b93741202fb29c88aa7fb4f0f329c4a", "sha256": "b05ef5838ca72b32d8c47e08b96434c3490d3b1e3845c09b8005b4f874a58a2a" }, "downloads": -1, "filename": "sciencebeam_alignment-0.0.1.tar.gz", "has_sig": false, "md5_digest": "6b93741202fb29c88aa7fb4f0f329c4a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6691, "upload_time": "2018-08-24T10:32:14", "url": "https://files.pythonhosted.org/packages/ba/b3/25ff1592c9178a52b8482b9155b9f4d6a8a4540c9ee697ac3b47d317dbef/sciencebeam_alignment-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "083ff43bdfea642cce41c291ecc7e70b", "sha256": "d327c923883a17a729eefc27c1b1ea82b92bc2ee7822f036a62d5c27058f60d6" }, "downloads": -1, "filename": "sciencebeam_alignment-0.0.2.tar.gz", "has_sig": false, "md5_digest": "083ff43bdfea642cce41c291ecc7e70b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6862, "upload_time": "2018-08-24T14:08:40", "url": "https://files.pythonhosted.org/packages/5c/1f/1ac79237e5fae7cd3f3b832544c6b1bfb365c153916f63843fb789da1f5d/sciencebeam_alignment-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "a974a9d9b3b91feaa6abf881ca77a312", "sha256": "f0fdffb40f6836708f9ef526ef71b465a7f4ff29f5d47fb7129e8ec7433b4f4b" }, "downloads": -1, "filename": "sciencebeam_alignment-0.0.3.tar.gz", "has_sig": false, "md5_digest": "a974a9d9b3b91feaa6abf881ca77a312", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8786, "upload_time": "2019-08-23T22:53:53", "url": "https://files.pythonhosted.org/packages/3e/3e/b8d8496426dc0dad1e9221b117fd9154ae68301bf8622d21f6808354f9eb/sciencebeam_alignment-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "a29bb4fceec6b19d318d3cbd3363495a", "sha256": "56e4a984daea3a7376d78594426f4f38af47285bcda93b6f11351b66f8a04d89" }, "downloads": -1, "filename": "sciencebeam_alignment-0.0.4.tar.gz", "has_sig": false, "md5_digest": "a29bb4fceec6b19d318d3cbd3363495a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8746, "upload_time": "2019-08-23T23:29:08", "url": "https://files.pythonhosted.org/packages/2d/ca/991716febd8eda0f5c1460764ab846c2ac9058352727d4644add2b98bfc9/sciencebeam_alignment-0.0.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a29bb4fceec6b19d318d3cbd3363495a", "sha256": "56e4a984daea3a7376d78594426f4f38af47285bcda93b6f11351b66f8a04d89" }, "downloads": -1, "filename": "sciencebeam_alignment-0.0.4.tar.gz", "has_sig": false, "md5_digest": "a29bb4fceec6b19d318d3cbd3363495a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8746, "upload_time": "2019-08-23T23:29:08", "url": "https://files.pythonhosted.org/packages/2d/ca/991716febd8eda0f5c1460764ab846c2ac9058352727d4644add2b98bfc9/sciencebeam_alignment-0.0.4.tar.gz" } ] }