averageSpectra,purityD-method {msPurity} | R Documentation

## Using purityD object, calculates to average mz, intensity and signal-to-noise of multiple scans from multiple MS datafiles (mzML or .csv)

### Description

Uses a purityD object with references to multiple MS files. For each file: Averages multiple scans together, see averageSpectraSingle for more information

### Usage

    ## S4 method for signature 'purityD'
    averageSpectra(
      Object,
      rtscn = "all",
      scanRange = NA,
      timeRange = NA,
      clustType = "hc",
      ppm = 1.5,
      snthr = 3,
      av = "median",
      missingV = "zero",
      minfrac = 0.6667,
      normTIC = FALSE,
      snMeth = "median"
    )

### Arguments

`Object` | object; purityD object
`rtscn` | character; Whether it is scans or retention time to be filtered. Use "all" if all scans to be used. ['rt', 'scns', 'all']
`scanRange` | vector; Scan range (if rtscn='scns') e.g. c(40, 69)
`timeRange` | vector; Time range (if rtscn='rt) e.g. c(10.3, 400.8) (only if using mzML file)
`clustType` | character; Type of clustering used either Hierarchical or just simple 1D grouping ['hc', 'simple']
`ppm` | numeric; The ppm error to cluster mz together
`snthr` | numeric; Signal to noise ratio threshold
`av` | character; What type of averaging to do between peaks
`missingV` | character; What to do with missing values (zero or ignore)
`minfrac` | numeric; Min fraction of scans with a grouped peak to be an accepted averaged peak
`normTIC` | boolean; If TRUE then RSD calculation will use the normalised intensity (intensity divided by TIC) if FALSE will use standard intensity
`snMeth` | character; Type of snMethod to use ['mean', 'median', 'precalc']. Precalc only applicable when using the csvFile parameter as TRUE

### Value

purityD object with averaged spectra

### See Also

`averageSpectraSingle`

### Examples

    datapth <- system.file("extdata", "dims", "mzML", package="msPurityData")
    inDF <- Getfiles(datapth, pattern=".mzML", check = FALSE, cStrt = FALSE)
    ppDIMS <- purityD(fileList=inDF, cores=1, mzML=TRUE)
    ppDIMS <- averageSpectra(ppDIMS)

[Package msPurity version 1.14.1 Index]