RLowPC: Relevance low order partial correlation

Description Usage Arguments Details Value References Examples

View source: R/RLowPC.R

Description

Relevance low order partial correlation (RLowPC) is an improved version of partial correlation (PC)[1, 2]. Instead of removing all remained controls for pair-wise PC calculation, RLowPC selects and regresses the the most relevant controls. See Details.

Usage

1
2
RLowPC(data.exp, edgelist, method = "pearson", pc.estimator = "shrink",
  progressbar = T)

Arguments

data.exp

gene expression matrix. Columns are variables and rows are samples.

edgelist

edge list. First column are the name of regulators, second coloumn are the target genes and the third column are the edge weights.

method

a character string to indicate which method is used to calculate correlation. Options are "pearson", "spearman" and "kendall". If pc.estimator="shrink", the method is set to "pearson" since there are no "spearman" and "kendall" options for the function pcor.shrink to estimate shrink PC.

pc.estimator

a character string to indicate the estimator used to calculate the PC for each pair of nodes in the edge list. Options are "shrink" and "pc", correspoinding to the item (c) and (d) in Details: Step 2, respectively.

progressbar

logical. If TRUE, a progressbar will show to indicate the code runing percentage.

Details

In general cases, the PC for a pair of genes is calculated by removing all the remained genes (controls). However, there may be a number of inrrelevant controls involved in the removed genes that do not truely connect to the pair of genes. We developed a RLowPC method to calculate PC by only removing more revelant controls. The method is used to refine a pre-inferred network structure by reducing the indirect edges that have been predicted as direct.

Step 1: Input a proper size of pre-inferred network, which has room to be improved, for search space of indirect edges. For example the top weighted edges in a inferred PC network can be used as search space. Each pair of genes are assumed to connect to their most relevant neighbour genes since the connecting edges are all top ranked in the whole network.

Step 2: Calculate relevance low order partial correlation. For each pair of genes connected by an edge in the searching space, the edge weight is redefined as (a) zero order PC (correlation) if they do not connect to the same set of neighbour genes, (b) PC by removing all the shared neighbours simultaneously and (c) shrink PC if the covariance matrix used to estimate PC in (b) is not positive definite or invertible. If the searching space is very large, there might still be a number of irrelevant controls involved in shrink PC procedure in (c). An alternative is (d) deleting less connected neighbour genes until the covariance matrix in (b) is positive definite and invertible.

Value

RLowPC regurns a new edge list with an additional column of RLowPC edge weights.

References

1. Markowetz F, Spang R: Inferring cellular networks-a review. BMC Bioinformatics 2007, 8 Suppl 6:S5.

2. Sch\"afer J, Strimmer K: A Shrinkage Approach to Large-Scale Covariance Matrix Estimation and Implications for Functional Genomics. Statistical Applications

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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
##load library
library(RLowPC)
library(corpcor)
##load data
data(gnwdata)
data.exp<-gnwdata$size100$ts1[1:63,]
genes<-colnames(data.exp)[-c(1:3)]
##load reference network
ref.edge<-gnwdata$size100$net1
ref.edge[,3]<-1
ref.adj<-edgelist2adjmatrix(edgelist = ref.edge,genes = genes,directed = F)


##filter low expressed genes
data2anova<-data.frame(time=factor(paste0(data.exp$experiment,'_',data.exp$time)),data.exp[,-c(1:3)])
data.new<-anova2de(data.exp = data2anova,ncol.idx =1,model = 'expression~time',pval.cut = 0.01)
data.exp<-data.new$de.ts
genes<-data.new$de.gene
ref.adj<-ref.adj[genes,genes]

##infer correlation network
inf.cor<-abs(cor(data.exp))
diag(inf.cor)<-0
##infer PC network
inf.pcor<-abs(pcor.shrink(data.exp)[1:length(genes),1:length(genes)])
diag(inf.pcor)<-0

##infer LowPC
inf.LowPC.edge<-LowPC(data.exp,cutoff = 0.01,cutat='pval')
if(is.null(inf.LowPC.edge$secondPC)){
  inf.LowPC<-ref.adj*0 } else {
    inf.LowPC<-edgelist2adjmatrix(inf.LowPC.edge$secondPC[,1:3],genes = genes,directed = F)
  }

##inf RLowPC
reduction.sapce<-na.omit(adjmatrix2edgelist(adjmatrix = inf.pcor,directed = F,order = T)[1:1000,])
inf.RLowPC.edge<-RLowPC(data.exp = data.exp,edgelist = reduction.sapce,
                        method = 'pearson',pc.estimator = 'shrink')
inf.RLowPC.edge$cor.weight<-abs(inf.RLowPC.edge$cor.weight)
inf.RLowPC<-edgelist2adjmatrix(inf.RLowPC.edge[,c(1,2,4)],genes = genes,directed = T)
inf.RLowPC<-abs(inf.RLowPC)
inf.RLowPC<-pmax(inf.RLowPC,t(inf.RLowPC))

##infer first order PC based on reduction sapce
###first PC
inf.firstPC.edge<-firstPC(data.exp = data.exp,edgelist = reduction.sapce,
                          method = 'pearson',controlist = NULL)
inf.firstPC<-edgelist2adjmatrix(inf.firstPC.edge[,1:3],genes = genes,directed = F)
###second PC
inf.secondPC.edge<-secondPC(data.exp = data.exp,edgelist = reduction.sapce,
                            method = 'pearson',controlist = NULL)
inf.secondPC<-edgelist2adjmatrix(inf.secondPC.edge[,1:3],genes = genes,directed = F)
##Put the inferred networks into a list.
inf.list<-list(Cor=inf.cor,PC=inf.pcor,LowPC=inf.LowPC,firstPC=inf.firstPC,
               secondPC=inf.secondPC,RLowPC=inf.RLowPC)
sapply(inf.list,dim)
dim(ref.adj)
##calculate confusion table
inf.table<-lapply(inf.list,function(x) table.evaluate(x,ref.adj = ref.adj))
##cut the tables at top 1000 predictions
inf.table<-lapply(inf.table,function(x) table.cut(input.table = x)$table.output)

##plot the figure
x11()
plotAUC(table.methods = inf.table,
        roc.lim = c(0,1,0,1),
        pr.lim = c(0,1,0,0.4),
        top.precision.lim = c(0,700,0,0.4),
        fpr.precision.lim = c(0,1,0,0.4),
        color = c('blue','purple','green','lightblue','red','yellow'),
        lwd=1,fill = T)

wyguo/RLowPC documentation built on May 28, 2017, 7:34 a.m.