ggtreeExtra的開發(fā)及其在宏基因組上的應(yīng)用

開發(fā)ggtreeExtra的初衷

因?yàn)槲抑肮ぷ鞯臅r(shí)候主要是做微生物組學(xué)數(shù)據(jù)的分析工作碌嘀,工作中往往需要對(duì)這些數(shù)據(jù)進(jìn)行可視化以方便數(shù)據(jù)展示與解析穴豫,簡(jiǎn)單的可視化還好,有ggplot2就行了。然而,微生物組學(xué)數(shù)據(jù)分析中往往需要將相關(guān)的外部數(shù)據(jù)信息與進(jìn)化樹或者是物種層級(jí)樹聯(lián)系起來才能更好展示并解析相關(guān)結(jié)果董朝,而對(duì)于這樣的操作來說,目前的很多工具基本都難以使用干跛,除了ggtree子姜。因?yàn)樵撥浖^承了ggplot2的語(yǔ)法,所以只要用戶會(huì)ggplot2的語(yǔ)法楼入,也自然會(huì)使用ggtree哥捕。然而ggtree提供了geom_facet圖層(用來聯(lián)接進(jìn)化樹與外部數(shù)據(jù))不支持環(huán)形布局,一旦樹節(jié)點(diǎn)變多嘉熊,所生成的圖片就可能顯得很擁擠遥赚。所以,我問我老板阐肤,要不要開發(fā)一個(gè)可以兼容環(huán)形布局的進(jìn)化樹的功能凫佛,以此來節(jié)省空間方便多維數(shù)據(jù)的展示解析讲坎,這樣ggtree的應(yīng)用也會(huì)更廣。他欣然同意愧薛,并指點(diǎn)我可以參考ggtree中的gheatmap功能, 因?yàn)樵摴δ芤仓С汁h(huán)形布局晨炕,并且所開發(fā)功能得與geom_facet的功能相似,這樣才能有一個(gè)統(tǒng)一的語(yǔ)法從而方便用戶使用厚满。

ggtreeExtra開發(fā)時(shí)的主要問題解決

確定好這個(gè)小項(xiàng)目可以做之后府瞄,碰到的第一個(gè)問題就是如何才能將環(huán)形樹與外部圖層連接起來,而且必需使用ggplot2的語(yǔ)法碘箍。因?yàn)樵谶@之前遵馆,我為了更為深入了解ggplot2的架構(gòu),在去年疫情時(shí)按著老板的gglayer開發(fā)了ggstar丰榴。有了這個(gè)基礎(chǔ)后货邓,我開始了解到ggplot2圖層的一些抽象思維。不同的圖層疊加組合往往可以得到更豐富的結(jié)果四濒。我開始注意到ggtree繪制進(jìn)化樹圖層時(shí)换况,是事先對(duì)樹結(jié)構(gòu)進(jìn)行解析將節(jié)點(diǎn)轉(zhuǎn)換成坐標(biāo)進(jìn)而用線條連接。如果打完進(jìn)化樹圖層后盗蟆,再直接用ggplot2的圖層疊加會(huì)發(fā)現(xiàn)戈二,這個(gè)圖層與樹圖層往往會(huì)重疊。所以在某一天回家的路上喳资,我突然想到如果這個(gè)疊加的圖層可以平移不就可以了觉吭?于是,第一個(gè)問題開始變?yōu)槿绾纹揭漂B加的圖層仆邓?我開始返回去看gheatmap的功能鲜滩,突然發(fā)現(xiàn)該功能也是類似的思想,就是給熱圖圖層加一個(gè)數(shù)值节值,讓其從原來的位置跑到進(jìn)化樹外部徙硅,但是操作起來很麻煩。我又返回去看ggplot2的源代碼搞疗,發(fā)現(xiàn)圖層位置其實(shí)就是通過Position對(duì)象來確定的嗓蘑。于是乎開始實(shí)現(xiàn)各種圖層的Position對(duì)象(因?yàn)椴煌膱D層可能會(huì)有不同的Position對(duì)象)。開發(fā)后初步測(cè)試(將原來的圖層中的position換成我開發(fā)的position功能), 發(fā)現(xiàn)確實(shí)可以工作匿乃。然而桩皿,當(dāng)樹的數(shù)據(jù)與外部數(shù)據(jù)不是同一個(gè)數(shù)量級(jí)時(shí),就可能導(dǎo)致要么進(jìn)化樹被壓縮要么是外部圖層扳埂。于是业簿,第二個(gè)難題出現(xiàn),對(duì)于這種不同數(shù)據(jù)級(jí)的進(jìn)化樹與外部數(shù)據(jù)要怎么操作才可能更好的展示阳懂?又是在回家的路上梅尤,我想到之前數(shù)據(jù)建模中柜思,在數(shù)據(jù)清洗階段,往往也會(huì)碰到這種不同的數(shù)量級(jí)的數(shù)據(jù)巷燥,而對(duì)于這種數(shù)據(jù)赡盘,我們可以采用將其標(biāo)準(zhǔn)化為某個(gè)區(qū)間,比如常用的0到1之間缰揪。這種標(biāo)準(zhǔn)化操作不會(huì)改變數(shù)據(jù)分布的陨享,所以第二個(gè)問題的解決方案就變成了將外部數(shù)據(jù)統(tǒng)一標(biāo)準(zhǔn)化為進(jìn)化樹的數(shù)據(jù)范圍同時(shí)保持原來的數(shù)據(jù)。因?yàn)橛兄暗幕A(chǔ)钝腺,所以這個(gè)問題也就很快搞定抛姑。后續(xù)的開發(fā)過程中也碰到一些難題,不過憑借著幾年經(jīng)驗(yàn)的積累最終還是被一一解決艳狐。而前面所列的主要兩個(gè)問題是這個(gè)工作的突破口定硝,所以單獨(dú)拿出來講下。

