SCMzml: R6 Class For mzML Data

SCMzmlR Documentation

R6 Class For mzML Data

Description

mzML mass spectrometry data container with some useful methods.

Details

Provides our own container for mzML data, and does conversion to frequency, filtering scans, choosing a single frequency regression model, and generating the frequency data for use in the peak characterization.

Public fields

mzml_file

the mzml file location

mzml_metadata

metadata from an external json file

mzml_data

the actual mzml data from MSnbase

mzml_df_data

a list of data.frames of the data

scan_range

the range of scans to be used

rtime_range

the range of retention times to keep

mz_range

the mz range to use

scan_info

data.frame of scan information

remove_zero

should zero intensity data points be removed?

frequency_fit_description

the model for m/z -> frequency

mz_fit_description

the model for going from frequency -> m/z

frequency_coefficients

the coefficients for the frequency model

mz_coefficients

the coefficients for the m/z model

ms_level

which MS level will we be using from the mzml file?

memory_mode

how will the mzml data be worked with to start, inMemory or onDisk?

difference_range

how wide to consider adjacent frequency points as good

choose_frequency_model_function

where the added model selection function will live

filter_scan_function

where the added filter scan function will live.

choose_single_frequency_model

function to choose a single frequency model

Methods

Public methods


Method import_mzml()

import the mzml file defined

Usage
SCMzml$import_mzml(
  mzml_file = self$mzml_file,
  ms_level = self$ms_level,
  memory_mode = self$memory_mode
)
Arguments
mzml_file

what file are we reading in?

ms_level

which ms level to import (default is 1)

memory_mode

use inMemory or onDisk mode


Method extract_mzml_data()

get the mzml data into data.frame form so we can use it

Usage
SCMzml$extract_mzml_data(remove_zero = self$remove_zero)
Arguments
remove_zero

whether to remove zero intensity points or not


Method predict_frequency()

predict frequency and generate some summary information. This does regression of frequency ~ m/z for each scan separately.

Usage
SCMzml$predict_frequency(
  frequency_fit_description = self$frequency_fit_description,
  mz_fit_description = self$mz_fit_description
)
Arguments
frequency_fit_description

the regression model definition

mz_fit_description

the regression model definition


Method convert_to_frequency()

actually do the conversion of m/z to frequency

Usage
SCMzml$convert_to_frequency()

Method choose_frequency_model()

choose a frequency model using the previously added function

Usage
SCMzml$choose_frequency_model()

Method generate_choose_frequency_model_function()

generate a frequency model choosing function and attach it

Usage
SCMzml$generate_choose_frequency_model_function(f_function = NULL)
Arguments
f_function

the function you want to pass in

Details

Creates a new function that access the scan_info slot of an SCMzml object after conversion to frequency space, and chooses a single model based on the information there.


Method filter_scans()

filter the scans using the previously added function

Usage
SCMzml$filter_scans()

Method generate_filter_scan_function()

generate a filter function and attach it

Usage
SCMzml$generate_filter_scan_function(
  rtime = NA,
  y.freq = NA,
  f_function = NULL
)
Arguments
rtime

retention time limits of scans to keep (NA)

y.freq

y-frequency coefficient limits of scans to keep (NA)

f_function

a full function to set as the filtering function

Details

Creates a new function that accesses the scan_info slot of an SCMzml object, filters the scans by their retention-time and y-frequency coefficients, tests for outliers in the y-frequency coefficients, and denotes which scans will be kept for further processing.

NA means no filtering will be done, one-sided limits, eg. ⁠(NA, 10)⁠ or ⁠(10, NA)⁠ implies to filter <= or >=, respectively.


Method check_frequency_model()

check how well a given frequency model works for this data

Usage
SCMzml$check_frequency_model(scan = NULL, as_list = FALSE)
Arguments
scan

which scan to show predictions for

as_list

whether plots should be returned as a single plot or a list of plots


Method get_instrument()

get instrument data from associated mzml file metadata

Usage
SCMzml$get_instrument()

Method get_frequency_data()

get the frequency data to go into the next steps of analysis.

Usage
SCMzml$get_frequency_data()

Method new()

Usage
SCMzml$new(
  mzml_file,
  frequency_fit_description = c(a.freq = 0, x.freq = -1, y.freq = -1/2, z.freq = -1/3),
  mz_fit_description = c(a.mz = 0, x.mz = -1, y.mz = -2, z.mz = -3),
  metadata_file = NULL,
  scan_range = NULL,
  rtime_range = NULL,
  mz_range = NULL,
  remove_zero = FALSE,
  ms_level = 1,
  memory_mode = "inMemory"
)
Arguments
mzml_file

the file to load and use

frequency_fit_description

a description of the regression model for frequency ~ m/z

mz_fit_description

a description of the regression model for m/z ~ frequency

metadata_file

a metadata file generated by ...

scan_range

which scans can be used for analysis

rtime_range

the retention time to use for scans

mz_range

what m/z range to use

remove_zero

should zero intensity data be removed?

ms_level

what MS level should be extracted (default is 1)

memory_mode

what memory mode should MSnbase be using (inMemory or onDisk)


Method clone()

The objects of this class are cloneable with this method.

Usage
SCMzml$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

See Also

choose_single_frequency_model_default()

Examples

## Not run: 
  lipid_sample = system.file("extdata", "lipid_example.mzML",
  package = "ScanCentricPeakCharacterization")

## End(Not run)

MoseleyBioinformaticsLab/ScanCentricPeakCharacterization documentation built on March 29, 2024, 11:32 p.m.