trimToPercentiles {CAGEfightR} | R Documentation

## Trim width of TCs to expression percentiles

### Description

Given a set of TCs and genome-wide CTSS coverage, reduce the width of TC until a certain amount of expression has been removed.

### Usage

    trimToPercentiles(object, pooled, ...)

    ## S4 method for signature 'GRanges,GRanges'
    trimToPercentiles(object, pooled, percentile = 0.1, symmetric = FALSE)

    ## S4 method for signature 'GRanges,GPos'
    trimToPercentiles(object, pooled, ...)

    ## S4 method for signature 'RangedSummarizedExperiment,GenomicRanges'
    trimToPercentiles(object, pooled, ...)

    ## S4 method for signature 'GRanges,RangedSummarizedExperiment'
    trimToPercentiles(object, pooled, ...)

    ## S4 method for signature
    ## 'RangedSummarizedExperiment,RangedSummarizedExperiment'
    trimToPercentiles(object, pooled, ...)

### Arguments

`object` | GenomicRanges or RangedSummarizedExperiment: TCs to be trimmed.
`pooled` | GenomicRanges or RangedSummarizedExperiment: CTSS coverage.
`...` | additional arguments passed to methods.
`percentile` | numeric: Fraction of expression to remove from TCs.
`symmetric` | logical: Whether to trim the same amount from both edges of the TC (TRUE) or always trim from the least expressed end (FALSE).

### Value

GRanges with trimmed TCs, including recalculated peaks and scores.

### See Also

Other Clustering functions: `clusterBidirectionally()`, `clusterUnidirectionally()`, `trimToPeak()`, `tuneTagClustering()`

Other Trimming functions: `trimToPeak()`

### Examples

    data(exampleCTSSs)
    data(exampleBidirectional)

    # Calculate pooled CTSSs
    exampleCTSSs <- calcTPM(exampleCTSSs, totalTags='totalTags')
    exampleCTSSs <- calcPooled(exampleCTSSs)

    # Choose a few wide clusters:
    TCs <- subset(exampleUnidirectional, width >= 100)

    # Symmetric trimming (same percentage from each side):
    TCs_sym <- trimToPercentiles(TCs, pooled=exampleCTSSs, symmetric=FALSE)

    # Assymmetric trimming (always trim from lowest side):
    TCs_asym <- trimToPercentiles(TCs, pooled=exampleCTSSs, symmetric=TRUE)

    # Compare the two results sets of widths:
    summary(width(TCs_sym) - width(TCs_asym))

[Package CAGEfightR version 1.10.0 Index]