fastaframes


Namefastaframes JSON
Version 1.1.0 PyPI version JSON
download
home_page
SummaryA very simple fasta file parser.
upload_time2023-10-04 00:34:36
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT License Copyright (c) 2023 Patrick Garrett 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 fasta file pandas dataframe data conversion python module fasta format reading files writing files dataclass bioinformatics scientific computing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![example workflow](https://github.com/pgarrett-scripps/FastaFrames/actions/workflows/python-package.yml/badge.svg)
![example workflow](https://github.com/pgarrett-scripps/FastaFrames/actions/workflows/pylint.yml/badge.svg)

# FastaFrames
FastaFrames is a python package to convert between FASTA files and pandas DataFrames.

## Usage

To install fastaframes use pip:

```sh
pip install fastaframes
```

### Reading a FASTA file
```python
from fastaframes import to_df

fasta_df = to_df(data='example.fasta')
```

### Writing a FASTA file
```python
from fastaframes import to_fasta

to_fasta(data=fasta_df, output_file='output.fasta')
```

# Columns:
- **db**: Database from which the sequence was retrieved. db is 'sp' for UniProtKB/Swiss-Prot and 'tr' for UniProtKB/TrEMBL.
- **unique_identifier**: The primary accession number of the UniProtKB entry.
- **entry_name**: The entry name of the UniProtKB entry.
- **protein_name**: The recommended name of the UniProtKB entry as annotated in the RecName field. For UniProtKB/TrEMBL entries without a RecName field, the SubName field is used. In case of multiple SubNames, the first one is used. The 'precursor' attribute is excluded, 'Fragment' is included with the name if applicable.
- **organism_name**:  The scientific name of the organism of the UniProtKB entry.
- **organism_identifier**: The unique identifier of the source organism, assigned by the NCBI.
- **gene_name**: The first gene name of the UniProtKB entry. If there is no gene name, OrderedLocusName or ORFname, the GN field is not listed.
- **protein_existence**: The numerical value describing the evidence for the existence of the protein.
- **sequence_version**: The version number of the sequence.
- **protein_sequence**: The protein amino acid sequence.

## Example FASTA file:

```
>sp|A0A087X1C5|CP2D7_HUMAN Putative cytochrome P450 2D7 OS=Homo sapiens OX=9606 GN=CYP2D7 PE=5 SV=1
MGLEALVPLAMIVAIFLLLVDLMHRHQRWAARYPPGPLPLPGLGNLLHVDFQNTPYCFDQ
```

## Will produce the following:

|   | db | unique_identifier | entry_name   | protein_name                                         | organism_name | organism_identifier | gene_name | protein_existence | sequence_version | protein_sequence                                       |
|---|----|------------------|--------------|------------------------------------------------------|---------------|---------------------|-----------|-------------------|------------------|--------------------------------------------------------|
| 0 | sp | A0A087X1C5       | CP2D7_HUMAN  | Putative cytochrome P450 2D7                         | Homo sapiens  | 9606.0              | CYP2D7    | 5.0               | 1.0              | MGLEALVPLAMIVAIFLLLVDLMHRHQRWAARYPPGPLPLPGLGNLLHVDFQNTPYCFDQ |

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "fastaframes",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "Fasta file,Pandas DataFrame,Data conversion,Python module,FASTA format,Reading files,Writing files,Dataclass,Bioinformatics,Scientific computing",
    "author": "",
    "author_email": "Patrick Garrett <pgarrett@scripps.edu>",
    "download_url": "https://files.pythonhosted.org/packages/be/24/45abc8f786ffedbdb398913602f2edd489964020903d40dc705714bcabbf/fastaframes-1.1.0.tar.gz",
    "platform": null,
    "description": "![example workflow](https://github.com/pgarrett-scripps/FastaFrames/actions/workflows/python-package.yml/badge.svg)\n![example workflow](https://github.com/pgarrett-scripps/FastaFrames/actions/workflows/pylint.yml/badge.svg)\n\n# FastaFrames\nFastaFrames is a python package to convert between FASTA files and pandas DataFrames.\n\n## Usage\n\nTo install fastaframes use pip:\n\n```sh\npip install fastaframes\n```\n\n### Reading a FASTA file\n```python\nfrom fastaframes import to_df\n\nfasta_df = to_df(data='example.fasta')\n```\n\n### Writing a FASTA file\n```python\nfrom fastaframes import to_fasta\n\nto_fasta(data=fasta_df, output_file='output.fasta')\n```\n\n# Columns:\n- **db**: Database from which the sequence was retrieved. db is 'sp' for UniProtKB/Swiss-Prot and 'tr' for UniProtKB/TrEMBL.\n- **unique_identifier**: The primary accession number of the UniProtKB entry.\n- **entry_name**: The entry name of the UniProtKB entry.\n- **protein_name**: The recommended name of the UniProtKB entry as annotated in the RecName field. For UniProtKB/TrEMBL entries without a RecName field, the SubName field is used. In case of multiple SubNames, the first one is used. The 'precursor' attribute is excluded, 'Fragment' is included with the name if applicable.\n- **organism_name**:  The scientific name of the organism of the UniProtKB entry.\n- **organism_identifier**: The unique identifier of the source organism, assigned by the NCBI.\n- **gene_name**: The first gene name of the UniProtKB entry. If there is no gene name, OrderedLocusName or ORFname, the GN field is not listed.\n- **protein_existence**: The numerical value describing the evidence for the existence of the protein.\n- **sequence_version**: The version number of the sequence.\n- **protein_sequence**: The protein amino acid sequence.\n\n## Example FASTA file:\n\n```\n>sp|A0A087X1C5|CP2D7_HUMAN Putative cytochrome P450 2D7 OS=Homo sapiens OX=9606 GN=CYP2D7 PE=5 SV=1\nMGLEALVPLAMIVAIFLLLVDLMHRHQRWAARYPPGPLPLPGLGNLLHVDFQNTPYCFDQ\n```\n\n## Will produce the following:\n\n|   | db | unique_identifier | entry_name   | protein_name                                         | organism_name | organism_identifier | gene_name | protein_existence | sequence_version | protein_sequence                                       |\n|---|----|------------------|--------------|------------------------------------------------------|---------------|---------------------|-----------|-------------------|------------------|--------------------------------------------------------|\n| 0 | sp | A0A087X1C5       | CP2D7_HUMAN  | Putative cytochrome P450 2D7                         | Homo sapiens  | 9606.0              | CYP2D7    | 5.0               | 1.0              | MGLEALVPLAMIVAIFLLLVDLMHRHQRWAARYPPGPLPLPGLGNLLHVDFQNTPYCFDQ |\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2023 Patrick Garrett  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": "A very simple fasta file parser.",
    "version": "1.1.0",
    "project_urls": {
        "repository": "https://github.com/pgarrett-scripps/FastaFrames.git"
    },
    "split_keywords": [
        "fasta file",
        "pandas dataframe",
        "data conversion",
        "python module",
        "fasta format",
        "reading files",
        "writing files",
        "dataclass",
        "bioinformatics",
        "scientific computing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5e1e56be90be78fc1b3a956d5d572a1de7daa33cba0c92fa1aadba26128a66e2",
                "md5": "041244aeed31580e37f035ae78f3fbca",
                "sha256": "b667fac873149dd2f76970abf338fc1fa6466fb5b0309bb204d18aa5c9724474"
            },
            "downloads": -1,
            "filename": "fastaframes-1.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "041244aeed31580e37f035ae78f3fbca",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 8316,
            "upload_time": "2023-10-04T00:34:34",
            "upload_time_iso_8601": "2023-10-04T00:34:34.530948Z",
            "url": "https://files.pythonhosted.org/packages/5e/1e/56be90be78fc1b3a956d5d572a1de7daa33cba0c92fa1aadba26128a66e2/fastaframes-1.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "be2445abc8f786ffedbdb398913602f2edd489964020903d40dc705714bcabbf",
                "md5": "951fe08f3807d4d813b0d54fb73a3f45",
                "sha256": "fc6abaff395db8df3cdb1c093bdc1f62f6d5fab726a56ad39bc2ff621f2d0346"
            },
            "downloads": -1,
            "filename": "fastaframes-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "951fe08f3807d4d813b0d54fb73a3f45",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 11252,
            "upload_time": "2023-10-04T00:34:36",
            "upload_time_iso_8601": "2023-10-04T00:34:36.075164Z",
            "url": "https://files.pythonhosted.org/packages/be/24/45abc8f786ffedbdb398913602f2edd489964020903d40dc705714bcabbf/fastaframes-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-04 00:34:36",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pgarrett-scripps",
    "github_project": "FastaFrames",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "fastaframes"
}
        
Elapsed time: 0.12092s