knitr::opts_chunk$set(echo = TRUE, fig.align = "center", fig.width = 4, fig.height = 4)
devtools::load_all("..")
library(dplyr)
library(purrr)

Load plotmics

# load plotmics
library(plotmics)

Run DEcompare()

DEcompare() draws an ggplot2-based scatter plot comparing the log2FC of 2 different differential expression contrasts contrasts.

Required

As input, DEcompare() takes a list of 2 data frames with the columns Geneid, padj.

# read the dataframes into a list
deg_list <- list.files("../testdata", "diff_exp", full.names = T, recursive = T) %>%
  purrr::set_names(paste("cond", 1:3, sep = "")) %>%
  purrr::map(~read.delim(.x))

deg_list[[1]] %>% head()

Minimum run

DEcompare(deg_list = deg_list[1:2])
DEcompare(deg_list = deg_list[1:2])

Change thresholds

DEcompare(deg_list = deg_list[1:2], threshold = 0.1)

Customize plot

Change axis limits

DEcompare(deg_list = deg_list[1:2], xlim = c(-5,5), ylim = c(-5, 7))

Specify titles

DEcompare(deg_list = deg_list[1:2], main = "This is a title", subtitle = "This is a subtitle", 
            xlab = "This is the X-axis label", ylab = "This is the Y-axis label")

Change corner colors

DEcompare(deg_list = deg_list[1:2], color_corners = c("Gray50", "Gray70", "Gray90", "White"))
DEcompare(deg_list = deg_list[1:2], color_corners = c("White"))
DEcompare(deg_list = deg_list[1:2], alpha_corners = c(1, .1, .4, .7))
DEcompare(deg_list = deg_list[1:2], alpha_corners = .2)

Further costumization

Since DEcompare() outputs a ggplot2-based scatter plot, it can be further customized with scales or theme, etc.



amitjavilaventura/seqViewR documentation built on Nov. 21, 2023, 10:12 a.m.