Description Usage Arguments Value Note Author(s) See Also Examples
View source: R/fraction.reads.target.R
Calculates the fraction of reads that align to target regions. Can also be used to retrieve those reads mapping to targets.
1 | fraction.reads.target(reads, targets, Offset = 0, mappingReads = FALSE)
|
reads |
|
targets |
|
Offset |
integer; add |
mappingReads |
if |
If mappingReads
equals FALSE
, just the fraction of reads / read pairs mapping to targets is returned.
When reads
contains all single reads (i.e. is output of get.reads
), this is the number of target-overlapping reads,
divided by the number of all single reads. When reads
contains read pairs (i.e. is output of reads2pairs
),
it is the number of read pairs with at least one target-overlapping read, divided by the
number of read pairs (= half the number of reads). In case of small targets and large insert sizes
the two reads of a pair could be located on both sides of the target without overlap, respectively.
Still, the read pair will be counted as on-target, since the corresponding DNA molecule was covering the target.
If mappingReads
equals TRUE
, a list is returned with elements
onTargetFraction |
fraction of reads / read pairs mapping to targets |
mappingReads |
|
With the output from fraction.target
and fraction.reads.target
the 'enrichment' of the target capture experiment can be calculated as
'fraction of on-target reads / fraction of target within genome'
Manuela Hummel m.hummel@dkfz.de
fraction.target
, get.reads
, reads2pairs
, get.targets
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)
## fraction of on-target reads
fraction.reads.target(reads, targets)
|
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"
[1] 0.3891845
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.