后續(xù)工作

有了ggtreeExtra的開發(fā)經(jīng)驗(yàn)后毫目,我開始更加了解ggtreeggplot2的底層設(shè)計(jì)思路蔬啡。我覺得我可以為ggtree的開發(fā)做點(diǎn)貢獻(xiàn)了。于是镀虐,我嘗試為ggtree的一些圖層功能(比如geom_hilight,geom_cladelab,geom_taxalink,geom_tiplab…)進(jìn)行更新箱蟆,主要是讓其更好的兼容圖形語(yǔ)法 (mapping aesthetics),從而更加方便地展示相關(guān)數(shù)據(jù)刮便。ggtree,ggtreeExtra都是通用的工具空猜,與ggplot2有相似的語(yǔ)法,對(duì)于輸入數(shù)據(jù)本質(zhì)上都是tidy data(每一行代表一個(gè)觀測(cè)值诺核,每一列代表一個(gè)變量), 這種數(shù)據(jù)結(jié)構(gòu)近幾年也在R語(yǔ)言社區(qū)中廣為流行抄肖,以Rstudio為代表的開發(fā)團(tuán)隊(duì)久信,開發(fā)了dplyr,tidyr, tibble, ggplot2, forcats, purrr等系列軟件包基本都是基于該數(shù)據(jù)結(jié)構(gòu)窖杀。結(jié)合我之前的微生物組學(xué)數(shù)據(jù)分析工作,最近裙士,我們也開始對(duì)tidytree,treeioMicrobiotaProcess包進(jìn)行更新入客。主要是在tidytreeMicrobiotaProcess中引入tidy framework,這樣用戶就可以使用dplyr接口進(jìn)行操作腿椎,同時(shí)MicrobiotaProcess中提供的mp_打頭的功能也是基于tidy framework的思想進(jìn)行開發(fā)的桌硫。目前相關(guān)開發(fā)工作基本完成,我們希望能夠提供一套統(tǒng)一的語(yǔ)法啃炸,方便用戶處理微生物組數(shù)據(jù)铆隘,降低用戶的學(xué)習(xí)成本。同時(shí)相關(guān)的方法學(xué)工作也可以基于此框架進(jìn)行開發(fā)南用,就像該包中提供的差異分析功能mp_diff_analysis也是基于此框架進(jìn)行開發(fā)的膀钠。MicrobiotaProcess還提供了銜接上游以及其他軟件包的接口掏湾,如as.MPSE可以將phyloseqSummarizedExperiment,TreeSummarizedExperiment轉(zhuǎn)為MPSE對(duì)象肿嘲,mp_import_metaphlan用于解析MetaPhlan3的輸出結(jié)果等融击。

