plot_stratified_model: Plot stratified model results

Description Usage Arguments Value Examples

View source: R/plot_stratified_model.R

Description

Create several plots to show interaction data TF expression with target gene interaction using a linear model

log2(RNA target) ~ log2(TF)

to samples with highest DNAm values (top 25 percent) and lowest DNAm values (bottom 25 percent), separately.

Usage

1
2
3
4
5
6
7
8
9
plot_stratified_model(
  triplet.results,
  dnam,
  exp,
  metadata,
  label.dnam = "beta-value",
  label.exp = "expression",
  tf.activity.es = NULL
)

Arguments

triplet.results

Output from function stratified_model with Region ID, TF (column name: TF), and target gene (column name: target), p-values and estimates of interaction

dnam

DNA methylation matrix or SummarizedExperiment object (columns: samples same order as met, rows: regions/probes)

exp

A gene expression matrix or SummarizedExperiment object (columns: samples same order as met, rows: genes)

metadata

A data frame with samples as rownames and one columns that will be used to color the samples

label.dnam

Used for label text. Option "beta-value" and "residuals"

label.exp

Used for label text. Option "expression" and "residuals"

tf.activity.es

A matrix with normalized enrichment scores for each TF across all samples to be used in linear models instead of TF gene expression.

Value

A ggplot object, includes a table with results from fitting stratified model, and the following scatter plots: 1) TF vs DNAm, 2) Target vs DNAm, 3) Target vs TF, 4) Target vs TF for samples in Q1 and Q4 for DNA methylation, 5) Target vs DNAm for samples in Q1 and Q4 for the TF

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
library(dplyr)
dnam <- runif(20,min = 0,max = 1) %>%
  matrix(ncol = 1) %>%  t
rownames(dnam) <- c("chr3:203727581-203728580")
colnames(dnam) <- paste0("Samples",1:20)

exp.target <-  runif(20,min = 0,max = 10) %>%
  matrix(ncol = 1) %>%  t
rownames(exp.target) <- c("ENSG00000232886")
colnames(exp.target) <- paste0("Samples",1:20)

exp.tf <- runif(20,min = 0,max = 10) %>%
  matrix(ncol = 1) %>%  t
rownames(exp.tf) <- c("ENSG00000232888")
colnames(exp.tf) <- paste0("Samples",1:20)

exp <- rbind(exp.tf, exp.target)

triplet <- data.frame(
   "regionID" =  c("chr3:203727581-203728580"),
   "target" = "ENSG00000232886",
   "TF" = "ENSG00000232888"
)

results <- stratified_model(triplet = triplet,dnam = dnam, exp = exp)
plots <- plot_stratified_model(
    triplet.results = results,
    dnam = dnam,
    exp = exp
)

MethReg documentation built on Nov. 8, 2020, 8:01 p.m.