這個(gè)軟件就是為了繪制網(wǎng)絡(luò)關(guān)系圖,圈圖等等酷炫的圖片,例如這樣:
一、配置環(huán)境和安裝
安裝Java 11

Java11安裝教程
無(wú)腦點(diǎn)擊安裝,我這里手動(dòng)改到安裝在D盤(pán),而非默認(rèn)的C盤(pán)
環(huán)境變量配置
進(jìn)入環(huán)境變量配置界面: 電腦->右鍵屬性->高級(jí)系統(tǒng)設(shè)置->環(huán)境變量
添加JAVA_HOME變量:

添加path變量的值:

打開(kāi)cmd界面,輸入java驗(yàn)證
二、安裝Cytoscape
官網(wǎng)下載不了,讓朋友發(fā)了我一個(gè)

安裝成功 打開(kāi):

三、繪圖
3.1 構(gòu)建輸入文件
其實(shí)這種網(wǎng)絡(luò)圖,要的就是一個(gè)邊EDGE,和節(jié)點(diǎn)node的信息(每列按tab分割符分割)
從pySCENIC的regulon打分矩陣中提取需要的信息:
regulons = [r.rename(r.name.replace('(+)','')) for r in regulons]
edge = [{r.name:list(r.gene2weight.items())} for r in regulons]
#尋找score最大的基因和得分
line = []
regulon_dict = dict()
for item in edge:
regulon = item.keys()
regulon = list(regulon)[0]
record = dict()
best_score = 0
for group in item[regulon]:
gene, score = group[0], group[1]
if score > best_score:
regulon_dict[regulon] = {gene:score}
best_score = score
#寫(xiě)入文件
with open('/share/nas1/Data/Users/luohb/Personalization/paper/07.Cytoscape/edge.tsv', 'w') as f:
f.write('regulons\tgene\tscore\n')
for item in regulon_dict.items():
regulon = item[0]
group = item[1]
gene, score = list(group.keys())[0], list(group.values())[0]
row = '{}\t{}\t{}\n'.format(regulon, gene, score)
f.writelines(row)
導(dǎo)入到R中篩選每個(gè)regulon的top10基因(Python有點(diǎn)麻煩)
edge<-read.table('edge.tsv', sep='\t',header=T)
top10.edge = edge %>% group_by(regulons) %>% top_n(n=10, wt = score)
write.table(top10.edge, file='top10.edge.tsv', sep='\t',quote=F, col.names=T,row.names=F)
文件1: EDGE文件:記錄 節(jié)點(diǎn)關(guān)系信息 和 邊的寬度信息

列的排列位置不重要,因?yàn)閷?dǎo)入到Cytoscape可以選擇

文件2: Node文件:記錄每個(gè)節(jié)點(diǎn)的分組信息(不同的分組顏色)


3.2 Cytoscape可視化
-
導(dǎo)入EDGE文件:
-
導(dǎo)入Node文件
參考
- http://manual.cytoscape.org/en/stable/Quick_Tour_of_Cytoscape.html
- http://www.360doc.com/content/18/0115/10/49059453_722035630.shtml
- http://www.itdecent.cn/p/c0730a5285d1
- https://github.com/cytoscape/cytoscape
- https://www.biowolf.cn/m/view.php?aid=405
- https://www.sohu.com/a/136756331_465960
- https://blog.csdn.net/mystrugglelife/article/details/79394775
- https://jingyan.baidu.com/article/19020a0af96b2e139d28428c.html




