開發(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)后毫目,我開始更加了解ggtree
與ggplot2
的底層設(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
,treeio
與MicrobiotaProcess
包進(jìn)行更新入客。主要是在tidytree
與MicrobiotaProcess
中引入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
可以將phyloseq
,SummarizedExperiment
,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)佣谐。