EdgeDetail module

EdgeDetail([number_of_modifications, ...])

Class for Edge Details

Match(first_peak_mz, second_peak_mz, match_type)

Class for Match

MatchType(value)

An enumeration.

EdgeDetail

class modifinder.classes.EdgeDetail.EdgeDetail(number_of_modifications: int = -1, match_score: float = 0, matches: List[Match] | None = None, start_spectrum_id: str | None = None, end_spectrum_id: str | None = None, start_compound_id: str | None = None, end_compound_id: str | None = None)[source]

Bases: object

Class for Edge Details

Parameters:
  • number_of_modifications (int) – Number of modifications, -1 for unknown

  • match_score (float) – Match score, how well the two spectra match

  • matches (List[Match]) – List of matches, each match is a tuple of two peak m/z values and the match type. It is important to note that match has directionality. The first peak m/z is from the first node of the edge and the second peak m/z is from the second node of the edge.

__init__(number_of_modifications: int = -1, match_score: float = 0, matches: List[Match] | None = None, start_spectrum_id: str | None = None, end_spectrum_id: str | None = None, start_compound_id: str | None = None, end_compound_id: str | None = None)[source]

Initialize the EdgeDetail object.

Parameters:
  • number_of_modifications (int) – Number of modifications, -1 for unknown

  • match_score (float) – Match score, how well the two spectra match

  • matches (List[Match]) – List of matches, each match is a tuple of two peak m/z values and the match type. It is important to note that match has directionality. The first peak m/z is from the first node of the edge and the second peak m/z is from the second node of the edge.

copy()[source]

Create a copy of the EdgeDetail object

Returns:

A copy of the EdgeDetail object

Return type:

EdgeDetail

get_matches_pairs() List[Tuple[int, int]][source]

Get the matches as a list of tuples

Returns:

List of tuples of peak m/z values

Return type:

List[Tuple[int, int]]

get_meta_data()[source]

Get the metadata of the EdgeDetail

get_single_type_matches(match_type: MatchType) List[Tuple[int, int]][source]

Get the matches of a specific type

Parameters:

match_type (MatchType) – Type of the match

Returns:

List of tuples of peak m/z values [(first_peak_mz, second_peak_mz), …] of the specified match type

Return type:

List[Tuple[int, int]]

reverse_edge()[source]

Reverse an edge details in the network.

This is useful when the reversed matches are needed from the edge in the network. first_peak_mz and second_peak_mz are swapped in the matches, and start and end spectrum and compound ids are also swapped.

Match

class modifinder.classes.EdgeDetail.Match(first_peak_mz: int, second_peak_mz: int, match_type: MatchType)[source]

Bases: object

Class for Match

first_peak_mz

mz of the peak in the first spectrum

Type:

int

second_peak_mz

mz of the peak in the second spectrum

Type:

int

match_type

Type of the match

Type:

MatchType

__init__(first_peak_mz: int, second_peak_mz: int, match_type: MatchType)[source]

Initialize the Match object.

Parameters:
  • first_peak_mz (int) – m/z of the first peak

  • second_peak_mz (int) – m/z of the second peak

  • match_type (MatchType) – Type of the match

Notes

if you need matches with more information, create a new class and inherit from this class.

copy()[source]

Create a copy of the Match object

MatchType

class modifinder.classes.EdgeDetail.MatchType(value)[source]

Bases: Enum

An enumeration.

shifted = 1
unshifted = 2