试读生信

MEGENA结果解读

2021-11-14  本文已影响0人  小潤澤

前言

在之前的文章MEGENA原理已经介绍了MEGENA的基本原理,那么基于示例数据本文来解读一下MEGENA的结果

示例数据

rm(list = ls()) # rm R working space

library(MEGENA)

# input parameters
n.cores <- 1; # number of cores/threads to call for PCP
doPar <-F; # do we want to parallelize?
method = "pearson" # method for correlation. either pearson or spearman. 
FDR.cutoff = 0.05 # FDR threshold to define significant correlations upon shuffling samples. 
module.pval = 0.05 # module significance p-value. Recommended is 0.05. 
hub.pval = 0.05 # connectivity significance p-value based random tetrahedral networks
cor.perm = 10; # number of permutations for calculating FDRs for all correlation pairs. 
hub.perm = 100; # number of permutations for calculating connectivity significance p-value. 

# annotation to be done on the downstream
annot.table=NULL
id.col = 1
symbol.col= 2
###########

data(Sample_Expression) # load toy example data

ijw <- calculate.correlation(datExpr,doPerm = cor.perm,output.corTable = FALSE,output.permFDR = FALSE)


##### calculate PFN
el <- calculate.PFN(ijw[,1:3],doPar = doPar,num.cores = n.cores,keep.track = FALSE)

g <- graph.data.frame(el,directed = FALSE)

##### perform MCA clustering.
MEGENA.output <- do.MEGENA(g,
                           mod.pval = module.pval,hub.pval = hub.pval,remove.unsig = TRUE,
                           min.size = 10,max.size = vcount(g)/2,
                           doPar = doPar,num.cores = n.cores,n.perm = hub.perm,
                           save.output = FALSE)

###### unregister cores as these are not needed anymore.
summary.output <- MEGENA.ModuleSummary(MEGENA.output,
                                       mod.pvalue = module.pval,hub.pvalue = hub.pval,
                                       min.size = 10,max.size = vcount(g)/2,
                                       annot.table = annot.table,id.col = id.col,symbol.col = symbol.col,
                                       output.sig = TRUE)

最终summary.output:

1. summary.output$modules summary.output

可以把聚类的sub-cluster对应的基因获取到

2. summary.output$module.table

summary.output$module.table

可以把每个sub-cluster的hub gene(度比较大的基因)获取到

将sub-cluster的基因导入Cytoscape

由原理我们知道,基因之间的权重关系是由gene pair之间的相关性体现的,而Cytoscape的基本输入是node from,node to和weight
所以我们只需要在PFN网络中筛选出相应的sub-cluster的基因即可
el:


sub_cluster <- summary.output$modules$c1_2

df1 = el[el[,1] %in% sub_cluster,]
df2 = df1[df1[,2] %in% sub_cluster,]

然后将df2写入txt,导入Cytoscape即可

上一篇 下一篇

猜你喜欢

热点阅读