EdgeDetail module

EdgeDetail([number_of_modifications, ...])

Class for Edge Details

Match(first_peak_index, second_peak_index, ...)

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)[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 indices and the match type. It is important to note that match has directionality. The first peak index is from the first node of the edge and the second peak index 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)[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 indices and the match type. It is important to note that match has directionality. The first peak index is from the first node of the edge and the second peak index 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 indices

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 indices [(first_peak_index, second_peak_index)]

Return type:

List[Tuple[int, int]]

reverse_match()[source]

Reverse the matches order in the EdgeDetail object

This is useful when the reversed matches are needed from the edge in the network. first_peak_index and second_peak_index are swapped in the matches.

Match

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

Bases: object

Class for Match

first_peak_index

Index of the peak in the first spectrum

Type:

int

second_peak_index

Index of the peak in the second spectrum

Type:

int

match_type

Type of the match

Type:

MatchType

__init__(first_peak_index: int, second_peak_index: int, match_type: MatchType)[source]

Initialize the Match object.

Parameters:
  • first_peak_index (int) – Index of the first peak

  • second_peak_index (int) – Index 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