PAC_jitter: Plots jitter plot from PAC object

View source: R/PAC_jitter.R

PAC_jitterR Documentation

Plots jitter plot from PAC object

Description

PAC_jitter Plots a jitter plot using the information in the Anno and Counts tables in a PAC object.

Usage

PAC_jitter(
  PAC,
  summary_target = NULL,
  anno_target = NULL,
  type = "jitter",
  limits = NULL,
  ypos_n = NULL,
  colors = NULL,
  box = TRUE
)

Arguments

PAC

PAC-object containing Anno and a summary list-folder with summarized dataframe(s) for example generated by PAC_summary. The function can also be applied on a dataframe containing a column with annotation groupings (e.g. biotype) and a column with summarized data (e.g. log2 fold changes). Rows should be unique sequences as the rownames of a PAC summary object.

summary_target

List with: 1st object being a character vector of the target dataframe in summary and 2nd object being a character vector of the target column(s) in that dataframe. In case of input being a dataframe, summary_target can be a character vector indicating the column with the summarized data.

anno_target

Character vector with the name of the target column in Anno or the name of the annotation column in case of input being a dataframe.

type

Character. If type="jitter" (default) the jitter-plots will be returned. If type="violine", a violin-plot will instead the returned.

limits

Integer vector with the y-limits to be parsed to ggplot2.

ypos_n

Integer setting the y position of the n counts to be parsed to ggplot2.

colors

Character vector with color codes to be parsed to ggplot2.

box

Logical whether a boxplot should be plotted or not (default=TRUE)

Details

Given a PAC object with grouped summaries the function will use column(s) in the Anno object to group the Counts table by row and then plot a jitter plot based on that

Value

A plot-list object with jitter plots generated by ggplot2.

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_mapper(), PAC_nbias(), PAC_norm(), PAC_pca(), PAC_pie(), PAC_saturation(), PAC_sizedist(), PAC_stackbar(), PAC_summary(), PAC_trna(), as.PAC(), filtsep_bin(), map_rangetype(), tRNA_class()

Examples


## Prepare
load(system.file("extdata", "drosophila_sRNA_pac_filt_anno.Rdata", 
                  package = "seqpac", mustWork = TRUE))
pac <- PAC_norm(pac, norm="cpm")

pac <- PAC_summary(PAC=pac, norm = "cpm", type = "log2FC", 
                   pheno_target=list("stage"))
pac <- PAC_summary(PAC=pac, norm = "cpm", type = "percentgrand", 
                   pheno_target=list("stage"))

## Jitter plots
plots_FC <- PAC_jitter(pac, summary_target=list("Log2FC_stage"), 
                       anno_target=list("Biotypes_mis0"))
plots_FCgrand <- PAC_jitter(pac, summary_target=list("percGrand_stage"), 
                            anno_target=list("Biotypes_mis0"))

cowplot::plot_grid(plotlist=plots_FC, nrow = 3, ncol = 1)
cowplot::plot_grid(plotlist=plots_FCgrand, nrow = 3, ncol = 1) 

## Violin plots instead
plots_FC <- PAC_jitter(pac, type="violin", 
                       summary_target=list("Log2FC_stage"), 
                       anno_target=list("Biotypes_mis0"))
plots_FCgrand <- PAC_jitter(pac, type="violin", 
                            summary_target=list("percGrand_stage"), 
                            anno_target=list("Biotypes_mis0"))

cowplot::plot_grid(plotlist=plots_FC, nrow = 3, ncol = 1)
cowplot::plot_grid(plotlist=plots_FCgrand, nrow = 3, ncol = 1)  


## Violin with changed biotype order
new_order  <- as.character(unique(anno(pac)$Biotypes_mis0))[c(2,4,3,6,7,5,1)]
plots_FC <- PAC_jitter(pac, type="violin", 
                       summary_target=list("Log2FC_stage"), 
                       anno_target=list("Biotypes_mis0", new_order))
cowplot::plot_grid(plotlist=plots_FC, nrow = 3, ncol = 1)



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