<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">library(ggstar) library(ggplot2) library(forcats) library(ggtree) library(tidytree) library(ggtreeExtra) library(MicrobiotaProcess) </pre>

<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">`data(mouse.time.mpse)

MPSE 對(duì)象,繼承了 SummarizedExperiment 與 treedata 對(duì)象

以方便后續(xù)數(shù)據(jù)的處理操作雳窟,以及功能拓展尊浪。

在print的時(shí)候結(jié)合tibble的樣式對(duì)MPSE對(duì)象整理成tidy data展示

每一行代表一個(gè)OTU(特征)在每個(gè)樣本中的豐度信息,以及相應(yīng)的

樣本信息與物種分類信息封救。

mouse.time.mpse %<>%

稀釋抽平功能拇涤,有研究評(píng)估抽平對(duì)于微生物組數(shù)據(jù)有較好的魯棒性

mp_rrarefy(.abundance=Abundance) %>% 

默認(rèn)計(jì)算每個(gè)樣品中所有層級(jí)的物種相對(duì)豐度(relative=TRUE)

mp_cal_abundance(.abundance=RareAbundance) %>%

計(jì)算time分組下的每個(gè)組別的所有層級(jí)的物種相對(duì)豐度

mp_cal_abundance(.abundance=RareAbundance, .group=time)` </pre>
## The otutree is empty in the MPSE object!## The otutree is empty in the MPSE object!

<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"># 所得的結(jié)果存于SummarizedExperiment中的assays內(nèi) mouse.time.mpse </pre>

## # A MPSE-tibble (MPSE object) abstraction: 4,408 x 13## # OTU=232 | Samples=19 | Assays=Abundance, RareAbundance, RelRareAbundanceBySample | Taxanomy=Kingdom, Phylum, Class, Order, Family, Genus, Species##    OTU   Sample Abundance RareAbundance RelRareAbundanceB… time  Kingdom Phylum ##    <chr> <chr>      <int>         <int>              <dbl> <chr> <chr>   <chr>  ##  1 OTU_1 F3D0         579           214               8.50 Early k__Bac… p__Bac…##  2 OTU_1 F3D1         405           202               8.02 Early k__Bac… p__Bac…##  3 OTU_2 F3D0         345           116               4.61 Early k__Bac… p__Bac…##  4 OTU_2 F3D1         353           183               7.27 Early k__Bac… p__Bac…##  5 OTU_3 F3D0         449           179               7.11 Early k__Bac… p__Bac…##  6 OTU_3 F3D1         231           122               4.85 Early k__Bac… p__Bac…##  7 OTU_4 F3D0         430           167               6.63 Early k__Bac… p__Bac…##  8 OTU_4 F3D1          69            36               1.43 Early k__Bac… p__Bac…##  9 OTU_5 F3D0         154            54               2.14 Early k__Bac… p__Bac…## 10 OTU_5 F3D1         140            69               2.74 Early k__Bac… p__Bac…## # … with 4,398 more rows, and 5 more variables: Class <chr>, Order <chr>,## #   Family <chr>, Genus <chr>, Species <chr>

<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">`trda <- mouse.time.mpse %>%
mp_diff_analysis(.abundance=RelRareAbundanceBySample,
.group=time,
first.test.alpha=0.05)

默認(rèn)得到treedata對(duì)象(含有差異統(tǒng)計(jì)值以及每個(gè)樣本的物種相對(duì)豐度信息)

為了更好地展示associated data的數(shù)據(jù),tidytree最新版也將treedata對(duì)象整理成

tidy data格式進(jìn)行展示誉结。

associated data中的每一行代表樹結(jié)構(gòu)上的一個(gè)節(jié)點(diǎn)工育,前三列信息來著tree結(jié)構(gòu)

分別為節(jié)點(diǎn)Index,節(jié)點(diǎn)名稱以及是否為樹的端點(diǎn)搓彻,其他信息均為外部相關(guān)信息如绸。

