plot_deg_upsets: Generate upset plots for differently expressed genes between...

View source: R/rnaseq_related.R

plot_deg_upsetsR Documentation

Generate upset plots for differently expressed genes between comparisons.

Description

For a given set of DEG comparisons, the functions returns UpSetR::upset() plots for up and down genes between any 2 comparisons. For each upset plot generated function also returns interaction between gene sets in form of dataframe.

Usage

plot_deg_upsets(
  x,
  sample_comparisons,
  color_up = "#b30000",
  color_down = "#006d2c"
)

Arguments

x

x an abject of class "parcutils". This is an output of the function run_deseq_analysis().

sample_comparisons

a character vector denoting sample comparisons between upset plot to be generated.

color_up

a character string denoting a valid color code for bars in upset plot for up regulated genes.

color_down

a character string denoting a valid color code for bars in upset plot for down regulated genes.

Value

an object of named list where each element is a list of two - 1) an upset plots UpSetR::upset() and their intersections in form of tibble.

Examples


count_file <- system.file("extdata","toy_counts.txt" , package = "parcutils")
count_data <- readr::read_delim(count_file, delim = "\t")

sample_info <- count_data %>% colnames() %>% .[-1]  %>%
 tibble::tibble(samples = . , groups = rep(c("control" ,"treatment1" , "treatment2"), each = 3) )


res <- run_deseq_analysis(counts = count_data ,
                         sample_info = sample_info,
                         column_geneid = "gene_id" ,
                         group_numerator = c("treatment1", "treatment2") ,
                         group_denominator = c("control"))

yy <- plot_deg_upsets(x= res, sample_comparisons = c("treatment1_VS_control","treatment2_VS_control"))

yy[[1]]$upset_plot %>% print()

yy[[1]]$upset_intersects %>% print()


cparsania/parcutils documentation built on Oct. 27, 2024, 4:55 a.m.