diff --git a/README.md b/README.md index 9aee47c..562816b 100644 --- a/README.md +++ b/README.md @@ -22,14 +22,14 @@ $ pip install mssw ## Benchmark -The result is tested in Linux x86_64 4 cores and 4GB of memory. +The result is tested in Linux x86_64 4 cores and 4GB of memory. ### With BioPython | Query Length | Reference Length | mssw Time (s) | bio python Time (s) | Speedup | | ------------ | ---------------- | ------------- | ------------------- | :------- | | 15 | 39 | 4.470348e-05 | 1.424551e-04 | 3.186666 | -| 150 | 390 | 2.179623e-04 | 2.270699e-03 | 10.41785 | +| 150 | 390 | 2.179623e-04 | 2.270699e-03 | 10.41785 | | 1500 | 3900 | 1.665862e-02 | 1.534623e-01 | 9.212187 | | 15000 | 39000 | 1.696888e+00 | 1.574137e+01 | 9.276609 | @@ -90,3 +90,17 @@ assert alignment.ref_end_next_best == 0 assert alignment.mismatches == 2 assert alignment.cigar_string == "4=1X4=1I5=" ``` + +### Example 5: Print Alignment Result + +```python +import mssw + +reference = "CAGCCTTTCTGACCCGGAAATCAAAATAGGCACAACAAA" +query = "CTGAGCCGGTAAATC" +aligner = mssw.Aligner(match=3, mismatch=1, gap_open=2, gap_extend=2) +alignment = aligner.align(query, reference) +alignment.print() +``` + +![img.png](images/img.png) diff --git a/images/img.png b/images/img.png new file mode 100644 index 0000000..3341b62 Binary files /dev/null and b/images/img.png differ diff --git a/poetry.lock b/poetry.lock index c1f1bd9..c6a7c0f 100644 --- a/poetry.lock +++ b/poetry.lock @@ -26,6 +26,7 @@ mypy-extensions = ">=0.4.3" pathspec = ">=0.9.0" platformdirs = ">=2" tomli = {version = ">=1.1.0", markers = "python_full_version < \"3.11.0a7\""} +typed-ast = {version = ">=1.4.2", markers = "python_version < \"3.8\" and implementation_name == \"cpython\""} typing-extensions = {version = ">=3.10.0.0", markers = "python_version < \"3.10\""} [package.extras] @@ -44,6 +45,7 @@ python-versions = ">=3.7" [package.dependencies] colorama = {version = "*", markers = "platform_system == \"Windows\""} +importlib-metadata = {version = "*", markers = "python_version < \"3.8\""} [[package]] name = "colorama" @@ -53,6 +55,34 @@ category = "dev" optional = false python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" +[[package]] +name = "commonmark" +version = "0.9.1" +description = "Python parser for the CommonMark Markdown spec" +category = "main" +optional = false +python-versions = "*" + +[package.extras] +test = ["flake8 (==3.7.8)", "hypothesis (==3.55.3)"] + +[[package]] +name = "importlib-metadata" +version = "5.0.0" +description = "Read metadata from Python packages" +category = "dev" +optional = false +python-versions = ">=3.7" + +[package.dependencies] +typing-extensions = {version = ">=3.6.4", markers = "python_version < \"3.8\""} +zipp = ">=0.5" + +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)"] +perf = ["ipython"] +testing = ["flake8 (<5)", "flufl.flake8", "importlib-resources (>=1.3)", "packaging", "pyfakefs", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)", "pytest-perf (>=0.9.2)"] + [[package]] name = "iniconfig" version = "1.1.1" @@ -108,6 +138,9 @@ category = "dev" optional = false python-versions = ">=3.6" +[package.dependencies] +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} + [package.extras] dev = ["pre-commit", "tox"] testing = ["pytest", "pytest-benchmark"] @@ -143,6 +176,17 @@ python-versions = ">=3.6" [package.extras] global = ["pybind11-global (==2.10.0)"] +[[package]] +name = "Pygments" +version = "2.13.0" +description = "Pygments is a syntax highlighting package written in Python." +category = "main" +optional = false +python-versions = ">=3.6" + +[package.extras] +plugins = ["importlib-metadata"] + [[package]] name = "pyparsing" version = "3.0.9" @@ -165,6 +209,7 @@ python-versions = ">=3.7" [package.dependencies] attrs = ">=19.2.0" colorama = {version = "*", markers = "sys_platform == \"win32\""} +importlib-metadata = {version = ">=0.12", markers = "python_version < \"3.8\""} iniconfig = "*" packaging = "*" pluggy = ">=0.12,<2.0" @@ -187,6 +232,22 @@ packaging = ">=14.1" pytest = ">=2.9" termcolor = ">=1.1.0" +[[package]] +name = "rich" +version = "12.6.0" +description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" +category = "main" +optional = false +python-versions = ">=3.6.3,<4.0.0" + +[package.dependencies] +commonmark = ">=0.9.0,<0.10.0" +pygments = ">=2.6.0,<3.0.0" +typing-extensions = {version = ">=4.0.0,<5.0", markers = "python_version < \"3.9\""} + +[package.extras] +jupyter = ["ipywidgets (>=7.5.1,<8.0.0)"] + [[package]] name = "ruamel.yaml" version = "0.17.21" @@ -242,18 +303,38 @@ category = "dev" optional = false python-versions = ">=3.7" +[[package]] +name = "typed-ast" +version = "1.5.4" +description = "a fork of Python 2 and 3 ast modules with type comment support" +category = "dev" +optional = false +python-versions = ">=3.6" + [[package]] name = "typing-extensions" version = "4.4.0" description = "Backported and Experimental Type Hints for Python 3.7+" +category = "main" +optional = false +python-versions = ">=3.7" + +[[package]] +name = "zipp" +version = "3.9.0" +description = "Backport of pathlib-compatible object wrapper for zip files" category = "dev" optional = false python-versions = ">=3.7" +[package.extras] +docs = ["furo", "jaraco.packaging (>=9)", "jaraco.tidelift (>=1.4)", "rst.linker (>=1.9)", "sphinx (>=3.5)"] +testing = ["flake8 (<5)", "func-timeout", "jaraco.functools", "jaraco.itertools", "more-itertools", "pytest (>=6)", "pytest-black (>=0.3.7)", "pytest-checkdocs (>=2.4)", "pytest-cov", "pytest-enabler (>=1.3)", "pytest-flake8", "pytest-mypy (>=0.9.1)"] + [metadata] lock-version = "1.1" -python-versions = "^3.8" -content-hash = "8cd88a8fe797c2672c8808edf924e89fb905b6d17223ee81bd7ebf55bea8765a" +python-versions = "^3.7" +content-hash = "76b9c3adbe67faecdb0cdcb0b2d2ea644e932fea7159dbbe87d419a22212f962" [metadata.files] attrs = [ @@ -291,6 +372,14 @@ colorama = [ {file = "colorama-0.4.5-py2.py3-none-any.whl", hash = "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da"}, {file = "colorama-0.4.5.tar.gz", hash = "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4"}, ] +commonmark = [ + {file = "commonmark-0.9.1-py2.py3-none-any.whl", hash = "sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9"}, + {file = "commonmark-0.9.1.tar.gz", hash = "sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60"}, +] +importlib-metadata = [ + {file = "importlib_metadata-5.0.0-py3-none-any.whl", hash = "sha256:ddb0e35065e8938f867ed4928d0ae5bf2a53b7773871bfe6bcc7e4fcdc7dea43"}, + {file = "importlib_metadata-5.0.0.tar.gz", hash = "sha256:da31db32b304314d044d3c12c79bd59e307889b287ad12ff387b3500835fc2ab"}, +] iniconfig = [ {file = "iniconfig-1.1.1-py2.py3-none-any.whl", hash = "sha256:011e24c64b7f47f6ebd835bb12a743f2fbe9a26d4cecaa7f53bc4f35ee9da8b3"}, {file = "iniconfig-1.1.1.tar.gz", hash = "sha256:bc3af051d7d14b2ee5ef9969666def0cd1a000e121eaea580d4a313df4b37f32"}, @@ -327,6 +416,10 @@ pybind11 = [ {file = "pybind11-2.10.0-py3-none-any.whl", hash = "sha256:6bbc7a2f79689307f0d8d240172851955fc214b33e4cbd7fdbc9cd7176a09260"}, {file = "pybind11-2.10.0.tar.gz", hash = "sha256:18977589c10f595f65ec1be90b0a0763b43e458d25d97be9db75b958eb1f43fe"}, ] +Pygments = [ + {file = "Pygments-2.13.0-py3-none-any.whl", hash = "sha256:f643f331ab57ba3c9d89212ee4a2dabc6e94f117cf4eefde99a0574720d14c42"}, + {file = "Pygments-2.13.0.tar.gz", hash = "sha256:56a8508ae95f98e2b9bdf93a6be5ae3f7d8af858b43e02c5a2ff083726be40c1"}, +] pyparsing = [ {file = "pyparsing-3.0.9-py3-none-any.whl", hash = "sha256:5026bae9a10eeaefb61dab2f09052b9f4307d44aee4eda64b309723d8d206bbc"}, {file = "pyparsing-3.0.9.tar.gz", hash = "sha256:2b020ecf7d21b687f219b71ecad3631f644a47f01403fa1d1036b0c6416d70fb"}, @@ -339,6 +432,10 @@ pytest-sugar = [ {file = "pytest-sugar-0.9.5.tar.gz", hash = "sha256:eea78b6f15b635277d3d90280cd386d8feea1cab0f9be75947a626e8b02b477d"}, {file = "pytest_sugar-0.9.5-py2.py3-none-any.whl", hash = "sha256:3da42de32ce4e1e95b448d61c92804433f5d4058c0a765096991c2e93d5a289f"}, ] +rich = [ + {file = "rich-12.6.0-py3-none-any.whl", hash = "sha256:a4eb26484f2c82589bd9a17c73d32a010b1e29d89f1604cd9bf3a2097b81bb5e"}, + {file = "rich-12.6.0.tar.gz", hash = "sha256:ba3a3775974105c221d31141f2c116f4fd65c5ceb0698657a11e9f295ec93fd0"}, +] "ruamel.yaml" = [ {file = "ruamel.yaml-0.17.21-py3-none-any.whl", hash = "sha256:742b35d3d665023981bd6d16b3d24248ce5df75fdb4e2924e93a05c1f8b61ca7"}, {file = "ruamel.yaml-0.17.21.tar.gz", hash = "sha256:8b7ce697a2f212752a35c1ac414471dc16c424c9573be4926b56ff3f5d23b7af"}, @@ -387,7 +484,37 @@ tomli = [ {file = "tomli-2.0.1-py3-none-any.whl", hash = "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc"}, {file = "tomli-2.0.1.tar.gz", hash = "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"}, ] +typed-ast = [ + {file = "typed_ast-1.5.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:669dd0c4167f6f2cd9f57041e03c3c2ebf9063d0757dc89f79ba1daa2bfca9d4"}, + {file = "typed_ast-1.5.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:211260621ab1cd7324e0798d6be953d00b74e0428382991adfddb352252f1d62"}, + {file = "typed_ast-1.5.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:267e3f78697a6c00c689c03db4876dd1efdfea2f251a5ad6555e82a26847b4ac"}, + {file = "typed_ast-1.5.4-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:c542eeda69212fa10a7ada75e668876fdec5f856cd3d06829e6aa64ad17c8dfe"}, + {file = "typed_ast-1.5.4-cp310-cp310-win_amd64.whl", hash = "sha256:a9916d2bb8865f973824fb47436fa45e1ebf2efd920f2b9f99342cb7fab93f72"}, + {file = "typed_ast-1.5.4-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:79b1e0869db7c830ba6a981d58711c88b6677506e648496b1f64ac7d15633aec"}, + {file = "typed_ast-1.5.4-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a94d55d142c9265f4ea46fab70977a1944ecae359ae867397757d836ea5a3f47"}, + {file = "typed_ast-1.5.4-cp36-cp36m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:183afdf0ec5b1b211724dfef3d2cad2d767cbefac291f24d69b00546c1837fb6"}, + {file = "typed_ast-1.5.4-cp36-cp36m-win_amd64.whl", hash = "sha256:639c5f0b21776605dd6c9dbe592d5228f021404dafd377e2b7ac046b0349b1a1"}, + {file = "typed_ast-1.5.4-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:cf4afcfac006ece570e32d6fa90ab74a17245b83dfd6655a6f68568098345ff6"}, + {file = "typed_ast-1.5.4-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ed855bbe3eb3715fca349c80174cfcfd699c2f9de574d40527b8429acae23a66"}, + {file = "typed_ast-1.5.4-cp37-cp37m-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:6778e1b2f81dfc7bc58e4b259363b83d2e509a65198e85d5700dfae4c6c8ff1c"}, + {file = "typed_ast-1.5.4-cp37-cp37m-win_amd64.whl", hash = "sha256:0261195c2062caf107831e92a76764c81227dae162c4f75192c0d489faf751a2"}, + {file = "typed_ast-1.5.4-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:2efae9db7a8c05ad5547d522e7dbe62c83d838d3906a3716d1478b6c1d61388d"}, + {file = "typed_ast-1.5.4-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:7d5d014b7daa8b0bf2eaef684295acae12b036d79f54178b92a2b6a56f92278f"}, + {file = "typed_ast-1.5.4-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:370788a63915e82fd6f212865a596a0fefcbb7d408bbbb13dea723d971ed8bdc"}, + {file = "typed_ast-1.5.4-cp38-cp38-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:4e964b4ff86550a7a7d56345c7864b18f403f5bd7380edf44a3c1fb4ee7ac6c6"}, + {file = "typed_ast-1.5.4-cp38-cp38-win_amd64.whl", hash = "sha256:683407d92dc953c8a7347119596f0b0e6c55eb98ebebd9b23437501b28dcbb8e"}, + {file = "typed_ast-1.5.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:4879da6c9b73443f97e731b617184a596ac1235fe91f98d279a7af36c796da35"}, + {file = "typed_ast-1.5.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:3e123d878ba170397916557d31c8f589951e353cc95fb7f24f6bb69adc1a8a97"}, + {file = "typed_ast-1.5.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ebd9d7f80ccf7a82ac5f88c521115cc55d84e35bf8b446fcd7836eb6b98929a3"}, + {file = "typed_ast-1.5.4-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_12_x86_64.manylinux2010_x86_64.whl", hash = "sha256:98f80dee3c03455e92796b58b98ff6ca0b2a6f652120c263efdba4d6c5e58f72"}, + {file = "typed_ast-1.5.4-cp39-cp39-win_amd64.whl", hash = "sha256:0fdbcf2fef0ca421a3f5912555804296f0b0960f0418c440f5d6d3abb549f3e1"}, + {file = "typed_ast-1.5.4.tar.gz", hash = "sha256:39e21ceb7388e4bb37f4c679d72707ed46c2fbf2a5609b8b8ebc4b067d977df2"}, +] typing-extensions = [ {file = "typing_extensions-4.4.0-py3-none-any.whl", hash = "sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e"}, {file = "typing_extensions-4.4.0.tar.gz", hash = "sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa"}, ] +zipp = [ + {file = "zipp-3.9.0-py3-none-any.whl", hash = "sha256:972cfa31bc2fedd3fa838a51e9bc7e64b7fb725a8c00e7431554311f180e9980"}, + {file = "zipp-3.9.0.tar.gz", hash = "sha256:3a7af91c3db40ec72dd9d154ae18e008c69efe8ca88dde4f9a731bb82fe2f9eb"}, +] diff --git a/pyproject.toml b/pyproject.toml index e00cf51..2d56132 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "mssw" -version = "0.1.4" +version = "0.1.5" description = "Modern Cpp binding for complete-striped-smith-watern-library" authors = ["Yangyang Li "] license = "MIT" @@ -15,14 +15,13 @@ classifiers = [ 'Operating System :: Unix', 'Operating System :: MacOS', 'Programming Language :: Python', - 'Topic :: Communications :: Email', - 'Topic :: Software Development :: Bug Tracking', ] [tool.poetry.dependencies] python = "^3.7" pybind11 = "^2.10.0" setuptools = "^65.4.1" +rich = "^12.6.0" [tool.poetry.group.dev.dependencies] diff --git a/src/mssw/__init__.py b/src/mssw/__init__.py index f4f4f52..866f40e 100644 --- a/src/mssw/__init__.py +++ b/src/mssw/__init__.py @@ -4,17 +4,123 @@ __PACKAGE_NAME__ = "mssw" import mssw.cpp # type: ignore -from mssw.cpp import Alignment, Filter # type: ignore +from mssw.cpp import Filter # type: ignore import typing as t +from rich.console import Console +from rich.table import Table __all__ = ["Aligner", "Alignment", "Filter"] +class Alignment: + """Alignment class.""" + + def __init__(self): + """Init.""" + self._alignment = cpp.Alignment() + + @classmethod + def from_alignment(cls, alignment: "Alignment"): + """Create alignment from cpp alignment.""" + new_alignment = cls() + new_alignment._alignment = alignment + return new_alignment + + @property + def sw_score(self): + """Get sw score.""" + return self._alignment.sw_score + + @property + def sw_score_next_best(self): + """Get sw score next best.""" + return self._alignment.sw_score_next_best + + @property + def ref_begin(self): + """Get ref begin.""" + return self._alignment.ref_begin + + @property + def ref_end(self): + """Get ref end.""" + return self._alignment.ref_end + + @property + def query_begin(self): + """Get query begin.""" + return self._alignment.query_begin + + @property + def query_end(self): + """Get query end.""" + return self._alignment.query_end + + @property + def ref_end_next_best(self): + """Get ref end next best.""" + return self._alignment.ref_end_next_best + + @property + def mismatches(self): + """Get mismatch.""" + return self._alignment.mismatches + + @property + def cigar_string(self): + """Get cigar string.""" + return self._alignment.cigar_string + + @property + def cigar(self): + """Get cigar.""" + return self._alignment.cigar + + def __repr__(self): + """Get string representation.""" + return ( + f"Alignment(sw_score={self.sw_score}, sw_score_next_best={self.sw_score_next_best}, " + f"ref_begin={self.ref_begin}, ref_end={self.ref_end}, query_begin={self.query_begin}, " + f"query_end={self.query_end}, ref_end_next_best={self.ref_end_next_best}, " + f"mismatch={self.mismatch}, cigar_string={self.cigar_string}, cigar={self.cigar})" + ) + + def clear(self): + """Clear alignment.""" + self._alignment.clear() + + def print(self): + """Print alignment.""" + table = Table( + title="Alignment Result", show_header=True, header_style="bold magenta" + ) + table.add_column("Metric", justify="left", style="cyan", no_wrap=True) + table.add_column("Value", justify="right", style="magenta") + + table.add_row("sw_score", str(self.sw_score)) + table.add_row("sw_score_next_best", str(self.sw_score_next_best)) + table.add_row("ref_begin", str(self.ref_begin)) + table.add_row("ref_end", str(self.ref_end)) + table.add_row("query_begin", str(self.query_begin)) + table.add_row("query_end", str(self.query_end)) + table.add_row("ref_end_next_best", str(self.ref_end_next_best)) + table.add_row("mismatch", str(self.mismatches)) + table.add_row("cigar_string", str(self.cigar_string)) + table.add_row("cigar", str(self.cigar)) + + console = Console() + console.print(table) + + class Aligner: def __init__( self, match: int = 2, mismatch: int = 2, gap_open: int = 3, gap_extend: int = 1 ): + self.match = match + self.mismatch = mismatch + self.gap_open = gap_open + self.gap_extend = gap_extend self._aligner = cpp.Aligner(match, mismatch, gap_open, gap_extend) def align( @@ -22,16 +128,25 @@ def align( query, ref, align_filter: t.Optional[cpp.Filter] = None, - alignment: t.Optional[cpp.Alignment] = None, - ): + alignment: t.Optional[Alignment] = None, + ) -> Alignment: if align_filter is None: align_filter = cpp.Filter() mask_len = max(len(ref) / 2, 15) if alignment is None: - alignment = cpp.Alignment() + alignment = Alignment() + self._aligner.Align( - query, ref, len(ref), align_filter, alignment, int(mask_len) + query, ref, len(ref), align_filter, alignment._alignment, int(mask_len) ) return alignment + + def __repr__(self): + return ( + f"Aligner(match={self.match}, mismatch={self.mismatch}, " + f"gap_open={self.gap_open}, gap_extend={self.gap_extend})" + ) + + __str__ = __repr__ diff --git a/src/mssw/cpp/__init__.pyi b/src/mssw/cpp/__init__.pyi index 3839b7b..acaf8e7 100644 --- a/src/mssw/cpp/__init__.pyi +++ b/src/mssw/cpp/__init__.pyi @@ -1,6 +1,5 @@ """Bindings for ::StripedSmithWaterman namespace""" -from __future__ import annotations -import mssw._cpp.StripedSmithWaterman +import mssw._cpp.StripedSmithWaterman # type: ignore import typing __all__ = [ diff --git a/tests/test_aligner.py b/tests/test_aligner.py index f2b3d14..0062051 100644 --- a/tests/test_aligner.py +++ b/tests/test_aligner.py @@ -3,7 +3,7 @@ def print_alignment(alignment): print("===== SSW result =====\n") - print(f"Best Smith-Waterman score:\t{alignment.sw_score}\n") + print("Best Smith-Waterman score:\t{alignment.sw_score}\n") print(f"Next-best Smith-Waterman score:\t{alignment.sw_score_next_best}\n") print(f"Reference start:\t{alignment.ref_begin}\n") print(f"Reference end:\t{alignment.ref_end}\n") @@ -21,7 +21,6 @@ def test_aligner(): aligner = mssw.Aligner() aligner_filter = mssw.Filter() alignment = aligner.align(query, reference, aligner_filter) - print_alignment(alignment) assert alignment.sw_score == 21 assert alignment.sw_score_next_best == 2 assert alignment.ref_begin == 8 @@ -38,7 +37,6 @@ def test_aligner_default(): query = "CTGAGCCGGTAAATC" aligner = mssw.Aligner() alignment = aligner.align(query, reference) - print_alignment(alignment) assert alignment.sw_score == 21 assert alignment.sw_score_next_best == 2 assert alignment.ref_begin == 8 @@ -56,3 +54,4 @@ def test_aligner_with_custom_score(): aligner = mssw.Aligner(match=3, mismatch=10, gap_open=2, gap_extend=2) alignment = aligner.align(query, reference) assert alignment.cigar_string == "4=1I1D4=1I5=" + alignment.print()