trda` </pre>

## 'treedata' S4 object'.## ## ...@ phylo:## ## Phylogenetic tree with 232 tips and 218 internal nodes.## ## Tip labels:##   OTU_58, OTU_67, OTU_231, OTU_188, OTU_150, OTU_207, ...## Node labels:##   r__root, k__Bacteria, p__Actinobacteria, p__Bacteroidetes, p__Cyanobacteria, p__Deinococcus-Thermus, ...## ## Rooted; no branch lengths.## ## with the following features available:##  'nodeClass',    'nodeDepth',    'RareAbundanceBySample',    'RareAbundanceBytime',##  'LDAupper', 'LDAmean',  'LDAlower', 'Sign_time',    'pvalue',   'fdr'.## ## # The associated data tibble abstraction: 450 x 13## # The 'node', 'label' and 'isTip' are from the phylo tree.##     node label   isTip nodeClass nodeDepth RareAbundanceBySam… RareAbundanceByt…##    <dbl> <chr>   <lgl> <chr>         <dbl> <list>              <list>           ##  1     1 OTU_58  TRUE  OTU               8 <tibble [19 × 4]>   <tibble [2 × 3]> ##  2     2 OTU_67  TRUE  OTU               8 <tibble [19 × 4]>   <tibble [2 × 3]> ##  3     3 OTU_231 TRUE  OTU               8 <tibble [19 × 4]>   <tibble [2 × 3]> ##  4     4 OTU_188 TRUE  OTU               8 <tibble [19 × 4]>   <tibble [2 × 3]> ##  5     5 OTU_150 TRUE  OTU               8 <tibble [19 × 4]>   <tibble [2 × 3]> ##  6     6 OTU_207 TRUE  OTU               8 <tibble [19 × 4]>   <tibble [2 × 3]> ##  7     7 OTU_5   TRUE  OTU               8 <tibble [19 × 4]>   <tibble [2 × 3]> ##  8     8 OTU_80  TRUE  OTU               8 <tibble [19 × 4]>   <tibble [2 × 3]> ##  9     9 OTU_163 TRUE  OTU               8 <tibble [19 × 4]>   <tibble [2 × 3]> ## 10    10 OTU_1   TRUE  OTU               8 <tibble [19 × 4]>   <tibble [2 × 3]> ## # … with 440 more rows, and 6 more variables: LDAupper <dbl>, LDAmean <dbl>,## #   LDAlower <dbl>, Sign_time <chr>, pvalue <dbl>, fdr <dbl>

<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">`# 展開觀察樣本相對(duì)豐度信息列所含有的信息

tidy data 數(shù)據(jù)結(jié)構(gòu)中每一行的觀察值,可以是一系列樣本嵌套起來的結(jié)構(gòu)

如這里的RareAbudanceBySample就是每一行代表一個(gè)節(jié)點(diǎn)(物種)在所有樣本下的相對(duì)豐度以及計(jì)算

這個(gè)相對(duì)豐度所用的豐度信息旭贬,還含有每個(gè)樣本的分組信息怔接。

一般就用tidyr nest就可以對(duì)這些信息進(jìn)行折疊

該unnest是開發(fā)版tidytree (>=0.3.4.992)提供的

