A very simple DTASelect-Filter.txt parser.
Project description
pandas-dta-select-parser
pandas_dta_select_parser
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. Additional utility functions are provided for common tasks, such as filtering, normalization, and peptide coverage calculation.
Installation
You can install pandas_dta_select_parser
using pip:
pip install pandas-dta-select-parser
Usage
Here's a basic example of how to use the package:
from filterframes import from_dta_select_filter, to_dta_select_filter
# Read DTASelect-filter.txt file and create peptide and protein dataframes
file_input = "path/to/DTASelect-filter.txt"
header_lines, peptide_df, protein_df, end_lines = from_dta_select_filter(file_input)
# 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 = "path/to/output/DTASelect-filter_modified.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())
More advance use cases can be found in examples.py
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for filterframes-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36249b28e5a6cc5a3aafde553a215296590e4f12c160d7271f7dae97ef5b8f3a |
|
MD5 | 265027196d94df53f21f3cfaddcc4859 |
|
BLAKE2b-256 | fae4c5e9fce0ba0cbc27fa2d5b3b2541311a0936ad74587e931884f35674039d |