get_normalised_expression_matrix: Prepare a matrix of normalised gene expression values.

View source: R/rnaseq_related.R

get_normalised_expression_matrixR Documentation

Prepare a matrix of normalised gene expression values.

Description

This function returns a dataframe having first column gene names and subsequent columns are normalised gene expression values for the samples passed through argument samples. Internally it filters the data from the norm_counts of argument x. For more details on how norm_counts created refer to the documentation of run_deseq_analysis().

Usage

get_normalised_expression_matrix(
  x,
  samples = NULL,
  genes = NULL,
  summarise_replicates = FALSE,
  summarise_method = "median"
)

Arguments

x

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

samples

a character vector denoting samples for which normalised gene expression values to be derived, Default NULL. If NULL it returns all samples in x

genes

a character vector denoting gene names for which normalised gene expression values to be derived, Default NULL. If NULL it returns all samples in x.

summarise_replicates

logical, default FALSE, indicating whether gene expression values summarised by mean or median between replicates.

summarise_method

a character string either "mean" or "median" by which normalised gene expression values will be summarised between replicates.

Value

a 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_normalised_expression_matrix(x = res) %>% print()

# summarise replicates by median

get_normalised_expression_matrix(x = res ,summarise_replicates = TRUE, summarise_method = "median") %>% print()

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