plotDiffCor: Scatter Plot of 2 Genes for Cases and Controls

Description Usage Arguments Value Author(s) References Examples

View source: R/plotDiffCor.R

Description

Scatter plot of 2 genes for cases and controls, superimposed with linear regression lines.

Usage

1
2
3
4
5
6
7
8
plotDiffCor(x1, 
	    z1, 
	    x0, 
	    z0, 
	    pval = NULL, 
	    xlab = "gene1", 
	    ylab = "gene2", 
	    title = "scatter plots") 

Arguments

x1

numeric. vector of gene expression for gene 1 for cases.

z1

numeric. vector of gene expression for gene 2 for cases.

x0

numeric. vector of gene expression for gene 1 for controls.

z0

numeric. vector of gene expression for gene 2 for controls.

pval

numeric. p-value for testing differential correlation of the 2 genes between cases and controls.

xlab

character. label for x-axis.

ylab

character. label for y-axis.

title

character. plot title.

Value

A list with 4 elments:

g

A ggplot2 object.

dat

a data frame with 3 variables: x, z, and grp.

coef1

a vector of length two giving the intercept and slope of linear regression for cases.

coef0

a vector of length two giving the intercept and slope of linear regression for controls.

Author(s)

Danyang Yu <dyu33@jhu.edu>, Weiliang Qiu <weiliang.qiu@gmail.com>

References

Danyang Yu, Zeyu Zhang, Kimberly Glass, Jessica Su, Dawn L. DeMeo, Kelan Tantisira, Scott T. Weiss, Weiliang Qiu(corresponding author). New Statistical Methods for Constructing Robust Differential Correlation Networks to characterize the interactions among microRNAs. Scientific Reports 9, Article number: 3499 (2019)

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
31
32
33
34
35
36
37
38
library(Biobase)
set.seed(1234567)
res = generate_data(n1 = 50, n2 = 60, p1 = 5, p2 = 50)
es = res$es
print(es)


# gene expression data
dat = exprs(es)
print(dim(dat))
print(dat[1:2,1:3])

# 3rd gene
x = dat[3,]
# 5th gene
z = dat[5,]

# for cases
x1 = x[which(es$grp == 1)]
z1 = z[which(es$grp == 1)]

# for controls
x0 = x[which(es$grp == 0)]
z0 = z[which(es$grp == 0)]

# st5
res2 = st5(x1 = x1, z1 = z1, x0 = x0, z0 = z0)
pval = res2$pval

plotDiffCor(x1 = x1, 
	    z1 = z1, 
	    x0 = x0, 
	    z0 = z0, 
	    pval = pval, 
	    xlab = "gene3", 
	    ylab = "gene5", 
	    title = "scatter plots" 
	    )

corTest documentation built on Nov. 16, 2020, 9:15 a.m.

Related to plotDiffCor in corTest...