Exporting Crosslink-Spectrum-Matches and Crosslinks to MS Annika Format
from pyXLMS import __version__
print(f"Installed pyXLMS version: {__version__}") Installed pyXLMS version: 1.5.3from pyXLMS import parser
from pyXLMS import exporterAll exporting functionality is available via the exporter submodule. We also import the parser submodule to read crosslink-spectrum-matches and crosslinks.
parser_result = parser.read(
"../../data/ms_annika/XLpeplib_Beveridge_QEx-HFX_DSS_R1.pdResult",
engine="MS Annika",
crosslinker="DSS",
)
csms = parser_result["crosslink-spectrum-matches"]
xls = parser_result["crosslinks"] Reading MS Annika CSMs...: 100%|βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 826/826 [00:00<00:00, 9855.76it/s]
Reading MS Annika crosslinks...: 100%|ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ| 300/300 [00:00<00:00, 14068.39it/s]We read crosslink-spectrum-matches and crosslinks using the generic parserΒ from a single .pdResult file. For easier access we also assign our crosslink-spectrum-matches to the variable csms and our crosslinks to the variable xls.
_df = exporter.to_msannika(xls, filename=None)The function exporter.to_msannika() exports a list of crosslinks or crosslink-spectrum-matches to MS AnnikaΒ format. This might be useful for tools that support MS Annika input but are not supported by pyXLMS (yet). You can read more about the to_msannika() function and all its parameters here: docs.
Specifying filename=None will only return the pandasΒ DataFrame and not write it to disk!
_df = exporter.to_msannika(csms, filename=None)Exporting works for both crosslinks and crosslink-spectrum-matches.
The MS Annika exporter will not check if all necessary information is available for the exported crosslinks or crosslink-spectrum-matches. If a value is not available it will be denoted as a missing value in the dataframe and exported file. Please make sure all necessary information is available before using the exported file with another tool! Please also note that modifications are not exported, for modification down-stream analysis please refer to transform.to_proforma() [docsΒ ] or transform.to_dataframe() [docsΒ ]!