runDiff.Rd
Convenience wrapper function for run_edgeR
and run_DESeq2
to
perform differential expression or abundance analysis iteratively for several
count tables. The latter can be peak calling results for several samples or
counts generated for different genomic feature types. The function also returns
the filtering results and plots from filterDEGs
.
runDiff(args, outfiles=NULL, diffFct, targets, cmp, dbrfilter, ...)
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
read count data files. 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.
Defines which function should be used for the differential abundance analysis.
Can be diffFct=run_edgeR
or diffFct=run_DESeq2
.
targets data.frame
codecharacter matrix where comparisons are defined in two columns. This matrix should be generated with readComp()
from the targets file. Values used for comparisons need to match those in the Factor
column of the targets file.
Named vector with filter cutoffs of format c(Fold=2, FDR=1)
where Fold
refers to the fold change cutoff (unlogged) and FDR
to the p-value cutoff. Those values are passed on to the filterDEGs
function.
Arguments to be passed on to the internally used run_edgeR
or
run_DESeq2
function.
Returns list
containing the filterDEGs
results for each
count table. Each result set is a list
with four components
which are described under ?filterDEGs
. The result files
contain the edgeR
or DESeq2
results from the comparisons
specified under cmp
. The base names of the result files are the
same as the corresponding input files specified under countfiles
and the value of extension
appended.
run_edgeR
, run_DESeq2
, filterDEGs
## 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) {
## 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)
## Run differential abundance analysis
cmp <- readComp(file=args_bam, format="matrix")
args_diff <- systemArgs(sysma="param/rundiff.param", mytargets="targets_countDF.txt")
dbrlist <- runDiff(args, diffFct=run_edgeR, targets=targetsin(args_bam), cmp=cmp[[1]], independent=TRUE, dbrfilter=c(Fold=2, FDR=1))
writeTargetsout(x=args_diff, file="targets_rundiff.txt", overwrite=TRUE)
}