mergeSamples {CAGEr} | R Documentation

## Merge CAGE samples

### Description

Merges individual CAGE samples (datasets, experiments) within the CAGEr object into specified groups.

### Usage

    mergeSamples(object, mergeIndex, mergedSampleLabels)

    ## S4 method for signature 'CAGEset,numeric'
    mergeSamples(object, mergeIndex, mergedSampleLabels)

    ## S4 method for signature 'CAGEexp,ANY'
    mergeSamples(object, mergeIndex, mergedSampleLabels)

### Arguments

`object` | A `CAGEr` object.
`mergeIndex` | Integer vector specifying which experiments should be merged. (one value per sample, see Details).
`mergedSampleLabels` | Labels for the merged datasets (same length as the number of unique values in `mergeIndex`)

### Details

The samples within the CAGEr object are merged by adding the raw tag counts of individual CTSS that belong tho the same group. After merging, all other slots in the CAGEr object will be reset and any previous data for individual experiments will be removed.

`mergeIndex` controls which samples will be merged. It is an integer vector that assigns a group identifier to each sample, in the same order as they are returned by `sampleLabels(object)`. For example, if there are 8 CAGE samples in the CAGEr object and `mergeIndex = c(1,1,2,2,3,2,4,4)`, this will merge a) samples 1 and 2, b) samples 3, 4 and 6, c) samples 7 and 8, and d) it will leave sample 5 as it is, resulting in 4 final merged datasets.

Labels provided in `mergedSampleLabels` will be assigned to merged datasets in the ascending order of `mergeIndex` values, i.e. first label will be assigned to a dataset created by merging datasets labeled with lowest `mergeIndex` value (in this case `1`), etc.

### Value

The slots `sampleLabels`, `librarySizes` and `tagCountMatrix` of the provided `CAGEr` object will be updated with the information on merged CAGE datasets and will replace the previous information on individual CAGE datasets. All further slots with downstream information will be reset.

### Author(s)

Vanja Haberle

### Examples

    mergeSamples( exampleCAGEset
                , mergeIndex = c(1,1,2)
                , mergedSampleLabels = c("mergedSample1", "mergedSample2"))
    exampleCAGEset

    mergeSamples( exampleCAGEexp
                , mergeIndex = c(3,2,4,4,1)
                , mergedSampleLabels = c("zf_unfertilized", "zf_high", "zf_30p_dome", "zf_prim6"))
    exampleCAGEexp

[Package CAGEr version 1.24.0 Index]