proteobench.io.params.maxquant module#

Functionality to parse Maxqunt mqpar.xml parameter files.

proteobench.io.params.maxquant.add_record(data: dict, tag: str, record) dict[source]#

Add tag and record to data dict.

Parameters:
  • data (dict) – The data dictionary to add the record to.

  • tag (str) – The tag for the record.

  • record (any) – The record to add.

Returns:

The updated data dictionary.

Return type:

dict

proteobench.io.params.maxquant.build_Series_from_records(records, index_length=4)[source]#

Build a pandas Series from records.

Parameters:
  • records (dict) – The records to build the Series from.

  • index_length (int, optional) – The length of the index, by default 4.

Returns:

The pandas Series built from the records.

Return type:

pandas.Series

proteobench.io.params.maxquant.extend_tuple(t, target_length: int)[source]#

Extend tuple with None values to match target length.

Parameters:
  • t (tuple) – The tuple to extend.

  • target_length (int) – The target length of the tuple.

Returns:

The extended tuple.

Return type:

tuple

Raises:
  • TypeError – If the input is not a tuple.

  • ValueError – If the tuple is longer than the target length.

proteobench.io.params.maxquant.extend_tuples_with_none(list_of_tuples: list[tuple], target_length: int)[source]#

Extend the tuples in a list of tuples with None values to match target length.

Parameters:
  • list_of_tuples (list of tuple) – The list of tuples to extend.

  • target_length (int) – The target length of the tuples.

Returns:

The list of extended tuples.

Return type:

list of tuple

proteobench.io.params.maxquant.extract_params(fname, ms2frac='FTMS', json_file='/home/docs/checkouts/readthedocs.org/user_builds/proteobench/envs/v0.11.0/lib/python3.11/site-packages/proteobench/io/params/json/Quant/quant_lfq_DDA_ion.json') ProteoBenchParameters[source]#

Extract parameters from a MaxQuant XML file.

Parameters:
  • fname (str) – The path to the XML file.

  • ms2frac (str, optional) – The MS2 fragmentation method, by default “FTMS”.

Returns:

The extracted parameters.

Return type:

ProteoBenchParameters

proteobench.io.params.maxquant.flatten_dict_of_dicts(d: dict, parent_key: str = '') dict[source]#

Build tuples for nested dictionaries for use as pandas.MultiIndex.

Parameters:
  • d (dict) – Nested dictionary for which all keys are flattened to tuples.

  • parent_key (str, optional) – Outer key (used for recursion), by default ‘’.

Returns:

Flattened dictionary with tuple keys: {(outer_key, …, inner_key) : value}.

Return type:

dict

proteobench.io.params.maxquant.read_file(file: str) dict[source]#

Read all entries in a MaxQuant xml file.

Parameters:

file (str) – The path to the XML file.

Returns:

The parsed XML data as a dictionary.

Return type:

dict

proteobench.io.params.maxquant.read_xml_record(element: Element) dict[source]#

Read entire record in a nested dict structure.

Parameters:

element (xml.etree.ElementTree.Element) – The XML element to read.

Returns:

The nested dictionary structure of the XML element.

Return type:

dict