<p align="center">
<img
src="https://github.com/davidmeijer/versalign/blob/main/logo.png"
height="150"
/>
</p>
<p align="center">
<a href="https://github.com/davidmeijer/versalign/actions/workflows/tests.yml">
<img
alt="Tests"
src="https://github.com/davidmeijer/versalign/actions/workflows/tests.yml/badge.svg"
/>
</a>
<a href="https://github.com/cthoyt/cookiecutter-python-package">
<img
alt="Cookiecutter template from @cthoyt"
src="https://img.shields.io/badge/Cookiecutter-snekpack-blue"
/>
</a>
<a href="https://github.com/psf/black">
<img
src="https://img.shields.io/badge/Code%20style-black-000000.svg"
alt="Code style: black"
/>
</a>
<a href="https://github.com/davidmeijer/versalign/blob/main/.github/CODE_OF_CONDUCT.md">
<img
src="https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg"
alt="Contributor Covenant"
/>
</a>
</p>
Versalign is Python package that allows you to create multiple sequence alignments for arbitrary lists of objects.
## 💪 Getting Started
Pairwise alignment:
```python
from versalign.motif import Motif
from versalign.pairwise import PairwiseAlignment, align_pairwise
from versalign.sequence import Sequence
class A(Motif):
def __eq__(self, other):
return isinstance(other, A)
def __str__(self):
return "A"
class B(Motif):
def __eq__(self, other):
return isinstance(other, B)
def __str__(self):
return "B"
def score_func(a, b):
if a == b:
return 1
return -1
seq_a = Sequence("seq_a", [A(), A(), A()])
seq_b = Sequence("seq_b", [B(), B(), B()])
aligned_seq_a, aligned_seq_b, score = align_pairwise(
seq_a=seq_a,
seq_b=seq_b,
gap_penalty=2,
end_gap_penalty=1,
score_func=score_func,
algorithm=PairwiseAlignment.NEEDLEMAN_WUNSCH
)
print(aligned_seq_a)
print(aligned_seq_b)
>> AAA---
>> ---BBB
```
Multiple sequence alignment:
```python
from versalign.msa import multiple_sequence_alignment
seq_a = Sequence("seq_a", [A(), A(), A()])
seq_b = Sequence("seq_b", [B(), B(), B()])
seq_c = Sequence("seq_c", [A(), B(), B()])
result = multiple_sequence_alignment(
seqs=[seq_a, seq_b, seq_c],
gap_penalty=2,
end_gap_penalty=1,
score_func=score_func,
)
for seq in result:
print(seq)
>> ---BBB
>> --ABB-
>> AAA---
```
## 🚀 Installation
<!-- The most recent release can be installed from
[PyPI](https://pypi.org/project/versalign/) with:
```shell
pip install versalign
``` -->
The most recent code and data can be installed directly from GitHub with:
```shell
pip install git+https://github.com/davidmeijer/versalign.git
```
## 👐 Contributing
Contributions, whether filing an issue, making a pull request, or forking, are appreciated. See
[CONTRIBUTING.md](https://github.com/davidmeijer/versalign/blob/main/.github/CONTRIBUTING.md) for more information on getting involved.
## 👋 Attribution
### ⚖️ License
The code in this package is licensed under the MIT License.
### 🍪 Cookiecutter
This package was created with [@audreyfeldroy](https://github.com/audreyfeldroy)'s
[cookiecutter](https://github.com/cookiecutter/cookiecutter) package using [@cthoyt](https://github.com/cthoyt)'s
[cookiecutter-snekpack](https://github.com/cthoyt/cookiecutter-snekpack) template.
## 🛠️ For Developers
<details>
<summary>See developer instructions</summary>
The final section of the README is for if you want to get involved by making a code contribution.
### Development Installation
To install in development mode, use the following:
```bash
git clone git+https://github.com/davidmeijer/versalign.git
cd versalign
pip install -e .
```
### 🥼 Testing
After cloning the repository and installing `tox` with `pip install tox`, the unit tests in the `tests/` folder can be
run reproducibly with:
```shell
tox
```
Additionally, these tests are automatically re-run with each commit in a
[GitHub Action](https://github.com/davidmeijer/versalign/actions?query=workflow%3ATests).
### 📦 Making a Release
After installing the package in development mode and installing
`tox` with `pip install tox`, the commands for making a new release are contained within the `finish` environment
in `tox.ini`. Run the following from the shell:
```shell
tox -e finish
```
This script does the following:
1. Uses [Bump2Version](https://github.com/c4urself/bump2version) to switch the version number in the `setup.cfg`,
`src/versalign/version.py`, and [`docs/source/conf.py`](docs/source/conf.py) to not have the `-dev` suffix
2. Packages the code in both a tar archive and a wheel using [`build`](https://github.com/pypa/build)
3. Uploads to PyPI using [`twine`](https://github.com/pypa/twine). Be sure to have a `.pypirc` file
configured to avoid the need for manual input at this step
4. Push to GitHub. You'll need to make a release going with the commit where the version was bumped.
5. Bump the version to the next patch. If you made big changes and want to bump the version by minor, you can
use `tox -e bumpversion -- minor` after.
</details>
Raw data
{
"_id": null,
"home_page": "https://github.com/davidmeijer/versalign",
"name": "versalign",
"maintainer": "David Meijer",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "david.meijer@wur.nl",
"keywords": "snekpack, cookiecutter, pairwise alignment, multiple sequence alignment",
"author": "David Meijer",
"author_email": "david.meijer@wur.nl",
"download_url": "https://files.pythonhosted.org/packages/76/ae/5f317f049bc6944934695f76efeb790af5b389ae10e802c05c601a033a71/versalign-0.0.1.tar.gz",
"platform": null,
"description": "<p align=\"center\">\n <img \n src=\"https://github.com/davidmeijer/versalign/blob/main/logo.png\" \n height=\"150\"\n />\n</p>\n\n<p align=\"center\">\n <a href=\"https://github.com/davidmeijer/versalign/actions/workflows/tests.yml\">\n <img \n alt=\"Tests\" \n src=\"https://github.com/davidmeijer/versalign/actions/workflows/tests.yml/badge.svg\" \n />\n </a>\n <a href=\"https://github.com/cthoyt/cookiecutter-python-package\">\n <img \n alt=\"Cookiecutter template from @cthoyt\" \n src=\"https://img.shields.io/badge/Cookiecutter-snekpack-blue\" \n />\n </a>\n <a href=\"https://github.com/psf/black\">\n <img \n src=\"https://img.shields.io/badge/Code%20style-black-000000.svg\" \n alt=\"Code style: black\" \n />\n </a>\n <a href=\"https://github.com/davidmeijer/versalign/blob/main/.github/CODE_OF_CONDUCT.md\">\n <img \n src=\"https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg\" \n alt=\"Contributor Covenant\"\n />\n </a>\n</p>\n\nVersalign is Python package that allows you to create multiple sequence alignments for arbitrary lists of objects.\n\n## \ud83d\udcaa Getting Started\n\nPairwise alignment:\n\n```python\nfrom versalign.motif import Motif\nfrom versalign.pairwise import PairwiseAlignment, align_pairwise\nfrom versalign.sequence import Sequence\n\nclass A(Motif):\n def __eq__(self, other):\n return isinstance(other, A)\n \n def __str__(self):\n return \"A\"\n\nclass B(Motif):\n def __eq__(self, other):\n return isinstance(other, B)\n \n def __str__(self):\n return \"B\"\n\ndef score_func(a, b):\n if a == b:\n return 1\n return -1\n\nseq_a = Sequence(\"seq_a\", [A(), A(), A()])\nseq_b = Sequence(\"seq_b\", [B(), B(), B()])\n\naligned_seq_a, aligned_seq_b, score = align_pairwise(\n seq_a=seq_a,\n seq_b=seq_b,\n gap_penalty=2,\n end_gap_penalty=1,\n score_func=score_func,\n algorithm=PairwiseAlignment.NEEDLEMAN_WUNSCH\n)\n\nprint(aligned_seq_a)\nprint(aligned_seq_b)\n\n>> AAA---\n>> ---BBB\n```\n\nMultiple sequence alignment:\n\n```python\nfrom versalign.msa import multiple_sequence_alignment\n\nseq_a = Sequence(\"seq_a\", [A(), A(), A()])\nseq_b = Sequence(\"seq_b\", [B(), B(), B()])\nseq_c = Sequence(\"seq_c\", [A(), B(), B()])\n\nresult = multiple_sequence_alignment(\n seqs=[seq_a, seq_b, seq_c],\n gap_penalty=2,\n end_gap_penalty=1,\n score_func=score_func,\n)\n\nfor seq in result:\n print(seq)\n\n>> ---BBB\n>> --ABB-\n>> AAA---\n```\n\n## \ud83d\ude80 Installation\n\n<!-- The most recent release can be installed from\n[PyPI](https://pypi.org/project/versalign/) with:\n\n```shell\npip install versalign\n``` -->\n\nThe most recent code and data can be installed directly from GitHub with:\n\n```shell\npip install git+https://github.com/davidmeijer/versalign.git\n```\n\n## \ud83d\udc50 Contributing\n\nContributions, whether filing an issue, making a pull request, or forking, are appreciated. See\n[CONTRIBUTING.md](https://github.com/davidmeijer/versalign/blob/main/.github/CONTRIBUTING.md) for more information on getting involved.\n\n## \ud83d\udc4b Attribution\n\n### \u2696\ufe0f License\n\nThe code in this package is licensed under the MIT License.\n\n### \ud83c\udf6a Cookiecutter\n\nThis package was created with [@audreyfeldroy](https://github.com/audreyfeldroy)'s\n[cookiecutter](https://github.com/cookiecutter/cookiecutter) package using [@cthoyt](https://github.com/cthoyt)'s\n[cookiecutter-snekpack](https://github.com/cthoyt/cookiecutter-snekpack) template.\n\n## \ud83d\udee0\ufe0f For Developers\n\n<details>\n <summary>See developer instructions</summary>\n\nThe final section of the README is for if you want to get involved by making a code contribution.\n\n### Development Installation\n\nTo install in development mode, use the following:\n\n```bash\ngit clone git+https://github.com/davidmeijer/versalign.git\ncd versalign\npip install -e .\n```\n\n### \ud83e\udd7c Testing\n\nAfter cloning the repository and installing `tox` with `pip install tox`, the unit tests in the `tests/` folder can be\nrun reproducibly with:\n\n```shell\ntox\n```\n\nAdditionally, these tests are automatically re-run with each commit in a\n[GitHub Action](https://github.com/davidmeijer/versalign/actions?query=workflow%3ATests).\n\n### \ud83d\udce6 Making a Release\n\nAfter installing the package in development mode and installing\n`tox` with `pip install tox`, the commands for making a new release are contained within the `finish` environment\nin `tox.ini`. Run the following from the shell:\n\n```shell\ntox -e finish\n```\n\nThis script does the following:\n\n1. Uses [Bump2Version](https://github.com/c4urself/bump2version) to switch the version number in the `setup.cfg`,\n `src/versalign/version.py`, and [`docs/source/conf.py`](docs/source/conf.py) to not have the `-dev` suffix\n2. Packages the code in both a tar archive and a wheel using [`build`](https://github.com/pypa/build)\n3. Uploads to PyPI using [`twine`](https://github.com/pypa/twine). Be sure to have a `.pypirc` file\n configured to avoid the need for manual input at this step\n4. Push to GitHub. You'll need to make a release going with the commit where the version was bumped.\n5. Bump the version to the next patch. If you made big changes and want to bump the version by minor, you can\n use `tox -e bumpversion -- minor` after.\n\n</details>\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Multiple sequence aligner for arbitrary objects.",
"version": "0.0.1",
"project_urls": {
"Download": "https://github.com/davidmeijer/versalign/releases",
"Homepage": "https://github.com/davidmeijer/versalign",
"Source": "https://github.com/davidmeijer/versalign",
"Tracker": "https://github.com/davidmeijer/versalign/issues"
},
"split_keywords": [
"snekpack",
" cookiecutter",
" pairwise alignment",
" multiple sequence alignment"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "e027aa115fdf1c6ded658708f1012c51d5a330bf3007f8552fc95584b295facc",
"md5": "089bd9efa62aed5625fa6c747a6f8c56",
"sha256": "99ed34d6cc0798d754e9b340d5a673e00dcd119f10776054f5176361a2d917c4"
},
"downloads": -1,
"filename": "versalign-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "089bd9efa62aed5625fa6c747a6f8c56",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 14336,
"upload_time": "2024-05-19T11:27:54",
"upload_time_iso_8601": "2024-05-19T11:27:54.908059Z",
"url": "https://files.pythonhosted.org/packages/e0/27/aa115fdf1c6ded658708f1012c51d5a330bf3007f8552fc95584b295facc/versalign-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "76ae5f317f049bc6944934695f76efeb790af5b389ae10e802c05c601a033a71",
"md5": "5ba4490a5b417a3e4576df4a88fc02f5",
"sha256": "984985d93236b47433ee92ec1809598c296d280f53bd923f57896ceeb4e1a28e"
},
"downloads": -1,
"filename": "versalign-0.0.1.tar.gz",
"has_sig": false,
"md5_digest": "5ba4490a5b417a3e4576df4a88fc02f5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 16423,
"upload_time": "2024-05-19T11:27:56",
"upload_time_iso_8601": "2024-05-19T11:27:56.756052Z",
"url": "https://files.pythonhosted.org/packages/76/ae/5f317f049bc6944934695f76efeb790af5b389ae10e802c05c601a033a71/versalign-0.0.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-19 11:27:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "davidmeijer",
"github_project": "versalign",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "versalign"
}