仙游哪里可以做网站的,18岁以上站长统计,iis新建网站无法浏览,seo网站推广软件1写在前面 好久没更了#xff0c;实在是太忙了#xff0c;值班真的是根本不不睡觉啊#xff0c;一忙一整天#xff0c;忙到怀疑人生。#x1f62d; 最近看到比较#x1f525;的就是ggkegg包#xff0c;感觉使用起来还是有一定难度的。#x1fae0; 和大家分享一下使用教… 1写在前面 好久没更了实在是太忙了值班真的是根本不不睡觉啊一忙一整天忙到怀疑人生。 最近看到比较的就是ggkegg包感觉使用起来还是有一定难度的。 和大家分享一下使用教程吧还有一些小坑。 2用到的包 rm(list ls())library(ggkegg)library(ggfx)library(ggraph)library(igraph)library(clusterProfiler)library(dplyr)library(tidygraph) 3小试牛刀 首先以eco00270为例获取后转换路径和eco标识符删除无连接节点并返回igraph对象。 g - ggkegg(pideco00270, convert_org c(pathway,eco), delete_zero_degree T, return_igraph T)gg - ggraph(g, layoutstress) gg$data$type %% unique()gg geom_edge_diagonal( aes(colorsubtype_name, filtertype!maplink)) geom_node_point( aes(filter !type%in%c(map,compound)), fillgg$data[!gg$data$type%in%c(map,compound),]$bgcolor, colorblack, shape21, size4 ) geom_node_point( aes(filter !type%in%c(map,gene)), fillgg$data[!gg$data$type%in%c(map,gene),]$bgcolor, colorblack, shape21, size6 ) geom_node_text( aes(labelconverted_name, filtertypegene), repelT, bg.colourwhite) theme_void() 4改变nodes颜色 颜狗必备技能修改配色。 g - pathway(ko00520)V(g)$color_one - colorRampPalette(RColorBrewer::brewer.pal(5,Set1))(length(V(g)))V(g)$color_two - colorRampPalette(RColorBrewer::brewer.pal(5,Set2))(length(V(g)))ggraph(g, xx, yy) geom_node_rect(aes(xminxmin, xmaxx, fillI(color_one)), alpha0.5) geom_node_rect(aes(xminx, xmaxxmax, fillI(color_two)), alpha0.5) ggfx::with_outer_glow(geom_node_text(aes(labelname %% strsplit(:) %% sapply([, 2) %% strsplit( ) %% sapply([, 1), filtertypeortholog), size2), colourwhite, expand1) V(g)$color_one - colorRampPalette(RColorBrewer::brewer.pal(5,Set1))(length(V(g)))V(g)$color_two - colorRampPalette(RColorBrewer::brewer.pal(5,Set2))(length(V(g)))V(g)$color_three - colorRampPalette(RColorBrewer::brewer.pal(5,PuOr))(length(V(g)))V(g)$color_four - colorRampPalette(RColorBrewer::brewer.pal(5,Paired))(length(V(g)))V(g)$space - V(g)$width/4ggraph(g, xx, yy) geom_node_rect(aes(xminxmin, xmaxxminspace, fillI(color_one), filtertypeortholog)) geom_node_rect(aes(xminxminspace, xmaxxmin2*space, fillI(color_two), filtertypeortholog)) geom_node_rect(aes(xminxmin2*space, xmaxxmin3*space, fillI(color_three), filtertypeortholog)) geom_node_rect(aes(xminxmin3*space, xmaxxmin4*space, fillI(color_four), filtertypeortholog)) ggfx::with_outer_glow(geom_node_text(aes(labelname %% strsplit(:) %% sapply([, 2) %% strsplit( ) %% sapply([, 1), filtertypeortholog), size2), colourwhite, expand1) theme_void() 5Global maps展示 更宏观的展示结果。 pathway(ko01200) %% process_reaction() %% activate(nodes) %% mutate(xNULL, yNULL, compconvert_id(compound)) %% mutate(degreecentrality_degree(modeall)) %%ggraph(layoutkk) geom_node_point(aes(colordegree, filtertypecompound)) geom_edge_parallel( colorgrey, end_capcircle(1,mm), start_capcircle(1,mm), arrowarrow(lengthunit(1,mm),typeclosed)) geom_node_text(aes(labelcomp,filterdegree15), repelTRUE, bg.colourwhite) theme_graph() 6highlight指定nodes和edges 可以使用highligh_set_edges和highlight_set_nodes函数突出你想要突出的nodes和edges。 pathway(ko01230) %% process_line() %% activate(nodes) %% mutate( compoundconvert_id(compound), M00002highlight_set_nodes(module(M00002)reaction_components)) %% activate(edges) %% mutate(M00002highlight_set_edges(module(M00002)definition_components)) %% ggraph(xx, yy) geom_edge_link() with_outer_glow(geom_edge_link(aes(colorM00002, filterM00002)), colourpink) geom_node_point(shape21,aes(filtertype!line)) with_outer_glow(geom_node_point(shape21, aes(filterM00002, colorM00002)), colourpink) geom_node_text(aes(labelcompound, filterM00002), repelTRUE, bg.colourwhite, size2) theme_void() 我们试着突出一下代谢相关pathwayko01100,需要用到M00021的module。 g - pathway(ko01100) %% process_line() %% highlight_module(module(M00021)) %% mutate(compoundconvert_id(compound))g %% ggraph(xx, yy) geom_node_point(size1, aes(colorI(fgcolor), filterfgcolor!none type!line)) geom_edge_link(width0.1, aes(colorI(fgcolor), filtertypeline fgcolor!none)) with_outer_glow( geom_edge_link(width1, aes(colorI(fgcolor), filterfgcolor!none M00021)), colourred, expand3 ) with_outer_glow( geom_node_point(size2, aes(colorI(fgcolor), filterfgcolor!none M00021)), colourred, expand3 ) theme_void() 可以看到多个module涉及Cysteine和methionine的代谢我们可以通过使用ggforce来高亮M00017。 list_of_modules - c(M00021,M00338,M00609,M00017,M00034,M00035,M00368)for (mm in list_of_modules) { g - g %% highlight_module(module(mm))}ggraph(g,xx,yy,layoutmanual) geom_edge_link0(width0.5, colorgrey) geom_edge_link(colorred,aes(filterM00017|M00021|M00338|M00609|M00034|M00035|M00368))geom_node_point(size2, colorred,aes(filterM00017|M00021|M00338|M00609|M00034|M00035|M00368)) ggforce::geom_mark_rect(aes(fillM00017, labelmodule(M00017)name, xx, yy, groupM00017, filterM00017), label.fill transparent, label.fontsize 10, expandunit(1,mm)) theme_void() 可视化一下compounds可以用geom_node_text,ggrepel, 和shadowtext。 Rg %% ggraph(xx, yy) geom_node_point(size1, aes(colorI(fgcolor), filterfgcolor!none type!line)) geom_edge_link(width0.1, aes(colorI(fgcolor), filtertypeline fgcolor!none)) with_outer_glow( geom_edge_link(width1, aes(colorI(fgcolor), filterfgcolor!none M00021)), colourred, expand3 ) with_outer_glow( geom_node_point(size2, aes(colorI(fgcolor), filterfgcolor!none M00021)), colourred, expand3 ) geom_node_text(aes(labelcompound, filterM00021), repelT, bg.colourwhite, size5) theme_void() 局部放大一下~ annot - g %% ggraph(xx, yy) with_outer_glow( geom_edge_link(width1, aes(colorI(fgcolor), filterfgcolor!none M00021)), colourred, expand3 ) with_outer_glow( geom_node_point(size2, aes(colorI(fgcolor), filterfgcolor!none M00021)), colourred, expand3 ) geom_node_text(aes(labelcompound, filterM00021), repelTRUE, bg.colourwhite, size5)g %% ggraph(xx, yy) geom_node_point(size1, aes(colorI(fgcolor), filterfgcolor!none type!line)) geom_edge_link(width0.1, aes(colorI(fgcolor), filtertypeline fgcolor!none)) with_outer_glow( geom_edge_link(width1, aes(colorI(fgcolor), filterfgcolor!none M00021)), colourred, expand3 ) with_outer_glow( geom_node_point(size2, aes(colorI(fgcolor), filterfgcolor!none M00021)), colourred, expand3 ) annotation_custom(ggplotify::as.grob(annot), ymin-1500, ymax0, xmin0, xmax1500) theme_void() 最后祝大家早日不卷!~ 点个在看吧各位~ ✐.ɴɪᴄᴇ ᴅᴀʏ 〰 往期精彩 LASSO | 不来看看怎么美化你的LASSO结果吗 chatPDF | 别再自己读文献了让chatGPT来帮你读吧~ WGCNA | 值得你深入学习的生信分析方法~ ComplexHeatmap | 颜狗写的高颜值热图代码 ComplexHeatmap | 你的热图注释还挤在一起看不清吗 Google | 谷歌翻译崩了我们怎么办附完美解决方案 scRNA-seq | 吐血整理的单细胞入门教程 NetworkD3 | 让我们一起画个动态的桑基图吧~ RColorBrewer | 再多的配色也能轻松搞定~ rms | 批量完成你的线性回归 CMplot | 完美复刻Nature上的曼哈顿图 Network | 高颜值动态网络可视化工具 boxjitter | 完美复刻Nature上的高颜值统计图 linkET | 完美解决ggcor安装失败方案附教程 ...... 本文由 mdnice 多平台发布