proteobench.io.params.spectronaut module#

Spectronaut parameter parsing.

proteobench.io.params.spectronaut.clean_text(text: str) str[source]#

Clean the input text by removing leading and trailing spaces, colons, commas, or tabs.

Parameters:

text (str) – The text to be cleaned.

Returns:

The cleaned text.

Return type:

str

proteobench.io.params.spectronaut.extract_calibration_method(line: str) str | None[source]#

Extract the calibration method from the ‘Main Search’ line.

proteobench.io.params.spectronaut.extract_mass_tolerance(lines: List[str], system='Thermo Orbitrap') str | None[source]#

Extract mass tolerances from the ‘Main Search’ section based on the system and calibration method.

proteobench.io.params.spectronaut.extract_tolerances(line: str, calibration_method: str, MS1_tol: str | None, MS2_tol: str | None) tuple[source]#

Extract MS1 and MS2 tolerances based on the calibration method, without overwriting existing values.

proteobench.io.params.spectronaut.extract_tolerances_with_regex(line: str, MS1_tol: str | None, MS2_tol: str | None, ms1_tolerance_regex: Pattern, ms2_tolerance_regex: Pattern) Tuple[str | None, str | None][source]#

Extract MS1 and MS2 tolerances from the line using the provided regular expressions, without overwriting existing values.

Parameters:
  • line – The line from which tolerances should be extracted.

  • MS1_tol – Existing MS1 tolerance (retained if already set).

  • MS2_tol – Existing MS2 tolerance (retained if already set).

  • ms1_tolerance_regex – Regex pattern for MS1 tolerance.

  • ms2_tolerance_regex – Regex pattern for MS2 tolerance.

Returns:

A tuple (MS1_tol, MS2_tol) with updated or retained values.

proteobench.io.params.spectronaut.extract_value(lines: List[str], search_term: str) str | None[source]#

Extract the value associated with a search term from a list of lines.

Parameters:
  • lines (List[str]) – The list of lines to search through.

  • search_term (str) – The term to search for in the lines.

Returns:

The extracted value, or None if the search term is not found.

Return type:

Optional[str]

proteobench.io.params.spectronaut.extract_value_regex(lines: List[str], search_term: str) str | None[source]#

Extract the value associated with a search term using regular expressions.

Parameters:
  • lines (List[str]) – The list of lines to search through.

  • search_term (str) – The regular expression to search for in the lines.

Returns:

The extracted value, or None if the search term is not found.

Return type:

Optional[str]

proteobench.io.params.spectronaut.read_spectronaut_settings(file_path: str, system='Thermo Orbitrap', json_file='/home/docs/checkouts/readthedocs.org/user_builds/proteobench/envs/v0.13.2/lib/python3.11/site-packages/proteobench/io/params/json/Quant/quant_lfq_DIA_ion.json') ProteoBenchParameters[source]#

Read a Spectronaut settings file, extract parameters, and return them as a ProteoBenchParameters object.

Parameters:

file_path (str) – The path to the Spectronaut settings file.

Returns:

The extracted parameters encapsulated in a ProteoBenchParameters object.

Return type:

ProteoBenchParameters