TopDownSet-class {topdownr} | R Documentation

## The TopDownSet class

### Description

The TopDownSet class is a container for a whole top-down proteomics experiment.

### Usage

    ## S4 method for signature 'TopDownSet'
    aggregate(x, by = x$Sample, ...)

    ## S4 method for signature 'TopDownSet,TopDownSet'
    combine(x, y)

    ## S4 method for signature 'TopDownSet'
    filterCv(object, threshold, by = object$Sample,
      ...)

    ## S4 method for signature 'TopDownSet'
    filterInjectionTime(object,
      maxDeviation = log2(3), keepTopN = 2, by = object$Sample, ...)

    ## S4 method for signature 'TopDownSet'
    filterIntensity(object, threshold,
      relative = TRUE, ...)

    ## S4 method for signature 'TopDownSet'
    filterNonReplicatedFragments(object, minN = 2,
      by = object$Sample, ...)

    ## S4 method for signature 'TopDownSet'
    normalize(object, method = "TIC", ...)

    ## S4 method for signature 'TopDownSet,missing'
    plot(x, y, ..., verbose = interactive())

    ## S4 method for signature 'TopDownSet'
    show(object)

    ## S4 method for signature 'TopDownSet'
    summary(object, what = c("conditions",
      "fragments"), ...)

### Arguments

`x, object` | `TopDownSet`
`by` | `list`, grouping variable, in general it refers to technical
`y` | `missing`, not used.
`threshold` | `double`, threshold variable.
`maxDeviation` | `double`, maximal allowed deviation in the `log2` injection time in ms in comparison to the median ion injection time.
`keepTopN` | `integer`, how many technical replicates should be kept?
`relative` | `logical`, if relative is `TRUE` all fragments with intensity below `threshold * max(intensity)` per fragment are removed, otherwise all fragments below `threshold` are removed.
`minN` | `numeric`, if less than `minN` of a fragment are found across technical replicates it is removed.
`method` | `character`, normalisation method, currently just `"TIC"` for Total Ion Current normalisation of the scans/conditions (column-wise normalisation) is supported.
`verbose` | `logical`, verbose output?
`what` | `character`, specifies whether `"conditions"` (columns; default) or `"fragments"` (rows) should be summarized.
`...` | arguments passed to internal/other methods. replicates (that's why the default is the `"Sample"` column in `colData`).

### Details

See `vignette("analysis", package="topdownr")` for a detailed example how to work with `TopDownSet` objects.

### Value

An TopDownSet object.

### Methods (by generic)

- `aggregate`: Aggregate conditions/runs.

  Aggregates conditions/runs (columns) in an TopDownSet object `by` a user-given value (default is the `"Sample"` column of `colData` which has the same value for technical replicates). It combines intensity values and numeric metadata of the grouped conditions/runs (columns) by `mean` and returns a reduced TopDownSet object.

- `combine`: Combine `TopDownSet` objects.

  `combine` allows to combine two or more `TopDownSet` objects. Please note that it uses the default `sampleColumns` to define technical replicates (see `readTopDownFiles()`).and the default `by` argument to group ion injection times for the calculation of the median time (see `updateMedianInjectionTime()`). Both could be modified after `combine` by calling `updateConditionNames()` (with modified `sampleColumns` argument) and `updateMedianInjectionTime()` (with modified `by` argument).

- `filterCv`: Filter by CV.

  Filtering is done by coefficient of variation across technical replicates (defined by the `by` argument). All fragments below a given `threshold` are removed. The `threshold` is the maximal allowed CV in percent (`sd/mean * 100 < threshold`).

- `filterInjectionTime`: Filter by ion injection time.

  Filtering is done by maximal allowed deviation and just the technical `keepTopN` replicates with the lowest deviation from the median ion injection time are kept.

- `filterIntensity`: Filter by intensity.

  Filtering is done by removing all fragments that are below a given (absolute/relative) intensity `threshold`.

- `filterNonReplicatedFragments`: Filter by non-replicated fragments.

  Filtering is done by removing all fragments that don't replicate across technical replicates.

- `normalize`: Normalise.

  Applies Total Ion Current normalisation to a TopDownSet object. The normalisation ist done per scans/conditions (column-wise normalisation).

- `plot`: Plotting.

  Plots an TopDownSet object. The function returns a `list` of `ggplot` objects (one item per condtion). Use `pdf` or another non-interactive device to plot the list of `ggplot` objects (see example section).

- `summary`: Summary statistics.

  Returns a `matrix` with some statistics: number of fragments, total/min/first quartile/median/mean/third quartile/maximum of intensity values.

### Slots

`rowViews`

  FragmentViews, information about fragments (name, type, sequence, mass, charge), see FragmentViews for details.

`colData`

  S4Vectors::DataFrame, information about the MS2 experiments and the fragmentation conditions.

`assay`

  Matrix::dgCMatrix, intensity values of the fragments. The rows correspond to the fragments and the columns to the condition/run. It just stores values that are different from zero.

`files`

  `character`, files that were imported.

`tolerance`

  `double`, tolerance in ppm that were used for matching the experimental mz values to the theoretical fragments.

`redundantMatching`

  `character`, matching strategies for redundant ion/fragment matches. See `redundantIonMatch` and `redundantFragmentMatch` in `readTopDownFiles()` for details.

`processing`

  `character`, log messages.

### Coercion

'as(object, "MSnSet"): Coerce an TopDownSet object into an MSnbase::MSnSet object.

'as(object, "NCBSet"): Coerce an TopDownSet object into an NCBSet object.

### Author(s)

Sebastian Gibb mail@sebastiangibb.de

### See Also

- FragmentViews for the row view interface.

- Matrix::dgCMatrix for technical details about the intensity storage.

- `?vignette("analysis", package="topdownr")` for a full documented example of an analysis using `topdownr`.

### Examples

    ## Example data
    data(tds, package="topdownr")

    tds

    head(summary(tds))

    # Accessing slots
    rowViews(tds)
    colData(tds)
    head(assayData(tds))

    # Accessing colData
    tds$Mz
    tds$FilterString

    # Subsetting

    # First 100 fragments
    tds[1:100]

    # All c fragments
    tds["c"]

    # Just c 152
    tds["c152"]

    # Condition 1 to 10
    tds[, 1:10]

    # Filtering
    # Filter all intensities that don't have at least 10 % of the highest
    # intensity per fragment.
    tds <- filterIntensity(tds, threshold=0.1)

    # Filter all conditions with a CV above 30 % (across technical replicates)
    tds <- filterCv(tds, threshold=30)

    # Filter all conditions with a large deviation in injection time
    tds <- filterInjectionTime(tds, maxDeviation=log2(3), keepTopN=2)

    # Filter all conditions where fragments don't replicate
    tds <- filterNonReplicatedFragments(tds)

    # Normalise by TIC
    tds <- normalize(tds)

    # Aggregate technical replicates
    tds <- aggregate(tds)

    head(summary(tds))

    # Coercion
    as(tds, "NCBSet")

    if (require("MSnbase")) {
        as(tds, "MSnSet")
    }
    ## Not run:
    # plot a single condition
    # pseudo-code (replace topdownset with your object)
    plot(topdownset[,1])

    # plot the whole object
    pdf("topdown-spectra.pdf", paper="a4r", width=12)
    # pseudo-code (replace topdownset with your object)
    plot(topdownset)
    dev.off()

    ## End(Not run)

[Package topdownr version 1.8.0 Index]