PAC_stackbar | R Documentation |
PAC_stackbar
Generates a graph that stack classes up to 100
PAC_stackbar(
PAC,
anno_target = NULL,
pheno_target = NULL,
color = NULL,
width = 1,
no_anno = TRUE,
total = TRUE,
summary = "samples",
norm = "counts",
plot = "percent"
)
PAC |
PAC-list object. |
anno_target |
List with: 1st object being character vector of target column(s) in Anno, 2nd object being a character vector of the target biotype(s) in the target column (1st object). Important, the 2nd object is order sensitive, meaning that categories will appear in the same order in the stacked bargraph. (default=NULL) |
pheno_target |
List with: 1st object being character vector of target column(s) in Pheno, 2nd object being a character vector of the target group(s) in the target column (1st object). Important, the 2nd object is order sensitive, meaning that categories will appear in the same order in the stacked bargraph. (default=NULL) |
color |
Character vector with rgb colour hex codes in the same length as the number of biotypes. For example see: https://www.coolgenerator.com/rgb-color-generator. color=NULL will generate the default color scheme. |
width |
Integer adjusting the width of the bars (default=1). Works best with few or singular bars. |
no_anno |
Logical. If TRUE sequences with no annotations will be
plotted, while FALSE will skip sequences with 'no_anno' in the column
defined by anno_target (default=TRUE). Note that you can always use
|
total |
Logical, whether the total counts should be added at the bottom of each graph (default=TRUE). |
summary |
Character vector defining whether to stack individual samples in each stack, or using a group mean of samples sharing the same names in the specified pheno_target. If summary="samples" individual samples will be plotted, if summary="pheno" means of pheno_target will be plotted, while if summary= all" a mean of all samples will be plotted. (Default="samples"). |
norm |
Character vector defining what data to base analysis on, e.g "counts" for raw counts (default), "cpm" for normalized data or any other column in norm section of PAC object. |
plot |
Character vector defining how data is to be presented in stack bar, where default is "percent", showing the percentage of the anno_target of all reads. Other option is "total", where the total amount of counts/normalized reads are stacked in one stack per anno_target. |
Given a PAC object the function will attempt to extract group information from Pheno, class information from Anno, and summarize this over the data in Counts or norm to generate a stacked (percent or total counts) bar.
A stacked bar plot generated by ggplot2
https://github.com/Danis102 for updates on the current package.
Other PAC analysis:
PAC_covplot()
,
PAC_deseq()
,
PAC_filter()
,
PAC_filtsep()
,
PAC_gtf()
,
PAC_jitter()
,
PAC_mapper()
,
PAC_nbias()
,
PAC_norm()
,
PAC_pca()
,
PAC_pie()
,
PAC_saturation()
,
PAC_sizedist()
,
PAC_summary()
,
PAC_trna()
,
as.PAC()
,
filtsep_bin()
,
map_rangetype()
,
tRNA_class()
load(system.file("extdata", "drosophila_sRNA_pac_filt_anno.Rdata",
package = "seqpac", mustWork = TRUE))
##########################################
### Stacked bars in seqpac
##----------------------------------------
# Choose an anno_target and plot samples (summary="samples")
PAC_stackbar(pac, anno_target=list("Biotypes_mis0"))
# 'no_anno' and 'other' will always end on top not matter the order
ord_bio <- as.character(sort(unique(anno(pac)$Biotypes_mis3)))
p1 <- PAC_stackbar(pac, anno_target=list("Biotypes_mis0", ord_bio))
p2 <- PAC_stackbar(pac, anno_target=list("Biotypes_mis0", rev(ord_bio)))
cowplot::plot_grid(plotlist=list(p1, p2))
# (Hint: if you don't want them to appear on top, rename them)
# Reorder samples by pheno_targets
PAC_stackbar(pac, pheno_target=list("batch"), summary="samples",
anno_target=list("Biotypes_mis0"))
# Summarized over pheno_target
# (as default PAC_stackbar orders by pheno_target but plots all samples,
# unless summary="pheno")
PAC_stackbar(pac, anno_target=list("Biotypes_mis0"),
summary="pheno", pheno_target=list("stage"))
# Summarized over a grand mean of all samples
PAC_stackbar(pac, anno_target=list("Biotypes_mis0"), summary="all")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.