oktoberfest.pp.gen_lib

oktoberfest.pp.gen_lib(input_file)

Generate a spectral library from a given input.

This function reads an input file that follows the specifications provided in the usage section for Custom in-silico digestion, creates a Spectra object from it and returns it.

Parameters:

input_file (Union[str, Path]) – A csv file containing modified sequences, CE, precursor charge and fragmentation method.

Return type:

Spectra

Returns:

Spectra object from the read input.

Example:

>>> from oktoberfest import preprocessing as pp
>>> import pandas as pd
>>> peptides_df = pd.DataFrame({'modified_sequence': ['KIIDRAITSL', 'KIEKLKVEL', 'KINQQKLKL', 'TYDDATKTFTVTE', 'ASPTQPIQL'],
>>>                             'collision_energy': [34, 35, 34, 34, 35],
>>>                             'precursor_charge': [2, 2, 3, 2, 1]})
>>> peptides_df.to_csv("./tests/doctests/input/peptides.csv", sep='\t',index=False)
>>> library = pp.gen_lib("./tests/doctests/input/peptides.csv")
>>> print(library)