plotfeatureCoverage {systemPipeR} | R Documentation

## Plot feature coverage results

### Description

Plots the 3 tabular data types (A-C) generated by the `featureCoverage` function. It accepts data from single or many features (e.g. CDSs) and samples (BAM files). The coverage from multiple features will be summarized using methods such as `mean`, while the data from multiple samples will be plotted in separate panels.

### Usage

    plotfeatureCoverage(covMA, method = mean, scales = "fixed", extendylim=2, scale_count_val = 10^6)

### Arguments

`covMA` | Object of class `data.frame` generated by `featureCoverage` function.
`method` | Defines the summary statistics to use when `covMA` contains coverage data from multiple features (e.g. transcripts). The default calculates the mean coverage for each positon and/or bin of the corresponding coverage vectors.
`scales` | Scales setting passed on to the `facet_wrap` function of `ggplot2`. For details see `ggplot2::facet_wrap`. The default `fixed` assures a constant scale across all bar plot panels, while `free` uses the optimum scale within each bar plot panel. To evaluate plots in all their details, it may be necessary to generate two graphics files one for each scaling option.
`extendylim` | Allows to extend the upper limit of the y axis when `scales=fixed`. Internally, the function identifies the maximum value in the data and then multiplies this maximum value by the value provided under `extendylim`. The default is set to `extendylim=2`.
`scale_count_val` | Scales (normalizes) the read counts to a fixed value of aligned reads in each sample such as counts per million aligned reads (default is 10^6). For this calculation the `N_total_aligned` values are used that are reported in the input `data.frame` generated by the upstream `featureCoverage` function. Assign `NULL` to turn off scaling.

### Value

Currently, the function returns ggplot2 bar plot graphics.

### Author(s)

Thomas Girke

### See Also

`featureCoverage`

### Examples

    ## Construct SYSargs object from param and targets files
    param <- system.file("extdata", "tophat.param", package="systemPipeR")
    targets <- system.file("extdata", "targets.txt", package="systemPipeR")
    args <- systemArgs(sysma=param, mytargets=targets)

    ## Not run:
    ## Features from sample data of systemPipeRdata package
    library(GenomicFeatures)
    file <- system.file("extdata/annotation", "tair10.gff", package="systemPipeRdata")
    txdb <- makeTxDbFromGFF(file=file, format="gff3", organism="Arabidopsis")

    ## (A) Generate binned coverage for two BAM files and 4 transcripts
    grl <- cdsBy(txdb, "tx", use.names=TRUE)
    fcov <- featureCoverage(bfl=BamFileList(outpaths(args)[1:2]), grl=grl[1:4], resizereads=NULL,
                        readlengthrange=NULL, Nbins=20, method=mean, fixedmatrix=FALSE,
                        resizefeatures=TRUE, upstream=20, downstream=20)
    fcov <- featureCoverage(bfl=BamFileList(outpaths(args)[1:2]), grl=grl[1:4], resizereads=NULL,
                        readlengthrange=NULL, Nbins=20, method=mean, fixedmatrix=TRUE,
                        resizefeatures=TRUE, upstream=20, downstream=20)
    plotfeatureCoverage(covMA=fcov, method=mean, scales="fixed", scale_count_val=10^6)

    ## (B) Coverage matrix upstream and downstream of start/stop codons
    fcov <- featureCoverage(bfl=BamFileList(outpaths(args)[1:2]), grl=grl[1:4], resizereads=NULL,
                        readlengthrange=NULL, Nbins=NULL, method=mean, fixedmatrix=TRUE,
                        resizefeatures=TRUE, upstream=20, downstream=20)
    plotfeatureCoverage(covMA=fcov, method=mean, scales="fixed", scale_count_val=10^6)

    ## (C) Combined matrix for both binned and start/stop codon
    fcov <- featureCoverage(bfl=BamFileList(outpaths(args)[1:2]), grl=grl[1:4], resizereads=NULL,
                        readlengthrange=NULL, Nbins=20, method=mean, fixedmatrix=TRUE,
                        resizefeatures=TRUE, upstream=20, downstream=20, outfile="results/test.xls")
    plotfeatureCoverage(covMA=fcov, method=mean, scales="fixed", scale_count_val=10^6)

    ## (D) Rle coverage objects one for each query feature
    fcov <- featureCoverage(bfl=BamFileList(outpaths(args)[1:2]), grl=grl[1:4], resizereads=NULL,
                        readlengthrange=NULL, Nbins=NULL, method=mean, fixedmatrix=FALSE,
                        resizefeatures=TRUE, upstream=20, downstream=20)

    ## End(Not run)

[Package systemPipeR version 1.21.6 Index]