# SEQUAL / seq=
Sequal is a Python package for in-silico generation of modified sequences from a sequence input and modifications. It is designed to assist in protein engineering, mass spectrometry analysis, drug design, and other bioinformatics research.
## Features
- Generate all possible sequences with static and variable modifications.
- Support for custom modification annotations.
- Utilities for mass spectrometry fragment generation.
## Installation
To install Sequal, use pip:
```sh
pip install sequal
````
## Usage
### Sequence comprehension
Using Sequence Object with Unmodified Protein Sequence
```python
from sequal.sequence import Sequence
#Using Sequence object with unmodified protein sequence
seq = Sequence("TESTEST")
print(seq.seq) #should print "TESTEST"
print(seq[0:2]) #should print "TE"
```
Using Sequence Object with Modified Protein Sequence
```python
from sequal.sequence import Sequence
#Using Sequence object with modified protein sequence. []{}() could all be used as modification annotation.
seq = Sequence("TEN[HexNAc]ST")
for i in seq.seq:
print(i, i.mods) #should print N [HexNAc] on the 3rd amino acid
seq = Sequence("TEN[HexNAc][HexNAc]ST")
for i in seq.seq:
print(i, i.mods) #should print N [HexNAc, HexNAc] on the 3rd amino acid
# .mods property provides an access to all amino acids at this amino acid
seq = Sequence("TE[HexNAc]NST", mod_position="left") #mod_position left indicate that the modification should be on the left of the amino acid instead of default which is right
for i in seq.seq:
print(i, i.mods) #should print N [HexNAc] on the 3rd amino acid
```
Custom Annotation Formatting
```python
from sequal.sequence import Sequence
#Format sequence with custom annotation
seq = Sequence("TENST")
a = {1:"tes", 2:["1", "200"]}
print(seq.to_string_customize(a, individual_annotation_enclose=False, individual_annotation_separator="."))
# By supplying .to_string_customize with a dictionary of position on the sequence that you wish to annotate
# The above would print out TE[tes]N[1.200]ST
```
### Modification
Creating a Modification Object
```python
from sequal.modification import Modification
# Create a modification object and try to find all its possible positions using regex
mod = Modification("HexNAc", regex_pattern="N[^P][S|T]")
for ps, pe in mod.find_positions("TESNEST"):
print(ps, pe)
# this should print out the position 3 on the sequence as the start of the match and position 6 as the end of the match
```
### Generating Modified Sequences
Static Modification
```python
from sequal.sequence import ModdedSequenceGenerator
from sequal.modification import Modification
propiona = Modification("Propionamide", regex_pattern="C", mod_type="static")
seq = "TECSNTT"
mods = [propiona]
g = ModdedSequenceGenerator(seq, static_mods=mods)
for i in g.generate():
print(i) # should print {2: [Propionamide]}
```
Variable Modification
```python
from sequal.sequence import ModdedSequenceGenerator
from sequal.modification import Modification
nsequon = Modification("HexNAc", regex_pattern="N[^P][S|T]", mod_type="variable", labile=True)
osequon = Modification("Mannose", regex_pattern="[S|T]", mod_type="variable", labile=True)
carbox = Modification("Carboxylation", regex_pattern="E", mod_type="variable", labile=True)
seq = "TECSNTT"
mods = [nsequon, osequon, carbox]
g = ModdedSequenceGenerator(seq, mods, [])
print(g.variable_map.mod_position_dict)
# should print {'HexNAc0': [3], 'Mannose0': [0, 2, 4, 5, 6], 'Carboxylation0': [1]}
for i in g.generate():
print(i)
# should print all possible combinations of variable modifications
```
### Mass spectrometry utilities
Generating Non-Labile and Labile Ions
```python
from sequal.mass_spectrometry import fragment_non_labile, fragment_labile
from sequal.modification import Modification
from sequal.sequence import ModdedSequenceGenerator, Sequence
nsequon = Modification("HexNAc", regex_pattern="N[^P][S|T]", mod_type="variable", labile=True, labile_number=1, mass=203)
propiona = Modification("Propionamide", regex_pattern="C", mod_type="static", mass=71)
seq = "TECSNTT"
static_mods = [propiona]
variable_mods = [nsequon]
g = ModdedSequenceGenerator(seq, variable_mods, static_mods)
for i in g.generate():
print(i)
s = Sequence(seq, mods=i)
for b, y in fragment_non_labile(s, "by"):
print(b, "b{}".format(b.fragment_number))
print(y, "y{}".format(y.fragment_number))
g = ModdedSequenceGenerator(seq, variable_mods, static_mods)
for i in g.generate():
s = Sequence(seq, mods=i)
ion = fragment_labile(s)
if ion.has_labile:
print(ion, "Y{}".format(ion.fragment_number))
print(ion.mz_calculate(1))
```
## License
This project is licensed under the MIT License - see the LICENSE file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "sequal",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.9",
"maintainer_email": null,
"keywords": "protein sequence, modification, mass spectrometry",
"author": "Toan K. Phung",
"author_email": "toan.phungkhoiquoctoan@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/27/15/36a49fb9541b023b702b0dc033fb60a1f5a27ff8712b47c773186ed5921d/sequal-1.0.3.tar.gz",
"platform": null,
"description": "# SEQUAL / seq=\n\nSequal is a Python package for in-silico generation of modified sequences from a sequence input and modifications. It is designed to assist in protein engineering, mass spectrometry analysis, drug design, and other bioinformatics research.\n\n## Features\n\n- Generate all possible sequences with static and variable modifications.\n- Support for custom modification annotations.\n- Utilities for mass spectrometry fragment generation.\n\n## Installation\n\nTo install Sequal, use pip:\n\n```sh\npip install sequal\n````\n\n## Usage\n\n### Sequence comprehension\n\nUsing Sequence Object with Unmodified Protein Sequence\n\n```python\nfrom sequal.sequence import Sequence\n#Using Sequence object with unmodified protein sequence\n\nseq = Sequence(\"TESTEST\")\nprint(seq.seq) #should print \"TESTEST\"\nprint(seq[0:2]) #should print \"TE\"\n```\n\nUsing Sequence Object with Modified Protein Sequence\n\n```python\nfrom sequal.sequence import Sequence\n#Using Sequence object with modified protein sequence. []{}() could all be used as modification annotation. \n\nseq = Sequence(\"TEN[HexNAc]ST\")\nfor i in seq.seq:\n print(i, i.mods) #should print N [HexNAc] on the 3rd amino acid\n\nseq = Sequence(\"TEN[HexNAc][HexNAc]ST\")\nfor i in seq.seq:\n print(i, i.mods) #should print N [HexNAc, HexNAc] on the 3rd amino acid \n\n# .mods property provides an access to all amino acids at this amino acid\n\nseq = Sequence(\"TE[HexNAc]NST\", mod_position=\"left\") #mod_position left indicate that the modification should be on the left of the amino acid instead of default which is right\nfor i in seq.seq:\n print(i, i.mods) #should print N [HexNAc] on the 3rd amino acid\n```\n\nCustom Annotation Formatting\n\n```python\nfrom sequal.sequence import Sequence\n#Format sequence with custom annotation\nseq = Sequence(\"TENST\")\na = {1:\"tes\", 2:[\"1\", \"200\"]}\nprint(seq.to_string_customize(a, individual_annotation_enclose=False, individual_annotation_separator=\".\"))\n# By supplying .to_string_customize with a dictionary of position on the sequence that you wish to annotate\n# The above would print out TE[tes]N[1.200]ST\n```\n\n### Modification\n\nCreating a Modification Object\n\n```python\nfrom sequal.modification import Modification\n\n# Create a modification object and try to find all its possible positions using regex\nmod = Modification(\"HexNAc\", regex_pattern=\"N[^P][S|T]\")\nfor ps, pe in mod.find_positions(\"TESNEST\"):\n print(ps, pe)\n # this should print out the position 3 on the sequence as the start of the match and position 6 as the end of the match\n```\n\n### Generating Modified Sequences\n\nStatic Modification\n\n```python\nfrom sequal.sequence import ModdedSequenceGenerator\nfrom sequal.modification import Modification\n\npropiona = Modification(\"Propionamide\", regex_pattern=\"C\", mod_type=\"static\")\nseq = \"TECSNTT\"\nmods = [propiona]\ng = ModdedSequenceGenerator(seq, static_mods=mods)\nfor i in g.generate():\n print(i) # should print {2: [Propionamide]}\n```\n\nVariable Modification\n\n```python\nfrom sequal.sequence import ModdedSequenceGenerator\nfrom sequal.modification import Modification\n\nnsequon = Modification(\"HexNAc\", regex_pattern=\"N[^P][S|T]\", mod_type=\"variable\", labile=True)\nosequon = Modification(\"Mannose\", regex_pattern=\"[S|T]\", mod_type=\"variable\", labile=True)\ncarbox = Modification(\"Carboxylation\", regex_pattern=\"E\", mod_type=\"variable\", labile=True)\n\nseq = \"TECSNTT\"\nmods = [nsequon, osequon, carbox]\ng = ModdedSequenceGenerator(seq, mods, [])\nprint(g.variable_map.mod_position_dict)\n# should print {'HexNAc0': [3], 'Mannose0': [0, 2, 4, 5, 6], 'Carboxylation0': [1]}\n\nfor i in g.generate():\n print(i)\n # should print all possible combinations of variable modifications\n```\n\n### Mass spectrometry utilities\n\nGenerating Non-Labile and Labile Ions\n\n```python\nfrom sequal.mass_spectrometry import fragment_non_labile, fragment_labile\nfrom sequal.modification import Modification\nfrom sequal.sequence import ModdedSequenceGenerator, Sequence\n\nnsequon = Modification(\"HexNAc\", regex_pattern=\"N[^P][S|T]\", mod_type=\"variable\", labile=True, labile_number=1, mass=203)\npropiona = Modification(\"Propionamide\", regex_pattern=\"C\", mod_type=\"static\", mass=71)\n\nseq = \"TECSNTT\"\nstatic_mods = [propiona]\nvariable_mods = [nsequon]\n\ng = ModdedSequenceGenerator(seq, variable_mods, static_mods)\nfor i in g.generate():\n print(i)\n s = Sequence(seq, mods=i)\n for b, y in fragment_non_labile(s, \"by\"):\n print(b, \"b{}\".format(b.fragment_number))\n print(y, \"y{}\".format(y.fragment_number))\n\ng = ModdedSequenceGenerator(seq, variable_mods, static_mods)\nfor i in g.generate():\n s = Sequence(seq, mods=i)\n ion = fragment_labile(s)\n if ion.has_labile:\n print(ion, \"Y{}\".format(ion.fragment_number))\n print(ion.mz_calculate(1))\n```\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python package for working with protein sequence and PTM",
"version": "1.0.3",
"project_urls": null,
"split_keywords": [
"protein sequence",
" modification",
" mass spectrometry"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0a7b16474c2871d462c0b5dd5ddf04e88355edd522f5d8f1bbc8cbbcdf9db73f",
"md5": "1eea418498e4efeb5a3f9d23fba7c722",
"sha256": "b09493b17853433771c586f5ab70c799906bbb7b48031a1c6b7e251923881aaf"
},
"downloads": -1,
"filename": "sequal-1.0.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1eea418498e4efeb5a3f9d23fba7c722",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.9",
"size": 14831,
"upload_time": "2024-08-02T14:16:54",
"upload_time_iso_8601": "2024-08-02T14:16:54.256429Z",
"url": "https://files.pythonhosted.org/packages/0a/7b/16474c2871d462c0b5dd5ddf04e88355edd522f5d8f1bbc8cbbcdf9db73f/sequal-1.0.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "271536a49fb9541b023b702b0dc033fb60a1f5a27ff8712b47c773186ed5921d",
"md5": "0b9bb52ac356afb1a7061b25d5dd31e3",
"sha256": "8674ffae9e2740377718c40b797f5cf3355cd41cbfc6acda759af526ffe1147d"
},
"downloads": -1,
"filename": "sequal-1.0.3.tar.gz",
"has_sig": false,
"md5_digest": "0b9bb52ac356afb1a7061b25d5dd31e3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.9",
"size": 12990,
"upload_time": "2024-08-02T14:16:56",
"upload_time_iso_8601": "2024-08-02T14:16:56.110577Z",
"url": "https://files.pythonhosted.org/packages/27/15/36a49fb9541b023b702b0dc033fb60a1f5a27ff8712b47c773186ed5921d/sequal-1.0.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-02 14:16:56",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "sequal"
}