countRangeset.Rd
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.
countRangeset(bfl, args, outfiles=NULL, format="tabular", ...)
BamFileList
object containing paths to one or more BAM files.
An instance of SYSargs
or SYSargs2
constructed from a
targets
file where the first column (targetsin(args)
or
targets.as.df(targets(args))
) contains the paths to the tabular range
data files (e.g. peak ranges) used for counting. Another possibily is
named character vector
with the paths to the tabular range data files
and the elements names should be the sampleID.
Default is NULL
. When args
is an object of named
character vector
class, outfile
argument is required.
Named character vector
with the paths to the resulting count tables
and the elements names should be the sampleID.
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.
Named character vector containing the paths from outpaths(args)
to the
resulting count table files.
summarizeOverlaps
## 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)
#> Warning: path[1]="./data/SRR446027_1.fastq.gz": No such file or directory
#> Warning: path[2]="./data/SRR446028_1.fastq.gz": No such file or directory
#> Warning: path[3]="./data/SRR446029_1.fastq.gz": No such file or directory
#> Warning: path[4]="./data/SRR446030_1.fastq.gz": No such file or directory
#> Warning: path[5]="./data/SRR446031_1.fastq.gz": No such file or directory
#> Warning: path[6]="./data/SRR446032_1.fastq.gz": No such file or directory
#> Warning: path[7]="./data/SRR446033_1.fastq.gz": No such file or directory
#> Warning: path[8]="./data/SRR446034_1.fastq.gz": No such file or directory
#> Warning: path[9]="./data/SRR446035_1.fastq.gz": No such file or directory
#> Warning: path[10]="./data/SRR446036_1.fastq.gz": No such file or directory
#> Warning: path[11]="./data/SRR446037_1.fastq.gz": No such file or directory
#> Warning: path[12]="./data/SRR446038_1.fastq.gz": No such file or directory
#> Warning: path[13]="./data/SRR446039_1.fastq.gz": No such file or directory
#> Warning: path[14]="./data/SRR446040_1.fastq.gz": No such file or directory
#> Warning: path[15]="./data/SRR446041_1.fastq.gz": No such file or directory
#> Warning: path[16]="./data/SRR446042_1.fastq.gz": No such file or directory
#> Warning: path[17]="./data/SRR446043_1.fastq.gz": No such file or directory
#> Warning: path[18]="./data/SRR446044_1.fastq.gz": No such file or directory
bfl <- BamFileList(outpaths(args_bam), yieldSize=50000, index=character())
if (FALSE) {
##########################################
## Examples with \code{SYSargs2} object ##
##########################################
## Construct SYSargs2 object
## SYSargs2 with paths to range data and count files
dir_path <- system.file("extdata/cwl/count_rangesets", package="systemPipeR")
args <- loadWF(targets = "targets_macs.txt", wf_file = "count_rangesets.cwl",
input_file = "count_rangesets.yml", dir_path = dir_path)
args <- renderWF(args, inputvars = c(FileName = "_FASTQ_PATH1_", SampleName = "_SampleName_"))
## Iterative read counting
countDFnames <- countRangeset(bfl, args, mode="Union", ignore.strand=TRUE)
##########################################
## Examples with \code{SYSargs} object ##
##########################################
## Construct SYSargs object
## 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)
}