使用R包 BioNERO
参考链接
现在假设已经通过转录组数据分析拿到了基因表达矩阵
表达矩阵行是基因列是样本,第一列是geneid
首先加载需要使用到的R包,读取数据
library(tidyverse)
library(BioNERO)
exp.dat<-read_tsv(“wgcna_example_exp.tsv”) %>%
column_to_rownames(“geneid”)
tfs.dat<-read_tsv(“tfs.genes.txt”)
还有一个数据是转录因子的geneid,第一列是基因,第二列是基因属于哪个转录因子家族。
数据过滤
final_exp <- exp_preprocess(
exp.dat,
min_exp = 10,
variance_filter = TRUE,
n = 2000
)
推断调节网络(一致性网络)
grn <- exp2grn(
exp = final_exp,
regulators = tfs.dat$Gene,
nTrees = 10
)
这一步需要的时间比较长,而且需要比较大的内存 (我自己的真实数据3万基因20个样本,12个小时了还没有算完,自己本地电脑占用内存显示到了17G)
三种不同的算法推断调节网络
genie3 <- grn_infer(
final_exp,
method = “genie3”,
regulators = zma.tfs$Gene,
nTrees = 10)
aracne <- grn_infer(final_exp, method = “aracne”, regulators = zma.tfs$Gene)
head(aracne)
clr <- grn_infer(final_exp, method = “clr”, regulators = zma.tfs$Gene)
或者3种方法一块算
grn_list <- grn_combined(final_exp, regulators = zma.tfs$Gene, nTrees = 10)
鉴定hub基因
hubs <- get_hubs_grn(grn)
可视化网络
plot_grn(grn)
图片
欢迎大家关注我的公众号
小明的数据分析笔记本
声明:来自小明的数据分析笔记本,仅代表创作者观点。链接:https://eyangzhen.com/7936.html