trda %>% unnest(RareAbundanceBySample)` </pre>

## # A tbl_df is returned for independent data analysis.## # A tibble: 8,531 x 16##     node label  isTip nodeClass nodeDepth Sample RareAbundance RelRareAbundance…##    <dbl> <chr>  <lgl> <chr>         <dbl> <chr>          <int>             <dbl>##  1     1 OTU_58 TRUE  OTU               8 F3D0               0                 0##  2     1 OTU_58 TRUE  OTU               8 F3D1               0                 0##  3     1 OTU_58 TRUE  OTU               8 F3D141             0                 0##  4     1 OTU_58 TRUE  OTU               8 F3D142             0                 0##  5     1 OTU_58 TRUE  OTU               8 F3D143             0                 0##  6     1 OTU_58 TRUE  OTU               8 F3D144             0                 0##  7     1 OTU_58 TRUE  OTU               8 F3D145             0                 0##  8     1 OTU_58 TRUE  OTU               8 F3D146             0                 0##  9     1 OTU_58 TRUE  OTU               8 F3D147             0                 0## 10     1 OTU_58 TRUE  OTU               8 F3D148             0                 0## # … with 8,521 more rows, and 8 more variables: time <chr>,## #   RareAbundanceBytime <list>, LDAupper <dbl>, LDAmean <dbl>, LDAlower <dbl>,## #   Sign_time <chr>, pvalue <dbl>, fdr <dbl>

<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;"># RareAbundanceBytime則是每個(gè)分組下的物種豐度信息 trda %>% unnest(RareAbundanceBytime) </pre>

## # A tbl_df is returned for independent data analysis.## # A tibble: 898 x 15##     node label isTip nodeClass nodeDepth RareAbundanceBy… time  RareAbundanceBy…##    <dbl> <chr> <lgl> <chr>         <dbl> <list>           <chr>            <int>##  1     1 OTU_… TRUE  OTU               8 <tibble [19 × 4… Early                0##  2     1 OTU_… TRUE  OTU               8 <tibble [19 × 4… Late                 0##  3     2 OTU_… TRUE  OTU               8 <tibble [19 × 4… Early               18##  4     2 OTU_… TRUE  OTU               8 <tibble [19 × 4… Late               113##  5     3 OTU_… TRUE  OTU               8 <tibble [19 × 4… Early                0##  6     3 OTU_… TRUE  OTU               8 <tibble [19 × 4… Late                 1##  7     4 OTU_… TRUE  OTU               8 <tibble [19 × 4… Early                3##  8     4 OTU_… TRUE  OTU               8 <tibble [19 × 4… Late                 7##  9     5 OTU_… TRUE  OTU               8 <tibble [19 × 4… Early                8## 10     5 OTU_… TRUE  OTU               8 <tibble [19 × 4… Late                 5## # … with 888 more rows, and 7 more variables: RelRareAbundanceBytime <dbl>,## #   LDAupper <dbl>, LDAmean <dbl>, LDAlower <dbl>, Sign_time <chr>,## #   pvalue <dbl>, fdr <dbl>

利用ggtree與ggtreeExtra進(jìn)行可視化

<pre data-tool="mdnice編輯器" style="margin: 10px 0px; padding: 0px; outline: 0px; max-width: 100%; box-sizing: border-box !important; overflow-wrap: break-word !important; color: rgb(0, 0, 0); font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; border-radius: 5px; box-shadow: rgba(0, 0, 0, 0.55) 0px 2px 10px;">`# p1 繪制內(nèi)部的環(huán)形進(jìn)化樹圖

td_filter 可以對(duì)plot data進(jìn)行操作 (td_filter(nodeClass == "Phylum")(p1$data))

p1 <- ggtree(
trda,
layout="radial",
size = 0.3
) +
geom_point(
data = td_filter(!isTip),
fill="white",
size=1,
shape=21
)

p2 繪制中間門水平的高亮圖層

p2 <- p1 +
geom_hilight(
data = td_filter(nodeClass == "Phylum"),
mapping = aes(node = node, fill = label)
)

p3 繪制外圈的點(diǎn)圖,用來展示不同OTU在每個(gè)樣本中的豐度信息

td_unnest 與 td_filter類似

p3 <- p2 +
ggnewscale::new_scale("fill") +
geom_fruit(
data = td_unnest(RareAbundanceBySample),
geom = geom_star,
mapping = aes(
x = fct_reorder(Sample, time, .fun=min),
size = RelRareAbundanceBySample,
fill = time,
subset = RelRareAbundanceBySample > 0
),
starshape = 13,
starstroke = 0.25,
offset = 0.04,
pwidth = 0.8,
grid.params = list(linetype=2)
) +
scale_size_continuous(
name="Relative Abundance (%)",
range = c(1, 3)
) +
scale_fill_manual(values=c("#1B9E77", "#D95F02"))

p4 繪制tip節(jié)點(diǎn)的名稱稀轨,為了更好地觀察扼脐,將其標(biāo)注在點(diǎn)圖外

p4 <- p3 + geom_tiplab(size=2, offset=7.2)

p5 繪制組間有差異的OTU的線性判別效應(yīng)值(log10(LDA))

p5 <- p4 +
ggnewscale::new_scale("fill") +
geom_fruit(
geom = geom_col,
mapping = aes(
x = LDAmean,
fill = Sign_time,
subset = !is.na(LDAmean)
),
orientation = "y",
offset = 0.3,
pwidth = 0.5,
axis.params = list(axis = "x",
title = "Log10(LDA)",
title.height = 0.01,
title.size = 2,
text.size = 1.8,
vjust = 1),
grid.params = list(linetype = 2)
)

p6 繪制所有分類水平中組間經(jīng)過kruskal.test(默認(rèn))檢驗(yàn)并進(jìn)行FDR校正的FDR值

