proteobench.io.params.alphadia module#

AlphaDIA parameter parsing.

proteobench.io.params.alphadia.clean_line(line: str) str[source]#

Clean up a line by removing ANSI escape codes and trimming whitespace, as well as removing timestamps.

proteobench.io.params.alphadia.clean_up_parameters(all_parameters: Dict[str, str]) None[source]#

Clean up parameters by removing redundant keys and processing values.

proteobench.io.params.alphadia.detect_newer_version(lines: List[str]) bool[source]#

Detect if the log file is from a newer version (>= 1.10) of AlphaDIA based on the presence of ‘user defined’ in the lines.

Parameters:

lines (List[str]) – List of log lines.

Returns:

True if the log file is from a newer version, False otherwise.

Return type:

bool

proteobench.io.params.alphadia.extract_params(file_path: str, json_file='/home/docs/checkouts/readthedocs.org/user_builds/proteobench/envs/v0.9.4/lib/python3.11/site-packages/proteobench/io/params/json/Quant/quant_lfq_DIA_ion.json') Dict[str, str][source]#

Extract parameters from the log file and return them as a dictionary.

Parameters:

file_path (str) – The path to the log file.

Returns:

A dictionary containing the extracted parameters.

Return type:

Dict[str, str]

proteobench.io.params.alphadia.extract_values_from_nested_lines(lines: List[str], start_index: int, debug: bool = False) List[int][source]#

Extract values from lines that are indented, following the format for parameters like precursor_len.

Parameters:
  • lines (List[str]) – List of log lines.

  • start_index (int) – Index of the line where the key (e.g., precursor_len) is found.

Returns:

A list of integers representing the values extracted from the nested lines.

Return type:

List[int]

proteobench.io.params.alphadia.initialize_default_parameters() Dict[str, str][source]#

Initialize default parameters.

proteobench.io.params.alphadia.map_keys_to_desired_format(all_parameters: Dict[str, str]) None[source]#

Map keys to the desired format.

proteobench.io.params.alphadia.parse_key_value(line: str) Tuple[str, str][source]#

Parse a key-value pair from a line in the log. It assumes the format ‘key: value’.

Parameters:

line (str) – The line to parse.

Returns:

The parsed key and value.

Return type:

Tuple[str, str]

proteobench.io.params.alphadia.process_fragment_mz(lines: List[str], index: int, all_parameters: Dict[str, str]) None[source]#

Process fragment m/z parameters.

proteobench.io.params.alphadia.process_key_value_line(cleaned_line: str, all_parameters: Dict[str, str], version_filled: bool) bool[source]#

Process a line containing a key-value pair.

proteobench.io.params.alphadia.process_precursor_charge(lines: List[str], index: int, all_parameters: Dict[str, str]) None[source]#

Process precursor charge parameters.

proteobench.io.params.alphadia.process_precursor_len(lines: List[str], index: int, all_parameters: Dict[str, str]) None[source]#

Process precursor length parameters.

proteobench.io.params.alphadia.process_precursor_mz(lines: List[str], index: int, all_parameters: Dict[str, str]) None[source]#

Process precursor m/z parameters.

proteobench.io.params.alphadia.read_file_lines(file_path: str) List[str][source]#

Read lines from a file.