coverage-functions {CAGEr} | R Documentation

## Private functions behind `cumulativeCTSSdistribution`

### Description

`.getCumsum` calculates cumulative sums of tpm along the clusters.

### Usage

    .getCAGEsignalCoverage(ctss.chr, clusters)

    .getCumsumChr2(clusters, ctss, chrom, str)

    .getCumsum(ctss, clusters, useMulticore = FALSE, nrCores = NULL)

### Arguments

`ctss.chr` | A 'CTSS.chr“ object (guaranteed to have only one chromosome).
`clusters` | GRanges as per `tagClustersGR()`.
`ctss` | GRanges as per `CTSScoordinatesGR`, with the score of one sample.
`chrom` | a chromosome name
`str` | a strand name
`useMulticore, nrCores` | See clusterCTSS.

### Details

'.getCAGEsignalCoverage“ does... Note that strand is not taken into account.

`.getCumsumChr2`

### Value

`.getCumsum` returns a list of `Rle` vectors (IRanges package) containing cumulative sum for each cluster (length of list is equal to number of clusters and names of the list components corespond to the name of the corresponding cluster) v.

### Examples

    library(GenomicRanges)
    library(IRanges)
    ctss <- CAGEr:::.CTSS(
              GPos( stitch = FALSE
                  , GRanges( seqnames=Rle("chr1")
                           , IRanges(c(1,3,4,12,14,25,28,31,35), w=1)
                           , strand = "+")))
    score(ctss) <- 1
    ctss.chr <- CAGEr:::.CTSS.chr(ctss)
    clusters <- GRanges( seqnames = Rle("chr1")
                       , ranges = IRanges(c(1,12,25,31,32), c(4,14,28,31,33))
                       , strand = "+")
    chrom <- "chr1"
    str <- "+"
    CAGEr:::.getCAGEsignalCoverage(ctss.chr, clusters)
    CAGEr:::.getCumsumChr2(clusters, ctss, chrom, str)
    ctss      <- CTSSnormalizedTpmGR(exampleCAGEset, "sample1")
    ctss      <- ctss[ctss$filteredCTSSidx]
    clusters  <- tagClustersGR(exampleCAGEset, "sample1")
    clusters.cumsum <- RleList(CAGEr:::.getCumsum(ctss, clusters))
    identical( lapply(exampleCAGEset@CTSScumulativesTagClusters[[1]],decode)
             , lapply(clusters.cumsum, decode))
    # Not identical if not decoded because Rle method is attached to S4Vectors in one case
    # and to IRanges in the other case.
    decode(clusters.cumsum[[1]])
    ctss[queryHits(findOverlaps(ctss, clusters[1]))]
    clusters[1]

    ctss      <- CTSSnormalizedTpmGR(exampleCAGEexp, "Zf.30p.dome")
    ctss      <- ctss[ctss$filteredCTSSidx]
    clusters  <- tagClustersGR(exampleCAGEexp, "Zf.30p.dome")
    clusters.cumsum <- CAGEr:::.getCumsum(ctss, head(clusters))
    decode(clusters.cumsum[[3]])
    ctss[queryHits(findOverlaps(ctss, clusters[3]))]
    clusters[3]

[Package CAGEr version 1.30.3 Index]