Skip to main content

example workflow example workflow

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:

pip install filterframes

You can also install filterframes locally:

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:

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:

# 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.

Metadata

Release files for filterframes 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for filterframes 0.2.0
File Size Uploaded Provenance Actions
filterframes-0.2.0.tar.gz 89.8 kB Without provenance Details for filterframes-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for filterframes 0.2.0
File Interpreter ABI Platform Actions
filterframes-0.2.0-py3-none-any.whl Python 3 none any Details for filterframes-0.2.0-py3-none-any.whl

Total release size: 97.6 kB

Release files / filterframes-0.2.0.tar.gz

Download URL filterframes-0.2.0.tar.gz
Size 89.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2ae95b63d851863f9b2679e65a08a8b8fa35b8b33b16dd2906c188e377d79a01
BLAKE2b-256 checksum
How to use checksums
478a6106b188080185584bc2d7dc48646943c178bc8f8de7154d02cc854a7b1a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / filterframes-0.2.0-py3-none-any.whl

Download URL filterframes-0.2.0-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74b079f03690d3f7b2e76a38899b0f1d70fb800ec7570aba81f376c0fd284933
BLAKE2b-256 checksum
How to use checksums
9f409da5c94ccf6ee5132ccd20aaa7110832d6fbb1dccde3d16c5c2f80daf6c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for filterframes 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page