filterframes


Namefilterframes JSON
Version 0.1.3 PyPI version JSON
download
home_page
SummaryA very simple DTASelect-Filter.txt parser.
upload_time2023-06-14 21:29:26
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 ip2 paser parser streamlit dtaselect-filter peptide protein proteomics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![example workflow](https://github.com/pgarrett-scripps/FilterFrames/actions/workflows/python-package.yml/badge.svg)
![example workflow](https://github.com/pgarrett-scripps/FilterFrames/actions/workflows/pylint.yml/badge.svg)

# filterframes

filterframes is a Python package that provides an easy way to parse and manipulate DTASelect filter 
files using pandas. The package allows you to read DTASelect-filter.txt files, create peptide and protein dataframes, 
modify the dataframes, and write the modified dataframes back to a new DTASelect-filter.txt file. 

### Note on dataframe columns:

The column names in the peptide and protein dataframes will correspond to the header lines in the DTASelect-filter.txt
files. In order to edit and output a valid DTASelect-filter file you must ensure that the
peptide and protein dataframe column names and order are conserved, and that no additional columns are 
included. Any changes in the columns order or names will be reflected  in the output DTASelect-filter.txt file.

## Installation

You can install filterframes using pip:

```sh
pip install filterframes
```

You can also install filterframes locally:

```sh
git clone https://github.com/pgarrett-scripps/FilterFrames.git
cd filterframes
pip install .
```

## Usage

Here are some basic examples of how to use the package:

### Example Python Script:
```python
from filterframes import from_dta_select_filter, to_dta_select_filter

# Read DTASelect-filter.txt file and create peptide and protein dataframes
file_input = r'tests/data/DTASelect-filter_V2_1_12_paser.txt'
header_lines, peptide_df, protein_df, end_lines = from_dta_select_filter(file_input)

# Display the first 5 rows of the peptide and protein dataframes
print("Peptide DataFrame:")
print(peptide_df.head())
print("\nProtein DataFrame:")
print(protein_df.head())

# Modify peptide or protein dataframes as needed (e.g., filtering, normalization, etc.)
# ...

# Write modified peptide and protein dataframes back to a DTASelect-filter.txt file
file_output = r'tests/data/DTASelect-filter_V2_1_12_paser.out.txt'
with open(file_output, 'w') as f:
    output_string_io = to_dta_select_filter(header_lines, peptide_df, protein_df, end_lines)
    f.write(output_string_io.getvalue())

print(f"\nModified DTASelect-filter.txt file saved to {file_output}")
```

### Example Streamlit App:

```python
# app.py
from io import StringIO

import streamlit as st
from filterframes import from_dta_select_filter, to_dta_select_filter

uploaded_filter_file = st.file_uploader("Choose a DTASelect-filter.txt file", type="txt")

if uploaded_filter_file:
    header_lines, peptide_df, protein_df, end_lines = from_dta_select_filter(StringIO(uploaded_filter_file.getvalue().decode('utf-8')))
    
    st.header('Peptide df')
    st.dataframe(peptide_df)
    st.header('Protein df')
    st.dataframe(protein_df)

    # Modify peptide or protein dataframes as needed (e.g., filtering, normalization, etc.)
    # ...

    io = to_dta_select_filter(header_lines, peptide_df, protein_df, end_lines)

    st.download_button(label="Download Filter",
                       data=io.getvalue(),
                       file_name="DTASelect-filter.txt",
                       mime="text/plain")
```

## Functions
The main functions provided by the package are:


```
from_dta_select_filter(file_input: Union[str, TextIOWrapper, StringIO]) -> Tuple[List[str], pd.DataFrame, pd.DataFrame, List[str]]
```

Reads a DTASelect-filter.txt file and returns header lines, peptide dataframe, protein dataframe, and end lines.


```
to_dta_select_filter(header_lines: List[str], peptide_df: pd.DataFrame, protein_df: pd.DataFrame, end_lines: List[str]) -> StringIO
```

Writes the given header lines, peptide dataframe, protein dataframe, and end lines to a StringIO object in the DTASelect-filter.txt format.


            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "filterframes",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "IP2,PASER,Parser,Streamlit,DTASelect-filter,Peptide,Protein,Proteomics",
    "author": "",
    "author_email": "Patrick Garrett <pgarrett@scripps.edu>",
    "download_url": "https://files.pythonhosted.org/packages/c0/f0/81f03a4324fd8ba138280ce70496d273b84bad97b5351684b0195a5443d3/filterframes-0.1.3.tar.gz",
    "platform": null,
    "description": "![example workflow](https://github.com/pgarrett-scripps/FilterFrames/actions/workflows/python-package.yml/badge.svg)\n![example workflow](https://github.com/pgarrett-scripps/FilterFrames/actions/workflows/pylint.yml/badge.svg)\n\n# filterframes\n\nfilterframes is a Python package that provides an easy way to parse and manipulate DTASelect filter \nfiles using pandas. The package allows you to read DTASelect-filter.txt files, create peptide and protein dataframes, \nmodify the dataframes, and write the modified dataframes back to a new DTASelect-filter.txt file. \n\n### Note on dataframe columns:\n\nThe column names in the peptide and protein dataframes will correspond to the header lines in the DTASelect-filter.txt\nfiles. In order to edit and output a valid DTASelect-filter file you must ensure that the\npeptide and protein dataframe column names and order are conserved, and that no additional columns are \nincluded. Any changes in the columns order or names will be reflected  in the output DTASelect-filter.txt file.\n\n## Installation\n\nYou can install filterframes using pip:\n\n```sh\npip install filterframes\n```\n\nYou can also install filterframes locally:\n\n```sh\ngit clone https://github.com/pgarrett-scripps/FilterFrames.git\ncd filterframes\npip install .\n```\n\n## Usage\n\nHere are some basic examples of how to use the package:\n\n### Example Python Script:\n```python\nfrom filterframes import from_dta_select_filter, to_dta_select_filter\n\n# Read DTASelect-filter.txt file and create peptide and protein dataframes\nfile_input = r'tests/data/DTASelect-filter_V2_1_12_paser.txt'\nheader_lines, peptide_df, protein_df, end_lines = from_dta_select_filter(file_input)\n\n# Display the first 5 rows of the peptide and protein dataframes\nprint(\"Peptide DataFrame:\")\nprint(peptide_df.head())\nprint(\"\\nProtein DataFrame:\")\nprint(protein_df.head())\n\n# Modify peptide or protein dataframes as needed (e.g., filtering, normalization, etc.)\n# ...\n\n# Write modified peptide and protein dataframes back to a DTASelect-filter.txt file\nfile_output = r'tests/data/DTASelect-filter_V2_1_12_paser.out.txt'\nwith open(file_output, 'w') as f:\n    output_string_io = to_dta_select_filter(header_lines, peptide_df, protein_df, end_lines)\n    f.write(output_string_io.getvalue())\n\nprint(f\"\\nModified DTASelect-filter.txt file saved to {file_output}\")\n```\n\n### Example Streamlit App:\n\n```python\n# app.py\nfrom io import StringIO\n\nimport streamlit as st\nfrom filterframes import from_dta_select_filter, to_dta_select_filter\n\nuploaded_filter_file = st.file_uploader(\"Choose a DTASelect-filter.txt file\", type=\"txt\")\n\nif uploaded_filter_file:\n    header_lines, peptide_df, protein_df, end_lines = from_dta_select_filter(StringIO(uploaded_filter_file.getvalue().decode('utf-8')))\n    \n    st.header('Peptide df')\n    st.dataframe(peptide_df)\n    st.header('Protein df')\n    st.dataframe(protein_df)\n\n    # Modify peptide or protein dataframes as needed (e.g., filtering, normalization, etc.)\n    # ...\n\n    io = to_dta_select_filter(header_lines, peptide_df, protein_df, end_lines)\n\n    st.download_button(label=\"Download Filter\",\n                       data=io.getvalue(),\n                       file_name=\"DTASelect-filter.txt\",\n                       mime=\"text/plain\")\n```\n\n## Functions\nThe main functions provided by the package are:\n\n\n```\nfrom_dta_select_filter(file_input: Union[str, TextIOWrapper, StringIO]) -> Tuple[List[str], pd.DataFrame, pd.DataFrame, List[str]]\n```\n\nReads a DTASelect-filter.txt file and returns header lines, peptide dataframe, protein dataframe, and end lines.\n\n\n```\nto_dta_select_filter(header_lines: List[str], peptide_df: pd.DataFrame, protein_df: pd.DataFrame, end_lines: List[str]) -> StringIO\n```\n\nWrites the given header lines, peptide dataframe, protein dataframe, and end lines to a StringIO object in the DTASelect-filter.txt format.\n\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 DTASelect-Filter.txt parser.",
    "version": "0.1.3",
    "project_urls": {
        "repository": "https://github.com/pgarrett-scripps/FilterFrames.git"
    },
    "split_keywords": [
        "ip2",
        "paser",
        "parser",
        "streamlit",
        "dtaselect-filter",
        "peptide",
        "protein",
        "proteomics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5b2161cdabca8e443e2f6e4f6200febeb52f4bc4111e288f1e7939ae9e7d5889",
                "md5": "2fa1a4ffd3d26c5c13b008e735e482e6",
                "sha256": "269c151eef2d7af0a8d78033ee1955736e067bd03be75f03302090d365e6615e"
            },
            "downloads": -1,
            "filename": "filterframes-0.1.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2fa1a4ffd3d26c5c13b008e735e482e6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7208,
            "upload_time": "2023-06-14T21:29:25",
            "upload_time_iso_8601": "2023-06-14T21:29:25.316430Z",
            "url": "https://files.pythonhosted.org/packages/5b/21/61cdabca8e443e2f6e4f6200febeb52f4bc4111e288f1e7939ae9e7d5889/filterframes-0.1.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c0f081f03a4324fd8ba138280ce70496d273b84bad97b5351684b0195a5443d3",
                "md5": "a843a07dce3490a5af3bb249ae5d4e00",
                "sha256": "b67ebd300a58a84aad667d8bf3a5a5b9bfbe221e835d285cb8fc6b9e77798821"
            },
            "downloads": -1,
            "filename": "filterframes-0.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "a843a07dce3490a5af3bb249ae5d4e00",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 8508,
            "upload_time": "2023-06-14T21:29:26",
            "upload_time_iso_8601": "2023-06-14T21:29:26.794599Z",
            "url": "https://files.pythonhosted.org/packages/c0/f0/81f03a4324fd8ba138280ce70496d273b84bad97b5351684b0195a5443d3/filterframes-0.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-14 21:29:26",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pgarrett-scripps",
    "github_project": "FilterFrames",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "filterframes"
}
        
Elapsed time: 0.07831s