get_genes_by_regulation: Get genes based on their differential regulation

View source: R/rnaseq_related.R

get_genes_by_regulationR Documentation

Get genes based on their differential regulation

Description

Get genes based on their differential regulation

Usage

get_genes_by_regulation(
  x,
  sample_comparisons,
  regulation = "both",
  simplify = FALSE
)

get_genesets_by_regulation(x, sample_comparisons, regulation = "both")

Arguments

x

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

sample_comparisons

a character vector denoting sample comparisons for which genes to be obtained.

regulation

a character string, default both. Values can be one of the up, down, both, other, all.

  • up : returns all up regulated genes.

  • down : returns all down regulated genes.

  • both : returns all up and down regulated genes.

  • other : returns genes other than up and down regulated genes.

  • all : returns all genes.

simplify

logical, default FALSE, if TRUE returns result in a dataframe format.

Details

For a given differential comparison this function returns up, down, both, other and all genes.

Value

a list or dataframe.

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"))

# get both up and down regulated genes
get_genes_by_regulation(x = res, sample_comparisons = c("treatment1_VS_control")) %>% head()

# get up genes only
get_genes_by_regulation(x = res, sample_comparisons = c("treatment1_VS_control") , regul = "up") %>% head()

# get down genes only
get_genes_by_regulation(x = res, sample_comparisons = c("treatment1_VS_control") , regul = "down") %>% head()

# get genes other than up and down
get_genes_by_regulation(x = res, sample_comparisons = c("treatment1_VS_control") , regul = "other") %>% head()

# Simplify output for multiple sample comparisons
get_genes_by_regulation(x = res, sample_comparisons = res$de_comparisons, simplify = TRUE, regul= "up")


# get genesets by regulation. It uses sample comparison and regulation to name each output geneset.

get_genesets_by_regulation(x = res, sample_comparisons = "treatment1_VS_control", regul = "both")


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