massdash.loaders.ResultsLoader

class massdash.loaders.ResultsLoader(rsltsFile: str | List[str], verbose: bool = False, mode: Literal['module', 'gui'] = 'module')

Bases: object

Class for loading Results files. Base class for GenericRawDataLoader Abstract class for loading raw chromatogram data

rsltsFile

(str) The path to the report file (DIANN-TSV or OSW)

dataFiles

(str/List[str]) The path to the mzML file(s)

verbose

(bool) Whether to print debug messages

mode

(str) Whether to run in module or GUI mode

computeCV(**kwargs) DataFrame

Compute the CV (coefficient of variation) of the identified precursors

Parameters:

**kwargs – Additional arguments to be passed to the getPrecursorCVs() function

Returns:

DataFrame containing the CV of the identified precursors, columns are the software tool, index are the precursor and the values are the CV

Return type:

DataFrame

getOSWAccessPtr()

Get the OSWDataAccess object

Raises:

Exception – Multiple OSW files found

loadExperimentSummary() DataFrame

load a pandas dataframe summary of the experiment for all result files

loadIdentifiedPeptides(**kwargs)

Load the peptide identifications

Parameters:

**kwargs – Additional arguments to be passed to the getIdentifiedPeptides() function

loadIdentifiedPrecursors(**kwargs)

Load the precursor identifications

Parameters:

**kwargs – Additional arguments to be passed to the getIdentifiedPrecursors() function

loadIdentifiedProteins(**kwargs)

Load the protein identifications

Parameters:

**kwargs – Additional arguments to be passed to the getIdentifiedProteins() function

loadNumIdentifiedPeptides(**kwargs)

Load the number of peptide identifications

Parameters:

**kwargs – Additional arguments to be passed to the getIdentifiedPeptides() function

loadNumIdentifiedPrecursors(**kwargs)

Load the precursor identifications

Parameters:

**kwargs – Additional arguments to be passed to the getNumIdentifiedPrecursors() function

loadNumIdentifiedProteins(**kwargs)

Load the number of protein identifications

Parameters:

**kwargs – Additional arguments to be passed to the getIdentifiedProteins() function

loadQuantificationMatrix(**kwargs) DataFrame

load a quantification matrix

Parameters:

**kwargs – Additional arguments to be passed to the getIdentifiedPrecursorIntensities() function

Returns:

DataFrame containing the quantification matrix, columns are the software tool, index are the precursor and the values are the intensities

Return type:

DataFrame

loadScoreDistribution(**kwargs)

Loads score distribution for a given file

Parameters:

**kwargs – kwargs to pass to the getScoreDistribution function(), score_table and score must be specified

Returns:

DataFrame with columns: Decoy, Score, Run

Return type:

pd.DataFrame

loadTopTransitionGroupFeature(pep_id: str, charge: int) TransitionGroupFeatureCollection

Loads a PeakFeature object from the results file

Parameters:
  • pep_id (str) – Peptide Sequence

  • charge (int) – Peptide Charge

Returns:

object containing a list of collection of TransitionGroupFeatures (e.g. peak boundaries, intensity and confidence)

Return type:

TransitionGroupFeatureCollection

loadTopTransitionGroupFeatureDf(pep_id: str, charge: int) DataFrame

Loads a pandas dataframe of TransitionGroupFeatures across all runs

Parameters:
  • pep_id (str) – Peptide Sequence

  • charge (int) – peptide Charge

Returns:

DataFrame containing TransitionGroupObject information across all runs

Return type:

DataFrame

loadTransitionGroupFeatures(pep_id: str, charge: int, runNames: str | List[str] | None = None) TransitionGroupFeatureCollection

Load TransitionGroupFeature objects from the results file for the given peptide precursor

Parameters:
  • pep_id (str) – Peptide Sequence

  • charge (int) – Charge of the peptide precursor to fetch

  • runNames (str | List[str] | None) – Name of the run to extract the TransitionGroupFeature from. If None, all runs are extracted. If str, only the specified run is extracted. If List[str], only the specified runs are extracted.

Returns:

TransitionGroupFeatureCollection object containing peak boundaries, intensity and confidence for the specified peptide precursor

Return type:

TransitionGroupFeatureCollection

loadTransitionGroupFeaturesDf(pep_id: str, charge: int, runNames: str | None | List[str] = None) DataFrame

Loads a TransitionGroupFeature object from the results file to a pandas dataframe

Parameters:
  • pep_id (str) – Peptide ID

  • charge (int) – Charge

  • runNames (None | str | List[str]) – Name of the run to extract the transition group from. If None, all runs are extracted. If str, only the specified run is extracted. If List[str], only the specified runs are extracted.

Returns:

DataFrame containing TransitionGroupObject information across all runs

Return type:

DataFrame

loadValidScores()

Loads the valid score distributions for the given file

Returns:

Dictionary with keys as the score table and values as the valid scores

Return type:

Dict

plotCV(**kwargs) None

Plot the CV

Parameters:

**kwargs – Additional arguments to be passed to the getPrecursorCVs() function

plotIdentifications(aggregate, level: Literal['precursor', 'peptide', 'protein'], height=450, width=600, **kwargs) None

Plot the identifications

Parameters:
  • aggregate – (str) The level of aggregation for the plot, can be ‘precursor’, ‘peptide’ or ‘protein’

  • level – (str) The level of identifications to plot, can be ‘precursor’, ‘peptide’ or ‘protein’

  • height – (int) The height of the plot

  • width – (int) The width of the plot

  • **kwargs – Additional arguments to be passed to the getIdentification function for this level (e.g. getNumIdentifiedPrecursors())

plotQuantifications(**kwargs) None

Plot the quantifications

Parameters:

**kwargs – Additional arguments to be passed to loadQuantificationMatrix() function

plotUpset(level=typing.Literal['precursor', 'peptide', 'protein'], **kwargs)

Create an UpSet plot showing the intersection of ModifiedPeptideSequence’s between entries (with unique ModifiedPeptideSequence across runNames)

Parameters:
  • level – (str) The level of identifications to plot, can be ‘precursor’, ‘peptide’ or ‘protein’

  • **kwargs – Additional arguments to be passed to the underlying getIdentified function (e.g. getIdentifiedPrecursors() for precursor level)