Step-by-step method details
Step-by-step method details
Source IQR functions
Timing: 5 min
To run this protocol, a sourcing of provided convenience R functions from GitHub is required to calculate and visualize the IQR analyses. The functions, example data, and a tutorial are available at https://github.com/LaBargeLab/IQR_test[href=https://github.com/LaBargeLab/IQR_test].
Download IQR functions in R.
if(!require(devtools)){ install.packages("devtools") # If not already installed }
source_url("https://raw.githubusercontent.com/LaBargeLab/IQR_test/main/clean_functions.R")
Format input data
Timing: 5–30 min
The functions require input data with gene name, sample name, expression value, and grouping variable columns. Any parametric units are valid for expression values, such as counts-per-million, reads-per-kilobase transcript for RNA-seq, or protein abundance data. An example can be downloaded through the provided GitHub page.
Import expression matrix.
Critical: Data must be in long format - i.e., every combination of gene name and sample name must have its own row.
urlfile <- “https://raw.githubusercontent.com/LaBargeLab/IQR_test/main/example_gene_data.csv[href=https://raw.githubusercontent.com/LaBargeLab/IQR_test/main/example_gene_data.csv]”
data <- read.csv(urlfile)
data
# Symbol name value variable
## <chr> <chr> <dbl> <chr>
# 1 gene1 sample1 99 A
# 2 gene1 sample2 131 A
# 3 gene1 sample3 74 A
# 4 gene1 sample4 145 A
#
#
#...
#10000 gene1000 sample10 0 B
.
Run analyses
Timing: 1 min
Execute the stoichiometry function with the long format input data from step 2 to calculate the IQR for every sample by conditions and return a data frame with the results.
Critical: The stoichiometry function input requires the following arguments:
symbol - character vector of gene symbols
expression - numeric vector of expression values
variable - character or factor vector with condition information
sample - character vector of sample IDs
geneset - character vector of interested genes (same nomenclature as symbol); if no geneset is supplied IQR analyses are performed based on all provided symbols
stoi <- stoichiometry( expression = data$value,
                          symbol = data$Symbol,
                          variable = data$variable, geneset = c("gene1", "gene2", "gene3", "gene4", "gene5"),
                          sample = data$name)
Use the output from the stoichiometry function as input for the plotting function for visualization.
stoi_plot(stoi)