plotfeaturetypeCounts | R Documentation |
Function to visualize the distribution of reads across different feature types
for many alignment files in parallel. The plots are stacked bar plots
representing the raw or normalized read counts for the sense and antisense
strand of each feature. The graphics results are generated with
ggplot2
. Typically, the expected input is generated with the
affiliated featuretypeCounts
function.
plotfeaturetypeCounts(x, graphicsfile, graphicsformat = "pdf", scales = "fixed", anyreadlength = FALSE,
drop_N_total_aligned = TRUE, scale_count_val = 10^6, scale_length_val = NULL)
x |
|
graphicsfile |
Path to file where to write the output graphics. Note, the function returns
the graphics instructions from |
graphicsformat |
Graphics file format. Currently, supported formats are: pdf, png or jpeg. Argument accepts one of them as character string. |
scales |
Scales setting passed on to the |
anyreadlength |
If set to |
drop_N_total_aligned |
If set to |
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 |
scale_length_val |
Allows to adjust the raw or scaled read counts to a constant length interval
(e.g. |
The function returns bar plot graphics for aligned read counts with read
length resolution if the input contains this information and argument
anyreadlength
is set to FALSE
. If the input contains counts for
any read length and/or anyreadlength=TRUE
then there will be only one
bar per feature and sample. Due to the complexity of the plots, the results
are directly written to file in the chosen graphics format. However, the
function also returns the plotting instructions returned by ggplot2
to
display the result components using R's plotting device.
Thomas Girke
featuretypeCounts
, genFeatures
## Construct SYSargs2 object from param and targets files
targets <- system.file("extdata", "targets.txt", package="systemPipeR")
dir_path <- system.file("extdata/cwl", package="systemPipeR")
args <- loadWorkflow(targets=targets, wf_file="hisat2/hisat2-mapping-se.cwl",
input_file="hisat2/hisat2-mapping-se.yml", dir_path=dir_path)
args <- renderWF(args, inputvars=c(FileName="_FASTQ_PATH1_", SampleName="_SampleName_"))
args
## Not run:
## Run alignments
args <- runCommandline(args, dir = FALSE, make_bam = TRUE)
outpaths <- subsetWF(args, slot = "output", subset = 1, index = 1)
## Features from sample data of systemPipeRdata package
library(txdbmaker)
file <- system.file("extdata/annotation", "tair10.gff", package="systemPipeRdata")
txdb <- makeTxDbFromGFF(file=file, format="gff3", organism="Arabidopsis")
feat <- genFeatures(txdb, featuretype="all", reduce_ranges=TRUE, upstream=1000, downstream=0, verbose=TRUE)
## Generate and plot feature counts for specific read lengths
fc <- featuretypeCounts(bfl=BamFileList(outpaths, yieldSize=50000), grl=feat, singleEnd=TRUE, readlength=c(74:76,99:102), type="data.frame")
p <- plotfeaturetypeCounts(x=fc, graphicsfile="featureCounts.pdf", graphicsformat="pdf", scales="fixed", anyreadlength=FALSE)
## Generate and plot feature counts for any read length
fc2 <- featuretypeCounts(bfl=BamFileList(outpaths, yieldSize=50000), grl=feat, singleEnd=TRUE, readlength=NULL, type="data.frame")
p2 <- plotfeaturetypeCounts(x=fc2, graphicsfile="featureCounts2.pdf", graphicsformat="pdf", scales="fixed", anyreadlength=TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.