streq


Namestreq JSON
Version 0.0.2 PyPI version JSON
download
home_page
SummaryBasic utilities for working with nucleotide sequence strings.
upload_time2023-06-02 11:14:51
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT License Copyright (c) [year] [fullname] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords nucleotide sequence science
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🧬 streq

![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/scbirlab/streq/python-publish.yml)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/streq)
![PyPI](https://img.shields.io/pypi/v/streq)

Python utilities for working with nucleotide sequence strings.

## Installation

### The easy way

Install the pre-compiled version from PyPI:

```bash
pip install streq
```

### From source

Clone the repository, then `cd` into it. Then run:

```bash
pip install -e .
```

## Usage

Streq provides various utility functions in Python for working with nucleotide sequences. 
Sequences can be upper or lower case, and case will be preserved through transformations.

### Transformations

Reverse complement.

```python
>>> import streq as sq
>>>
>>> sq.reverse_complement('ATCG')
'CGAT'
```

Convert between RNA and DNA alphabets.

```python
>>> sq.to_rna('ATCG')
'AUCG'
>>> sq.to_dna('AUCG')
'ATCG'
```

Slice circular sequences such as plasmids or bacterial genomes.

```python
>>> sq.Circular('ATCG')[-1:3]
'GATC'
>>> sq.reverse_complement(sq.Circular('ATCG'))[-1:3]
'CGAT'
```

Cases are preserved throughout the transformations.

```python
>>> sq.reverse_complement(sq.Circular('ATCg'))
'cGAT'
```

### Calculations

Get GC and pyrimidine content.

```python
>>> sq.gc_content('AGGG')
0.75
>>> sq.pyrimidine_content('AUGGG')
0.2
```

Get autocorrelation (rough indicator for secondary structure).

```python
>>> sq.correlation('AACC')
0.0
>>> sq.correlation('AAATTT')
2.3
>>> sq.correlation('AAATTCT')
1.3047619047619046
>>> sq.correlation('AAACTTT')
1.9238095238095236
```

Wobble base-pairing can be taken into account.

```python
>>> correlation('GGGTTT')
0.0
>>> correlation('GGGTTT', wobble=True)
2.3
>>> correlation('GGGUUU', wobble=True)
2.3
```

Provide a second sequence to get correlation between sequences.

```python
>>> sq.correlation('AAA', 'TTT')
0.0
>>> sq.correlation('AAA', 'AAA')
3.0
```

### Distances

Calculate Levenshtein (insert, delete, mutate) distance.

```python
>>> sq.levenshtein('AAATTT', 'AAATTT')
0
>>> sq.levenshtein('AAATTT', 'ACTTT')
2
>>> sq.levenshtein('AAAG', 'TCGA')
4
```

Calculate Hamming (mismatch) distance.

```python
>>> sq.hamming('AAA', 'ATA')
1
>>> sq.hamming('AAA', 'ATT')
2
>>> sq.hamming('AAA', 'TTT')
3
```

### Search

Search sequences using IUPAC symbols and iterate through the results.

```python
>>> for (start, end), match in sq.find_iupac('ARY', 'AATAGCAGTGTGAAC'):
...     print(f"Found ARY at {start}:{end}: {match}")
... 
Found ARY at 0:3: AAT
Found ARY at 3:6: AGC
Found ARY at 6:9: AGT
Found ARY at 12:15: AAC
```

Find common Type IIS restriction sites:

```python
>>> sq.which_re_sites('AAAGAAG')
()
>>> sq.which_re_sites('AAAGAAGAC')
('BbsI',)
>>> sq.which_re_sites('AAAGAAGACACCTGC')
('BbsI', 'PaqCI')
```

## Documentation

Check the API [here](https://streq.readthedocs.io/).

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "streq",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "nucleotide,sequence,science",
    "author": "",
    "author_email": "Eachan Johnson <eachan.johnson@crick.ac.uk>",
    "download_url": "https://files.pythonhosted.org/packages/5b/1c/029c36d432f7cba09ef72d29ab039092579fb9c179a936a80bb2228dc6d6/streq-0.0.2.tar.gz",
    "platform": null,
    "description": "# \ud83e\uddec streq\n\n![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/scbirlab/streq/python-publish.yml)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/streq)\n![PyPI](https://img.shields.io/pypi/v/streq)\n\nPython utilities for working with nucleotide sequence strings.\n\n## Installation\n\n### The easy way\n\nInstall the pre-compiled version from PyPI:\n\n```bash\npip install streq\n```\n\n### From source\n\nClone the repository, then `cd` into it. Then run:\n\n```bash\npip install -e .\n```\n\n## Usage\n\nStreq provides various utility functions in Python for working with nucleotide sequences. \nSequences can be upper or lower case, and case will be preserved through transformations.\n\n### Transformations\n\nReverse complement.\n\n```python\n>>> import streq as sq\n>>>\n>>> sq.reverse_complement('ATCG')\n'CGAT'\n```\n\nConvert between RNA and DNA alphabets.\n\n```python\n>>> sq.to_rna('ATCG')\n'AUCG'\n>>> sq.to_dna('AUCG')\n'ATCG'\n```\n\nSlice circular sequences such as plasmids or bacterial genomes.\n\n```python\n>>> sq.Circular('ATCG')[-1:3]\n'GATC'\n>>> sq.reverse_complement(sq.Circular('ATCG'))[-1:3]\n'CGAT'\n```\n\nCases are preserved throughout the transformations.\n\n```python\n>>> sq.reverse_complement(sq.Circular('ATCg'))\n'cGAT'\n```\n\n### Calculations\n\nGet GC and pyrimidine content.\n\n```python\n>>> sq.gc_content('AGGG')\n0.75\n>>> sq.pyrimidine_content('AUGGG')\n0.2\n```\n\nGet autocorrelation (rough indicator for secondary structure).\n\n```python\n>>> sq.correlation('AACC')\n0.0\n>>> sq.correlation('AAATTT')\n2.3\n>>> sq.correlation('AAATTCT')\n1.3047619047619046\n>>> sq.correlation('AAACTTT')\n1.9238095238095236\n```\n\nWobble base-pairing can be taken into account.\n\n```python\n>>> correlation('GGGTTT')\n0.0\n>>> correlation('GGGTTT', wobble=True)\n2.3\n>>> correlation('GGGUUU', wobble=True)\n2.3\n```\n\nProvide a second sequence to get correlation between sequences.\n\n```python\n>>> sq.correlation('AAA', 'TTT')\n0.0\n>>> sq.correlation('AAA', 'AAA')\n3.0\n```\n\n### Distances\n\nCalculate Levenshtein (insert, delete, mutate) distance.\n\n```python\n>>> sq.levenshtein('AAATTT', 'AAATTT')\n0\n>>> sq.levenshtein('AAATTT', 'ACTTT')\n2\n>>> sq.levenshtein('AAAG', 'TCGA')\n4\n```\n\nCalculate Hamming (mismatch) distance.\n\n```python\n>>> sq.hamming('AAA', 'ATA')\n1\n>>> sq.hamming('AAA', 'ATT')\n2\n>>> sq.hamming('AAA', 'TTT')\n3\n```\n\n### Search\n\nSearch sequences using IUPAC symbols and iterate through the results.\n\n```python\n>>> for (start, end), match in sq.find_iupac('ARY', 'AATAGCAGTGTGAAC'):\n...     print(f\"Found ARY at {start}:{end}: {match}\")\n... \nFound ARY at 0:3: AAT\nFound ARY at 3:6: AGC\nFound ARY at 6:9: AGT\nFound ARY at 12:15: AAC\n```\n\nFind common Type IIS restriction sites:\n\n```python\n>>> sq.which_re_sites('AAAGAAG')\n()\n>>> sq.which_re_sites('AAAGAAGAC')\n('BbsI',)\n>>> sq.which_re_sites('AAAGAAGACACCTGC')\n('BbsI', 'PaqCI')\n```\n\n## Documentation\n\nCheck the API [here](https://streq.readthedocs.io/).\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) [year] [fullname]  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Basic utilities for working with nucleotide sequence strings.",
    "version": "0.0.2",
    "project_urls": {
        "Bug Tracker": "https://github.com/scbirlab/streq/issues",
        "Homepage": "https://github.com/scbirlab/streq"
    },
    "split_keywords": [
        "nucleotide",
        "sequence",
        "science"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "471e91239bcf5732649f5abea37b92062c774e9b65fa17eb40377e62bbed8298",
                "md5": "aca0dfa99b1cd9ee52b6b946eb5fb25a",
                "sha256": "025b21858dd3a05a58cd485bec440b6412c52c7cadca5fe4bfd830185f8f132b"
            },
            "downloads": -1,
            "filename": "streq-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "aca0dfa99b1cd9ee52b6b946eb5fb25a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 9508,
            "upload_time": "2023-06-02T11:14:50",
            "upload_time_iso_8601": "2023-06-02T11:14:50.474602Z",
            "url": "https://files.pythonhosted.org/packages/47/1e/91239bcf5732649f5abea37b92062c774e9b65fa17eb40377e62bbed8298/streq-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5b1c029c36d432f7cba09ef72d29ab039092579fb9c179a936a80bb2228dc6d6",
                "md5": "ad02a75976068a8ffd628f1a65dafbf6",
                "sha256": "01fa54a8d3cfe95a493ea6800a9b98025f19611fb4fd2576e83f5ec7de525133"
            },
            "downloads": -1,
            "filename": "streq-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "ad02a75976068a8ffd628f1a65dafbf6",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 9653,
            "upload_time": "2023-06-02T11:14:51",
            "upload_time_iso_8601": "2023-06-02T11:14:51.899531Z",
            "url": "https://files.pythonhosted.org/packages/5b/1c/029c36d432f7cba09ef72d29ab039092579fb9c179a936a80bb2228dc6d6/streq-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-02 11:14:51",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "scbirlab",
    "github_project": "streq",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "streq"
}
        
Elapsed time: 0.07066s