Plot the ECDF of log2(fold change) between groups
deseq_fc_ecdf.Rd
This functions will take differential expression results as a
data.frame
and plot the ECDF for the input gene_lists
.
The gene sets to plot should be provided as a named list of vectors.
Example:
gene_lists = list("Background" = c("gene1", "gene2"), "Target" = c("gene2", "gene3"))
The output will be saved to a PDF if an output_filename
is provided.
Users can define the groups that are to be compared in the statistical test
using the null_name
and target_name
arguments. The names must be found
in gene_lists
. The factor_order
is used to order the groups in the
analysis.
This functions returns:
$plot
: The ECDF plot$stats
: The results object
Usage
deseq_fc_ecdf(
res,
gene_lists,
title = "ECDF",
output_filename = NULL,
palette = SeedMatchR.palette,
factor_order = NULL,
x_lims = c(-1, 1),
stats_test = c("KS", "Wilcoxen", "Wass", "DTS"),
alternative = c("greater", "less", "two.sided"),
null_name = 1,
target_name = 2,
height = 5,
width = 5,
dpi = 320,
theme = SeedMatchR.theme
)
Arguments
- res
The differential expression results data frame.
- gene_lists
A nested list of gene names. Example: gene_lists = list("Background" = background_list, "Target" = target_list)
- title
The tile of the plot.
- output_filename
If the output filename is provided, then the plot is saved.
- palette
Vector of colors to use for your curves.
- factor_order
Vector defining the order to use for the legends.
- x_lims
The x-axis range limits.
- stats_test
The statistical test to use. Options: KS, Wass, Wilcoxen, or DTS.
- alternative
The alternative hypothesis to test. Options: greater, less, two.sided.
- null_name
The name in the gene.list to use as the null for ECDF plots.
- target_name
The name in the gene.list to use as the target for ECDF.
- height
Plot height in inches.
- width
Plot width in inches.
- dpi
The DPI resolution for the figure.
- theme
A ggplot2 theme defining plot parameters.
Examples
if (FALSE) { # interactive()
library(dplyr)
guide.seq = "UUAUAGAGCAAGAACACUGUUUU"
anno.db = load_annotations("rnor7")
# Load test data
get_example_data("sirna")
sirna.data = load_example_data("sirna")
res <- sirna.data$Schlegel_2022_Ttr_D1_30mkg
# Filter DESeq2 results for SeedMatchR
res = filter_res(res, fdr.cutoff=1, fc.cutoff=0, rm.na.log2fc = TRUE)
res = SeedMatchR(res = res, gtf = anno.db$gtf, seqs = anno.db$seqs,
sequence = guide.seq, seed.name = "mer7m8", tx.id.col= FALSE)
# Gene set 1
mer7m8.list = res$gene_id[res$mer7m8 >= 1]
# Gene set 2
background.list = res$gene_id[res$mer7m8 == 0]
ecdf.results = deseq_fc_ecdf(res,
list("Background" = background.list, "mer7m8" = mer7m8.list))
}