oktoberfest.pp.filter_peptides

oktoberfest.pp.filter_peptides(peptides, min_length, max_length, max_charge)

Filter search results using given constraints.

This function filters provided search results by peptide length, precursor charge, unsupported special aminoacids, and unsupported modifications.

Parameters:
  • peptides (Union[DataFrame, AnnData]) – Dataframe containing search results to be filtered

  • min_length (int) – The minimal length of a peptide to be retained

  • max_length (int) – The maximal length of a peptide to be retained

  • max_charge (int) – The maximal precursor charge of a peptide to be retained

Return type:

Union[DataFrame, AnnData]

Returns:

The filtered dataframe or AnnData object given the provided constraints.

Example:

>>> from oktoberfest import preprocessing as pp
>>> import pandas as pd
>>> search_results = pd.DataFrame({"MODIFIED_SEQUENCE": ["AAAC[UNIMOD:4]RFVQ","RM[UNIMOD:35]PC[UNIMOD:4]HKPYL","TAIASPEK"],
>>>                     "SEQUENCE": ["AAACRFVQ","RMPCHKPYL","TAIASPEK"],
>>>                     "PEPTIDE_LENGTH": [8,9,8],
>>>                     "PRECURSOR_CHARGE": [1,2,7]})
>>> filtered_peptides = pp.filter_peptides(peptides=search_results, min_length=7, max_length=30, max_charge=6)
>>> print(filtered_peptides)