PAC_pie: Pie plot from PAC

View source: R/PAC_pie.R

PAC_pieR Documentation

Pie plot from PAC

Description

PAC_pie analyses nucleotide bias.

Usage

PAC_pie(
  PAC,
  anno_target = NULL,
  pheno_target = NULL,
  colors = NULL,
  labels = "all",
  no_anno = TRUE,
  summary = "sample",
  angle = -25
)

Arguments

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 pie. (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 pie. (default=NULL)

colors

Character vector RGB color codes as generated by for example grDevices::colorRampPalette. If colors=NULL (default), colors will be generated using a default color palette. Important: In default mode, categories named "other" or no_anno" will automatically receive a grey color.

labels

Character that sets what labels to plot in the actual pie besides the legend. If lables="all" (default), then the anno_target variables will be combined with percentage. If lables="percent" only percentages will be plotted with the pie. If labels="none", no lables will be present besides the legend.

no_anno

Logical whether PAC sequences without an annotation should be removed prior to plotting. Specifically, if no_anno=FALSE, then sequences annotated with "no_anno" in the anno_target column will be removed prior to plotting. When no_anno=TRUE (default), then all sequences will be included (unless excluded in the anno_target object).

summary

Character defining whether to stack individual samples or using a mean of samples. If summary="samples" individual samples will be plotted (default). If summary="pheno" means of the sample groups targeted by the pheno_target input will be plotted. If summary="all" mean of all samples will be plotted.

angle

Integer (positive or negative) that sets the rotation of the pie.

Details

Given a PAC object the function will summarize the counts into percent biotype and plot a pie chart.

Value

A pie plot

See Also

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_saturation(), PAC_sizedist(), PAC_stackbar(), PAC_summary(), PAC_trna(), as.PAC(), filtsep_bin(), map_rangetype(), tRNA_class()

Examples



##########################################
### Pie charts in seqpac 
##----------------------------------------

load(system.file("extdata", "drosophila_sRNA_pac_filt_anno.Rdata", 
                  package = "seqpac", mustWork = TRUE))

# Choose an anno_target and plot samples (summary="samples"; default)
output_pie <- PAC_pie(pac, anno_target=list("Biotypes_mis0"))
output_pie[[1]]
output_pie[[6]]

# Summary="all" will give a mean of all samples:
PAC_pie(pac, anno_target=list("Biotypes_mis0"), summary="all")
# Rotate:
PAC_pie(pac, anno_target=list("Biotypes_mis0"), summary="all", angle=180)


#  Make ordered pie charts of grand mean percent of all samples
ord_bio <- as.character(sort(unique(anno(pac)$Biotypes_mis3)), 
                                    unique(anno(pac)$Biotypes_mis0))
output_pie_1 <- PAC_pie(pac, anno_target=list("Biotypes_mis0", ord_bio), 
                        summary="all")
output_pie_2 <- PAC_pie(pac, anno_target=list("Biotypes_mis3", ord_bio), 
                        summary="all")
cowplot::plot_grid(plotlist=c(output_pie_1, output_pie_2), nrow=2, 
                   scale = 1.0)

#  Shortcut to remove no annotations ("no_anno") in the anno_target column
PAC_pie(pac, anno_target=list("Biotypes_mis3"), summary="all", no_anno=TRUE)
PAC_pie(pac, anno_target=list("Biotypes_mis3"), summary="all", no_anno=FALSE)


Danis102/seqpac documentation built on Aug. 26, 2023, 10:15 a.m.