Convenience function to perform read counting iteratively for serveral range sets, e.g. peak range sets or feature types. Internally, the read counting
is performed with the summarizeOverlaps function from the GenomicAlignments
package. The resulting count tables are directly saved to files.
Usage
countRangeset(bfl, args, format="tabular", ...)
Arguments
bfl
BamFileList object containing paths to one or more BAM files.
args
Object of class SYSargs where infile1(args) specifies the
paths to the tabular range data files (e.g. peak ranges) used for counting.
format
Format of input range files. Currently, supported are tabular or bed.
If tabular is selected then the input range files need to contain the proper
column titles to coerce with as(..., "GRanges") to GRanges
objects after importing them with read.delim. The latter is the case
for the peak files (*peaks.xls) generated by the MACS2 software.
...
Arguments to be passed on to internally used summarizeOverlaps function.
Value
Named character vector containing the paths from outpaths(args) to the
resulting count table files.
Author(s)
Thomas Girke
See Also
summarizeOverlaps
Examples
## Paths to BAM files
param <- system.file("extdata", "bowtieSE.param", package="systemPipeR")
targets <- system.file("extdata", "targets.txt", package="systemPipeR")
args_bam <- systemArgs(sysma=param, mytargets=targets)
bfl <- BamFileList(outpaths(args_bam), yieldSize=50000, index=character())
## Not run:
## SYSargs with paths to range data and count files
args <- systemArgs(sysma="param/count_rangesets.param", mytargets="targets_macs.txt")
## Iterative read counting
countDFnames <- countRangeset(bfl, args, mode="Union", ignore.strand=TRUE)
writeTargetsout(x=args, file="targets_countDF.txt", overwrite=TRUE)
## End(Not run)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(systemPipeR)
Loading required package: Rsamtools
Loading required package: GenomeInfoDb
Loading required package: stats4
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, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, 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, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Loading required package: S4Vectors
Attaching package: 'S4Vectors'
The following objects are masked from 'package:base':
colMeans, colSums, expand.grid, rowMeans, rowSums
Loading required package: IRanges
Loading required package: GenomicRanges
Loading required package: Biostrings
Loading required package: XVector
Loading required package: ShortRead
Loading required package: BiocParallel
Loading required package: GenomicAlignments
Loading required package: SummarizedExperiment
Loading required package: Biobase
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/systemPipeR/countRangeset.Rd_%03d_medium.png", width=480, height=480)
> ### Name: countRangeset
> ### Title: Read counting for several range sets
> ### Aliases: countRangeset
> ### Keywords: utilities
>
> ### ** Examples
>
> ## Paths to BAM files
> param <- system.file("extdata", "bowtieSE.param", package="systemPipeR")
> targets <- system.file("extdata", "targets.txt", package="systemPipeR")
> args_bam <- systemArgs(sysma=param, mytargets=targets)
There were 18 warnings (use warnings() to see them)
> bfl <- BamFileList(outpaths(args_bam), yieldSize=50000, index=character())
>
> ## Not run:
> ##D ## SYSargs with paths to range data and count files
> ##D args <- systemArgs(sysma="param/count_rangesets.param", mytargets="targets_macs.txt")
> ##D
> ##D ## Iterative read counting
> ##D countDFnames <- countRangeset(bfl, args, mode="Union", ignore.strand=TRUE)
> ##D writeTargetsout(x=args, file="targets_countDF.txt", overwrite=TRUE)
> ##D
> ## End(Not run)
>
>
>
>
>
> dev.off()
null device
1
>