massdash.loaders.SpectralLibraryLoader
- class massdash.loaders.SpectralLibraryLoader(in_file: str, verbose: bool = False)
Bases:
objectClass for loading spectral library files.
- in_file
The path to the spectral library file.
- Type:
str
- data
The spectral library data.
- Type:
pd.DataFrame
- filter_for_target_transition_list(protein: str, peptide: str, charge: int) DataFrame
Filters the data for a specific target transition list based on the given protein, peptide, and charge.
- Parameters:
protein (str) – The protein ID.
peptide (str) – The modified peptide sequence.
charge (int) – The precursor charge.
- Returns:
The filtered data containing the target transition list.
- Return type:
pd.DataFrame
- get_fragment_library_intensity(peptide: str, charge: int, annotation: str) float
Retrieves a list of fragment annotations for a given peptide and charge.
- Parameters:
peptide (str) – The peptide sequence.
charge (int) – The precursor charge.
annotation (str) – The fragment annotation.
- Returns:
The library intensity for the specified fragment annotation.
- Return type:
float
- get_peptide_fragment_annotation_list(peptide: str, charge: int) List[str]
Retrieves a list of fragment annotations for a given peptide and charge.
- Parameters:
peptide (str) – The peptide sequence.
charge (int) – The precursor charge.
- Returns:
A list of fragment annotations.
- Return type:
List[str]
- get_peptide_ion_mobility(peptide: str, charge: int) float
Retrieves the ion mobility of a peptide with a specific charge from the spectral library.
Parameters: peptide (str): The modified peptide sequence. charge (int): The precursor charge.
Returns: float: The precursor ion mobility.
- get_peptide_library_intensity(peptide: str, charge: int) float
Get the library intensity for a specific peptide and charge.
- Parameters:
peptide (str) – The modified peptide sequence.
charge (int) – The precursor charge.
- Returns:
The library intensity for the specified peptide and charge.
- Return type:
float
- get_peptide_precursor_mz(peptide: str, charge: int) float
Get the precursor m/z value for a given peptide and charge.
Parameters: peptide (str): The modified peptide sequence. charge (int): The precursor charge.
Returns: float: The precursor m/z value.
- get_peptide_product_charge_list(peptide: str, charge: int) List[int]
Retrieve a list of product charges for a given peptide and charge.
- Parameters:
peptide (str) – The modified peptide sequence.
charge (int) – The precursor charge.
- Returns:
A list of product charges.
- Return type:
List[int]
- get_peptide_product_mz_list(peptide: str, charge: int) List[float]
Retrieve a list of product m/z values for a given peptide and charge.
- Parameters:
peptide (str) – The modified peptide sequence.
charge (int) – The precursor charge.
- Returns:
A list of product m/z values.
- Return type:
List[float]
- get_peptide_retention_time(peptide: str, charge: int) float
Get the retention time for a given peptide and charge.
Parameters: peptide (str): The modified peptide sequence. charge (int): The precursor charge.
Returns: float: The normalized retention time.
- get_unique_charge_states_per_peptide(peptide: str) List[int]
Returns a list of unique charge states for a given peptide.
- Parameters:
peptide (str) – The peptide sequence.
- Returns:
A list of unique charge states associated with the peptide.
- Return type:
List[int]
- get_unique_peptides_per_protein(protein: str) List[str]
Returns a list of unique peptide sequences for a given protein.
- Parameters:
protein (str) – The protein ID.
- Returns:
A list of unique peptide sequences.
- Return type:
List[str]
- get_unique_proteins() List[str]
Returns a list of unique protein IDs from the data.
- Returns:
A list of unique protein IDs.
- Return type:
List[str]
- load() DataFrame
Load the transition list file
- populateTransitionGroupFeature(transition_group_feature: TransitionGroupFeature) TransitionGroupFeature
Appends library information to a TransitionGroupFeature object
- Parameters:
transition_group_feature (TransitionGroupFeature) – The TransitionGroupFeature object to append library information to.
- Returns:
The TransitionGroupFeature object with appended library information.
- Return type:
- populateTransitionGroupFeatures(transition_group_features: List[TransitionGroupFeature]) List[TransitionGroupFeature]
Populates library information for a list of TransitionGroupFeature objects. *Important:* Assumes that all TransitionGroupFeature objects have the same peptide sequence and precursor charge.
- save(file_path: str) None
Save the data to a file.
- Parameters:
file_path (str) – The path to the file where the data will be saved.
- Returns:
None