readsPerTarget: Numbers of reads per target

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/readsPerTarget.R

Description

Counts the numbers of reads overlapping each target region

Usage

1
readsPerTarget(reads, targets, Offset = 0)

Arguments

reads

RangedData table containing positions of sequenced reads, i.e. output from get.reads

targets

RangedData table containing positions of target regions, i.e. output from get.targets

Offset

integer; add Offset bases on both sides to targeted regions and potentially collapse resulting overlapping target regions

Value

The input RangedData table targets with an additional 'values' column containing numbers of reads overlapping each target

Note

As reads input also the mappingReads output of function fraction.reads.target can be used to speed up calculation. In this case, make sure that targets and Offset parameters were the same in fraction.reads.target as then specified in readsPerTarget.

Author(s)

Manuela Hummel m.hummel@dkfz.de

See Also

coverage.target, fraction.reads.target, covered.k, coverage.hist, coverage.uniformity, coverage.plot, coverage.targetlength.plot

Examples

1
2
3
4
5
6
7
8
9
## get reads and targets
exptPath <- system.file("extdata", package="TEQC")
readsfile <- file.path(exptPath, "ExampleSet_Reads.bed")
reads <- get.reads(readsfile, idcol=4, skip=0)
targetsfile <- file.path(exptPath, "ExampleSet_Targets.bed")
targets <- get.targets(targetsfile, skip=0)

## number of reads per target
readsPerTarget(reads, targets)

Example output

Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colMeans, colSums, colnames,
    dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
    intersect, is.unsorted, lapply, lengths, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
    rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which, which.max, which.min

Loading required package: IRanges
Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following object is masked from 'package:base':

    expand.grid

Loading required package: Rsamtools
Loading required package: GenomeInfoDb
Loading required package: GenomicRanges
Loading required package: Biostrings
Loading required package: XVector

Attaching package: 'Biostrings'

The following object is masked from 'package:base':

    strsplit


Attaching package: 'Rsamtools'

The following object is masked from 'package:BiocGenerics':

    path

Loading required package: hwriter
Warning message:
replacing previous import 'BiocGenerics::path' by 'Rsamtools::path' when loading 'TEQC' 
[1] "read 19546 sequenced reads"
[1] "read 50 (non-overlapping) target regions"
RangedData with 50 rows and 1 value column across 21 spaces
       space              ranges   |    nReads
    <factor>           <IRanges>   | <numeric>
1       chr1   11158025-11158264   |       229
2       chr1   25870174-25870293   |         0
3       chr1   65656333-65656572   |       163
4       chr1   68611504-68611743   |       152
5       chr1   70225862-70226101   |       125
6       chr1 112269528-112270487   |       185
7       chr1 160970804-160970923   |        50
8       chr1 182635998-182636117   |        90
9       chr1 186270664-186270903   |       166
...      ...                 ... ...       ...
42      chr6 152787105-152787224   |       127
43      chr6 170639528-170639647   |        84
44      chr7 144345876-144345995   |       240
45      chr8     1830798-1830917   |         1
46      chr9     6241680-6241799   |       124
47      chr9   77277336-77277575   |       368
48      chr9   79827855-79827974   |        84
49      chrX   47086386-47086505   |        46
50      chrX 150891046-150891285   |        51

TEQC documentation built on Nov. 8, 2020, 8:07 p.m.