p6 <- p5 +
ggnewscale::new_scale("size") +
geom_point(
data=td_filter(!is.na(fdr)),
mapping = aes(size = -log10(fdr),
fill = Sign_time,
),
shape = 21,
) +
scale_size_continuous(range=c(1, 3)) +
scale_fill_manual(values=c("#1B9E77", "#D95F02"))

p6 + theme(
legend.key.height = unit(0.3, "cm"),
legend.key.width = unit(0.3, "cm"),
legend.spacing.y = unit(0.02, "cm"),
legend.text = element_text(size = 7),
legend.title = element_text(size = 9),
)` </pre>

圖片

總結(jié)

ggtreeExtra順利見刊,但這不是終點(diǎn)奋刽。為了讓更多的用戶更好更快地處理相應(yīng)的數(shù)據(jù), 我們依然會(huì)繼續(xù)開發(fā)維護(hù)相應(yīng)的計(jì)算工具瓦侮,并形成一個(gè)統(tǒng)一(語(yǔ)法統(tǒng)一)開放(開源)的計(jì)算生態(tài),為科研社區(qū)的發(fā)展做點(diǎn)小貢獻(xiàn)佣谐。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末肚吏,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子狭魂,更是在濱河造成了極大的恐慌罚攀,老刑警劉巖,帶你破解...
    沈念sama閱讀 217,277評(píng)論 6 503
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件雌澄,死亡現(xiàn)場(chǎng)離奇詭異斋泄,居然都是意外死亡,警方通過查閱死者的電腦和手機(jī)镐牺,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 92,689評(píng)論 3 393
  • 文/潘曉璐 我一進(jìn)店門炫掐,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人睬涧,你說我怎么就攤上這事募胃∨娉” “怎么了?”我有些...
    開封第一講書人閱讀 163,624評(píng)論 0 353
  • 文/不壞的土叔 我叫張陵摔认,是天一觀的道長(zhǎng)逆皮。 經(jīng)常有香客問我,道長(zhǎng)参袱,這世上最難降的妖魔是什么电谣? 我笑而不...
    開封第一講書人閱讀 58,356評(píng)論 1 293
  • 正文 為了忘掉前任,我火速辦了婚禮抹蚀,結(jié)果婚禮上剿牺,老公的妹妹穿的比我還像新娘。我一直安慰自己环壤,他們只是感情好晒来,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,402評(píng)論 6 392
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著郑现,像睡著了一般湃崩。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發(fā)上接箫,一...
    開封第一講書人閱讀 51,292評(píng)論 1 301
  • 那天攒读,我揣著相機(jī)與錄音,去河邊找鬼辛友。 笑死薄扁,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的废累。 我是一名探鬼主播邓梅,決...
    沈念sama閱讀 40,135評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼邑滨!你這毒婦竟也來了日缨?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 38,992評(píng)論 0 275
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤驼修,失蹤者是張志新(化名)和其女友劉穎殿遂,沒想到半個(gè)月后诈铛,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體乙各,經(jīng)...
    沈念sama閱讀 45,429評(píng)論 1 314
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,636評(píng)論 3 334
  • 正文 我和宋清朗相戀三年幢竹,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了耳峦。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 39,785評(píng)論 1 348
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡焕毫,死狀恐怖蹲坷,靈堂內(nèi)的尸體忽然破棺而出驶乾,到底是詐尸還是另有隱情,我是刑警寧澤循签,帶...
    沈念sama閱讀 35,492評(píng)論 5 345
  • 正文 年R本政府宣布级乐,位于F島的核電站,受9級(jí)特大地震影響县匠,放射性物質(zhì)發(fā)生泄漏风科。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,092評(píng)論 3 328
  • 文/蒙蒙 一乞旦、第九天 我趴在偏房一處隱蔽的房頂上張望贼穆。 院中可真熱鬧,春花似錦兰粉、人聲如沸故痊。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,723評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)愕秫。三九已至,卻和暖如春焰络,著一層夾襖步出監(jiān)牢的瞬間豫领,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 32,858評(píng)論 1 269
  • 我被黑心中介騙來泰國(guó)打工舔琅, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留等恐,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 47,891評(píng)論 2 370
  • 正文 我出身青樓备蚓,卻偏偏與公主長(zhǎng)得像课蔬,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子郊尝,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,713評(píng)論 2 354

推薦閱讀更多精彩內(nèi)容