makeMaster {synapter} | R Documentation

## Merges final peptide files

### Description

This function combines a list of peptide final peptide files into one single master file that is obtained by merging the unique peptides from the filtered original peptide files.
Additionally it can combine multiple final fragment files into a fragment library.

### Usage

    makeMaster(pepfiles, fragmentfiles, fdr = 0.01, method = c("BH",
      "Bonferroni", "qval"), span.rt = 0.05, span.int = 0.05,
      maxDeltaRt = Inf, removeNeutralLoss = TRUE, removePrecursor = TRUE,
      tolerance = 2.5e-05, verbose = interactive())

### Arguments

`pepfiles` | A `character` vector of final peptide file names to be merged.
`fragmentfiles` | A `character` vector of final fragment file names to be combined into an fragment library. These files should be from the same runs as the final peptide files used in `pepfiles`.
`fdr` | A `numeric` indicating the peptide false discovery rate limit.
`method` | A `character` indicating the p-value adjustment to be used. One of `BH` (default), `Bonferroni` or `qval`.
`span.rt` | A `numeric` with the loess span parameter value to be used for retention time modelling.
`span.int` | A `numeric` with the loess span parameter value to be used for intensity modelling.
`maxDeltaRt` | A `double` value that sets a maximum limit for the retention time deviaton between master and slave run to be included
`removeNeutralLoss` | A `logical`, if `TRUE` peptides with neutral loss are removed from the fragment library.
`removePrecursor` | A `logical`, if `TRUE` precursor ions are removed from the fragment spectra.
`tolerance` | A `double` value that determines the tolerance used to look for the precursor ions.
`verbose` | A `logical` indicating if information should be printed out.

### Details

The merging process is as follows:

1. Each individual peptide final peptide file is filtered to retain (i) non-duplicated unique tryptic peptides, (ii) peptides with a false discovery rate <= `fdr` and (iii) proteins with a false positive rate <= `fpr`.

2. The filtered peptide files are ordered (1) according to their total number of peptides (for example [P1, P2, P3]) and (2) as before with the first item is positioned last ([P2, P3, P1] in the previous example). The peptide data are then combined in pairs in these respective orders. The first one is called the master file.

3. For each (master, slave) pair, the slave peptide file retention times are modelled according to the (original) master's retention times and slave peptides, not yet present in the master file are added to the master file.

4. The final master datasets, containing their own peptides and the respective slave specific retention time adjusted peptides are returned as a `MasterPeptides` instance.

The resulting `MasterPeptides` instance can be further used for a complete master vs. peptides/Pep3D analysis, as described in `Synapter`, `synergise` or using the GUI (`synapterGUI`). To do so, it must be serialised (using the `saveRDS` function) with a `.rds` file extension, to be recognised (and loaded) as a `R` object.

When several quantitation (or identification) files are combined as a master set to be mapped back against the inidividual final peptide files, the second master [P2, P3, P1] is used when analysing the peptide data that was first selected in the master generation (P1 above). This is to avoid aligning two identical sets of peptides (those of P1) and thus not being able to generate a valid retention time model. This is detected automatically for the user.

The two master peptides dataframes can be exported to disk as two `csv` files with `writeMasterPeptides`. The `MasterPeptides` object returned by `makeMaster` can be saved to disk (with `save` or `saveRDS`) and later reloaded (with `load` or `readRDS`) for further analysis.

The fragment library generation works as follows:

1. Each individual final fragment file is imported and only peptides present in the master dataset are used.

2. The fragments are combined based on their precursor ions.

3. The intensities of identical fragments (seen in different runs) is summed and divided by the summed precursor intensity (of the same peptide in different runs).

4. Afterwards the intensities are normalized to the average precursor intensity of the different runs.

5. Finally a `MSnExp` object is created.

The fragment library dataframe can be exported to disk as `csv` file with `writeFragmentLibrary`.

### Value

An instance of class `"MasterPeptides"`.

### Author(s)

Laurent Gatto, Sebastian Gibb

### References

Shliaha P.V., Bond N. J., Lilley K.S. and Gatto L., in prep.

### See Also

See the `Synapter` class manual page for detailed information on filtering and modelling and the general algorithm implemented in the `synapter` package.

The `estimateMasterFdr` function allows to control false dicovery rate when combining several peptide files while maximising the number of identifications and suggest which combination of peptide files to use.

The vignette, accessible with `synapterGuide()` illustrates a complete pipeline using `estimateMasterFdr` and `makeMaster`.

[Package synapter version 2.4.1 Index]