├── latex ├── after_body.tex ├── before_body.tex └── preamble.tex ├── data-backup ├── reroot │ └── tree_nodes.newick ├── tree_example_april2015 │ ├── pan.png │ ├── info.png │ ├── myplot.pdf │ ├── res_genes.png │ ├── blocks.csv │ ├── blocks.txt │ ├── tree_examples.txt │ ├── bar.csv │ ├── res_genes.csv │ ├── tree.nwk │ └── info.csv ├── phylopic │ ├── 67144c22-93c2-4dc0-ba13-9f9dd2d223b9.256.png │ ├── 7133ab33-cc79-4d7c-9656-48717359abb4.256.png │ ├── b8aa577b-ac0c-490b-8fae-1ad9a70076c4.256.png │ ├── c089caae-43ef-4e4e-bf26-973dd4cb65c5.256.png │ ├── d9af529d-e426-4c7a-922a-562d57a7872e.256.png │ └── f06b4dd0-094e-4f37-9105-25fdb4eb1b02.256.png ├── tree_boots.nwk ├── microreact │ └── README.md ├── inode_data.csv ├── tree.nwk ├── tip_data.csv ├── RMI.phy_phyml_tree_rooted_labeled.txt ├── difftax_tab.csv ├── long-branch-example.newick ├── svl.csv ├── HPV58.tree ├── tree.nex ├── anole.tre ├── Tree 30.4.19.nwk ├── HMP_tree │ ├── hmptree.nwk │ └── barplot_attr.csv └── sequence.fasta ├── book-cover.png ├── img ├── codeml.png ├── phyldog.png ├── phylomoji.png ├── phylopic.png ├── apple_emoji.pdf ├── apple_emoji.png ├── blackboard.jpg ├── fan_layout.gif ├── rotate_tree.gif ├── apple_emoji2.png ├── ggtree-plotly.gif ├── ggtree_objects.png ├── rotate_clade.gif ├── treeio-diagram.pdf ├── treeio-diagram.png ├── data-tree-emojim.png ├── ggtree-identify.gif ├── phangorn_example.png ├── phylomoji-ggtree.png ├── ggtree_objects_v2.png ├── phylobase_example.png ├── phylomoji-ggtree-circular.png ├── Screenshot_2019-06-24_ggtree-jupyter.png └── apple_emoji.svg ├── cache-objs ├── rotl-tree.rds └── ladderize-example.rds ├── 9781032233574_cover_review.png ├── B-references.Rmd ├── treedata-book.Rproj ├── css └── style.css ├── ggtree-identity.Rmd ├── .gitignore ├── session-info.Rmd ├── export_pdf.R ├── conflicted.R ├── README.md ├── _bookdown.yml ├── ggtree-comicR.Rmd ├── _output.yaml ├── setup-git-branches.md ├── software-info.Rmd ├── publications.md ├── Makefile ├── software-info.md ├── ggtree-plotly.Rmd ├── setup.R ├── 00_author.Rmd ├── mind-map.R ├── software-link.R ├── book-cover.R ├── Introduction.Rmd ├── hdvips.def ├── 11_ggtree_exts-others.Rmd ├── A-app-fig-tab.Rmd ├── index.Rmd ├── A-app-tools.Rmd ├── others.md └── 13_ggtree_gallery.Rmd /latex/after_body.tex: -------------------------------------------------------------------------------- 1 | \backmatter 2 | \printindex 3 | -------------------------------------------------------------------------------- /data-backup/reroot/tree_nodes.newick: -------------------------------------------------------------------------------- 1 | ((C,D)1,(A,(B,X)3)2,E); 2 | -------------------------------------------------------------------------------- /book-cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/book-cover.png -------------------------------------------------------------------------------- /img/codeml.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/codeml.png -------------------------------------------------------------------------------- /img/phyldog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/phyldog.png -------------------------------------------------------------------------------- /img/phylomoji.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/phylomoji.png -------------------------------------------------------------------------------- /img/phylopic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/phylopic.png -------------------------------------------------------------------------------- /img/apple_emoji.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/apple_emoji.pdf -------------------------------------------------------------------------------- /img/apple_emoji.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/apple_emoji.png -------------------------------------------------------------------------------- /img/blackboard.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/blackboard.jpg -------------------------------------------------------------------------------- /img/fan_layout.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/fan_layout.gif -------------------------------------------------------------------------------- /img/rotate_tree.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/rotate_tree.gif -------------------------------------------------------------------------------- /img/apple_emoji2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/apple_emoji2.png -------------------------------------------------------------------------------- /img/ggtree-plotly.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/ggtree-plotly.gif -------------------------------------------------------------------------------- /img/ggtree_objects.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/ggtree_objects.png -------------------------------------------------------------------------------- /img/rotate_clade.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/rotate_clade.gif -------------------------------------------------------------------------------- /img/treeio-diagram.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/treeio-diagram.pdf -------------------------------------------------------------------------------- /img/treeio-diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/treeio-diagram.png -------------------------------------------------------------------------------- /cache-objs/rotl-tree.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/cache-objs/rotl-tree.rds -------------------------------------------------------------------------------- /img/data-tree-emojim.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/data-tree-emojim.png -------------------------------------------------------------------------------- /img/ggtree-identify.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/ggtree-identify.gif -------------------------------------------------------------------------------- /img/phangorn_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/phangorn_example.png -------------------------------------------------------------------------------- /img/phylomoji-ggtree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/phylomoji-ggtree.png -------------------------------------------------------------------------------- /img/ggtree_objects_v2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/ggtree_objects_v2.png -------------------------------------------------------------------------------- /img/phylobase_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/phylobase_example.png -------------------------------------------------------------------------------- /9781032233574_cover_review.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/9781032233574_cover_review.png -------------------------------------------------------------------------------- /B-references.Rmd: -------------------------------------------------------------------------------- 1 | \printindex 2 | \backmatter 3 | 4 | \newpage 5 | 6 | # References {-} 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /cache-objs/ladderize-example.rds: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/cache-objs/ladderize-example.rds -------------------------------------------------------------------------------- /img/phylomoji-ggtree-circular.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/phylomoji-ggtree-circular.png -------------------------------------------------------------------------------- /data-backup/tree_example_april2015/pan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/data-backup/tree_example_april2015/pan.png -------------------------------------------------------------------------------- /data-backup/tree_example_april2015/info.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/data-backup/tree_example_april2015/info.png -------------------------------------------------------------------------------- /img/Screenshot_2019-06-24_ggtree-jupyter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/img/Screenshot_2019-06-24_ggtree-jupyter.png -------------------------------------------------------------------------------- /data-backup/tree_example_april2015/myplot.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/data-backup/tree_example_april2015/myplot.pdf -------------------------------------------------------------------------------- /data-backup/tree_example_april2015/res_genes.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/data-backup/tree_example_april2015/res_genes.png -------------------------------------------------------------------------------- /data-backup/phylopic/67144c22-93c2-4dc0-ba13-9f9dd2d223b9.256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/data-backup/phylopic/67144c22-93c2-4dc0-ba13-9f9dd2d223b9.256.png -------------------------------------------------------------------------------- /data-backup/phylopic/7133ab33-cc79-4d7c-9656-48717359abb4.256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/data-backup/phylopic/7133ab33-cc79-4d7c-9656-48717359abb4.256.png -------------------------------------------------------------------------------- /data-backup/phylopic/b8aa577b-ac0c-490b-8fae-1ad9a70076c4.256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/data-backup/phylopic/b8aa577b-ac0c-490b-8fae-1ad9a70076c4.256.png -------------------------------------------------------------------------------- /data-backup/phylopic/c089caae-43ef-4e4e-bf26-973dd4cb65c5.256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/data-backup/phylopic/c089caae-43ef-4e4e-bf26-973dd4cb65c5.256.png -------------------------------------------------------------------------------- /data-backup/phylopic/d9af529d-e426-4c7a-922a-562d57a7872e.256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/data-backup/phylopic/d9af529d-e426-4c7a-922a-562d57a7872e.256.png -------------------------------------------------------------------------------- /data-backup/phylopic/f06b4dd0-094e-4f37-9105-25fdb4eb1b02.256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/YuLab-SMU/treedata-book/HEAD/data-backup/phylopic/f06b4dd0-094e-4f37-9105-25fdb4eb1b02.256.png -------------------------------------------------------------------------------- /data-backup/tree_boots.nwk: -------------------------------------------------------------------------------- 1 | (((Rangifer_tarandus:1, Cervus_elaphus:1)Cervidae:1[98], (Bos_taurus:1, Ovis_orientalis:1)Bovidae:1[99])Artiodactyla:1[92], (Suricata_suricatta:2, (Cystophora_cristata:1,Mephitis_mephitis:1)Caniformia:1[98])Carnivora:1[96])Mammalia; -------------------------------------------------------------------------------- /data-backup/tree_example_april2015/blocks.csv: -------------------------------------------------------------------------------- 1 | id,start,stop 30037_HCMC_2009,1,20000 DE0685_HCMC_2001,1.00E+06,1.50E+06 DE1140_HCMC_2002,3.00E+06,3.20E+06 EG0369_HCMC_2007,5.00E+05,8.00E+05 HUE20_HCMC_2009,3.40E+06,3.50E+06 HUE62_HCMC_2010,2.10E+06,2.40E+06 KH14_HCMC_2009,1.80E+06,2.00E+06 KH45_HCMC_2010,9.00E+05,1.50E+06 -------------------------------------------------------------------------------- /data-backup/tree_example_april2015/blocks.txt: -------------------------------------------------------------------------------- 1 | id start stop 30037_HCMC_2009 1 20000 DE0685_HCMC_2001 1.00E+06 1.50E+06 DE1140_HCMC_2002 3.00E+06 3.20E+06 EG0369_HCMC_2007 5.00E+05 8.00E+05 HUE20_HCMC_2009 3.40E+06 3.50E+06 HUE62_HCMC_2010 2.10E+06 2.40E+06 KH14_HCMC_2009 1.80E+06 2.00E+06 KH45_HCMC_2010 9.00E+05 1.50E+06 -------------------------------------------------------------------------------- /treedata-book.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: Default 4 | SaveWorkspace: Default 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: Sweave 13 | LaTeX: pdfLaTeX 14 | 15 | BuildType: Makefile 16 | -------------------------------------------------------------------------------- /data-backup/microreact/README.md: -------------------------------------------------------------------------------- 1 | The `dir` contains the datasets from https://microreact.org/ 2 | 3 | + [Candida_auris](https://microreact.org/project/Candidaauris) 4 | The original paper is from [here](https://doi.org/10.1128/mBio.03364-19). 5 | + [Salmonella_Typhi](https://microreact.org/project/styphi) 6 | The original paper is from [here](https://doi.org/10.1038/ng.3281). 7 | -------------------------------------------------------------------------------- /css/style.css: -------------------------------------------------------------------------------- 1 | p.caption { 2 | color: #777; 3 | margin-top: 10px; 4 | } 5 | p code { 6 | white-space: inherit; 7 | } 8 | pre { 9 | word-break: normal; 10 | word-wrap: normal; 11 | } 12 | pre code { 13 | white-space: inherit; 14 | } 15 | p.flushright { 16 | text-align: right; 17 | } 18 | blockquote > p:last-child { 19 | text-align: right; 20 | } 21 | blockquote > p:first-child { 22 | text-align: inherit; 23 | } 24 | -------------------------------------------------------------------------------- /ggtree-identity.Rmd: -------------------------------------------------------------------------------- 1 | (ref:ggtreeidentifyscap) Interactive phylogenetic tree using identify() method. 2 | 3 | (ref:ggtreeidentifycap) **Interactive phylogenetic tree using identify() method.** Highlighting, labelling and rotating clades are all supported. 4 | 5 | 6 | 7 | ```{r ggtreeidentify, out.width="100%", fig.cap="(ref:ggtreeidentifycap)", fig.scap="(ref:ggtreeidentifyscap)", echo=FALSE} 8 | knitr::include_graphics("img/ggtree-identify.gif") 9 | ``` 10 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | _bookdown_files 2 | treedata.Rmd 3 | *~ 4 | .Rproj.user 5 | treedata.log 6 | crc_cache 7 | crc_files 8 | crc.Rmd 9 | crc.html 10 | gh-pages 11 | treedata_cache 12 | treedata_files 13 | pdf 14 | treedata.html 15 | treedata.knit.md 16 | treedata.docx 17 | snapshop-2021-12-09 18 | snapshop-2021-11-16 19 | .Rhistory 20 | treedata.aux 21 | treedata.lof 22 | treedata-lot 23 | treedata.toc 24 | treedata.lot 25 | treedata.idx 26 | treedata.ilg 27 | treedata.ind 28 | *log 29 | -------------------------------------------------------------------------------- /session-info.Rmd: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Session Info {#session-info} 4 | 5 | The book was written using R Markdown and was compiled by `r CRANpkg("bookdown")` package. Here is the session information on the system on which this thesis was compiled: 6 | 7 | ```{r sessionInfo, echo=FALSE, cache=FALSE} 8 | ## options(width=90) 9 | devtools::session_info() 10 | if (FALSE) { 11 | sessionInfo() %>% capture.output %>% 12 | `[`(., -c(5:8)) %>% paste('\n') %>% cat 13 | } 14 | ## options(width=80) 15 | ``` 16 | 17 | -------------------------------------------------------------------------------- /data-backup/inode_data.csv: -------------------------------------------------------------------------------- 1 | newick_label,vernacularName,infoURL,rank,bootstrap,posterior 2 | Mammalia,Mammals,http://eol.org/pages/1642/overview,class,NA,NA 3 | Carnivora,Carnivores,http://eol.org/pages/7662/overview,order,96,0.89 4 | Caniformia,Dog-like,http://eol.org/pages/2849494/overview,suborder,98,0.93 5 | Bovidae,Bovids,http://eol.org/pages/7687/overview,family,99,0.95 6 | Cervidae,Cervids,http://eol.org/pages/7685/overview,family,98,0.96 7 | Artiodactyla,Even-toed ungulates,http://eol.org/pages/7678/overview,order,92,0.81 8 | -------------------------------------------------------------------------------- /latex/before_body.tex: -------------------------------------------------------------------------------- 1 | % you may need to leave a few empty pages before the dedication page 2 | 3 | %\cleardoublepage\newpage\thispagestyle{empty}\null 4 | %\cleardoublepage\newpage\thispagestyle{empty}\null 5 | %\cleardoublepage\newpage 6 | \thispagestyle{empty} 7 | 8 | \begin{center} 9 | To my son, 10 | 11 | without whom I should have finished this book two years earlier 12 | %\includegraphics{images/dedication.pdf} 13 | \end{center} 14 | 15 | \setlength{\abovedisplayskip}{-5pt} 16 | \setlength{\abovedisplayshortskip}{-5pt} 17 | -------------------------------------------------------------------------------- /export_pdf.R: -------------------------------------------------------------------------------- 1 | rmds <- list.files(pattern = ".Rmd") 2 | rmds <- rmds[rmds != "crc.Rmd"] 3 | rmds <- rmds[rmds != "index.Rmd"] 4 | 5 | system("cat index.Rmd > crc.Rmd") 6 | 7 | for (f in rmds) { 8 | cat("\n\n\n", file = "crc.Rmd", append=TRUE) 9 | cmd <- paste("cat", f, ">> crc.Rmd") 10 | system(cmd) 11 | } 12 | 13 | library(rmarkdown) 14 | library(pagedown) 15 | 16 | render("crc.Rmd", "book_crc") 17 | print("print to pdf") 18 | chrome_print('crc.html', timeout=10000) 19 | 20 | 21 | file.rename("crc.pdf", "docs/treedata.pdf") 22 | 23 | file.remove("crc.Rmd") 24 | file.remove("html.Rmd") 25 | 26 | print("done...") 27 | -------------------------------------------------------------------------------- /conflicted.R: -------------------------------------------------------------------------------- 1 | pacman::p_load(conflicted) 2 | 3 | conflict_prefer("expand", "ggtree") 4 | conflict_prefer("rotate", "ggtree") 5 | conflict_prefer("mask", "treeio") 6 | conflict_prefer("parent", "treeio") 7 | conflict_prefer("ancestor", "treeio") 8 | conflict_prefer("get.data", "treeio") 9 | conflict_prefer("drop.tip", "treeio") 10 | conflict_prefer("read.newick", "treeio") 11 | conflict_prefer("MRCA", "tidytree") 12 | 13 | conflict_prefer("filter", "dplyr") 14 | conflict_prefer("rename", "dplyr") 15 | conflict_prefer("collapse", "dplyr") 16 | conflict_prefer("intersect", "dplyr") 17 | conflict_prefer("union", "dplyr") 18 | conflict_prefer("slice", "dplyr") 19 | conflict_prefer("strsplit", "base") 20 | conflict_prefer("paste", "base") 21 | conflict_prefer("geom_errorbarh", "ggplot2") 22 | conflict_prefer("tax_table", "MicrobiotaProcess") 23 | 24 | conflict_prefer("as.data.frame", "BiocGenerics") 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Data Integration, Manipulation and Visualization of Phylogenetic Trees 2 | 3 | 4 | The book gives comprehensive overviews of phylogenetic tree data integration, manipulation and visualization using a suite of R packages, **tidytree**, **treeio**, **ggtree** and **ggtreeExtra**. The book has been published by [Chapman & Hall/CRC](https://www.routledge.com/Data-Integration-Manipulation-and-Visualization-of-Phylogenetic-Trees/Yu/p/book/9781032233574). You can also find it on [Amazon](https://www.amazon.com/Integration-Manipulation-Visualization-Phylogenetic-Computational-ebook/dp/B0B5NLZR1Z/). 5 | 6 | 7 | 8 |
9 | 10 |
11 | 12 | -------------------------------------------------------------------------------- /_bookdown.yml: -------------------------------------------------------------------------------- 1 | book_filename: "treedata" 2 | chapter_name: "Chapter " 3 | output_dir: gh-pages 4 | repo: https://github.com/YuLab-SMU/treedata-book 5 | delete_merged_file: true 6 | language: 7 | label: 8 | fig: "FIGURE " 9 | tab: "TABLE " 10 | ui: 11 | chapter_name: "Chapter " 12 | edit: "https://github.com/YuLab-SMU/treedata-book/edit/master/%s" 13 | rmd_files: ["index.Rmd", 14 | "00_author.Rmd", 15 | "01_treeio_importing_tree.Rmd", 16 | "02_tidytree.Rmd", 17 | "03_treeio_exporting_tree.Rmd", 18 | "04_ggtree_visualization.Rmd", 19 | "05_ggtree_annotation.Rmd", 20 | "06_ggtree_manipulation.Rmd", 21 | "07_ggtree_tree_with_data.Rmd", 22 | "08_ggtree_with_silhouette.Rmd", 23 | "09_ggtree_tree_objects.Rmd", 24 | "10_ggtree_exts.Rmd", 25 | "11_ggtree_exts-others.Rmd", 26 | "12_ggtree_utilities.Rmd", 27 | "13_ggtree_gallery.Rmd", 28 | "A-app-faq.Rmd", 29 | "A-app-tools.Rmd", 30 | "A-app-fig-tab.Rmd", 31 | "B-references.Rmd"] 32 | -------------------------------------------------------------------------------- /ggtree-comicR.Rmd: -------------------------------------------------------------------------------- 1 | ## Comic (xkcd-like) phylogenetic tree {#commicR} 2 | 3 | 4 | ```{r ggsvg, fig.show='hide'} 5 | library(htmltools) 6 | library(XML) 7 | library(gridSVG) 8 | library(ggplot2) 9 | library(ggtree) 10 | library(comicR) 11 | 12 | p <- ggtree(rtree(30), layout="circular") + 13 | geom_tiplab(aes(label=label), color="purple") 14 | print(p) 15 | svg <- grid.export(name="", res=100)$svg 16 | ``` 17 | 18 | (ref:comicRscap) Remove image background. 19 | 20 | (ref:comicRcap) **Remove image background.** Plotting silhouette images on phylogenetic tree without (A) and with (B) background remove. 21 | 22 | 23 | ```{r comicR} 24 | ## need to convert it to png or pdf for pdfbook 25 | tagList( 26 | tags$div( 27 | id = "ggtree_comic", 28 | tags$style("#ggtree_comic text {font-family:Chalkduster;}"), 29 | HTML(saveXML(svg)), 30 | comicR("#ggtree_comic", ff=5) 31 | ) 32 | ) # %>% html_print 33 | ``` 34 | -------------------------------------------------------------------------------- /_output.yaml: -------------------------------------------------------------------------------- 1 | bookdown::pdf_book: 2 | includes: 3 | in_header: latex/preamble.tex 4 | before_body: latex/before_body.tex 5 | after_body: latex/after_body.tex 6 | number_sections: yes 7 | fig_caption: yes 8 | fig_height: 3.8 9 | fig_width: 6.3 10 | keep_tex: yes 11 | keep_md: yes 12 | pandoc_args: --top-level-division=chapter 13 | dev: "cairo_pdf" 14 | latex_engine: xelatex 15 | citation_package: natbib 16 | template: null 17 | toc_depth: 3 18 | toc_unnumbered: no 19 | toc_appendix: yes 20 | quote_footer: ["\\VA{", "}{}"] 21 | highlight_bw: yes 22 | ui: 23 | chapter_name: "Chapter" 24 | bookdown::epub_book: 25 | stylesheet: css/style.css 26 | bookdown::gitbook: 27 | css: css/style.css 28 | config: 29 | toc: 30 | collapse: none 31 | download: [pdf, epub] 32 | edit: https://github.com/YuLab-SMU/treedata-book/edit/master/%s 33 | sharing: 34 | github: true 35 | facebook: false 36 | bookdown::bs4_book: 37 | dev: "svg" -------------------------------------------------------------------------------- /data-backup/tree_example_april2015/tree_examples.txt: -------------------------------------------------------------------------------- 1 | # SHIGELLA - R plotting 2 | 3 | # basic strain info 4 | v<-plotTree(tree="tree.nwk",ancestral.reconstruction=F,tip.colour.cex=1,cluster=T,tipColours=c("black","purple2","skyblue2","grey"),lwd=1,infoFile="info.csv",colourNodesBy="location",treeWidth=10,infoWidth=10,infoCols=c("name","location","year")) 5 | 6 | # pan genome heatmap 7 | v<-plotTree(tree="tree.nwk",heatmapData="pan.csv",ancestral.reconstruction=F,tip.colour.cex=1,cluster=T,tipColours=c("black","purple2","skyblue2","grey"),lwd=1,infoFile="info.csv",colourNodesBy="location",treeWidth=5,dataWidth=20,infoCols=NA) 8 | 9 | # curated genes, coloured 10 | v<-plotTree(tree="tree.nwk",heatmapData="res_genes.csv",ancestral.reconstruction=F,tip.colour.cex=1,cluster=F,heatmap.colours=c("white","grey","seagreen3","darkgreen","green","brown","tan","red","orange","pink","magenta","purple","blue","skyblue3","blue","skyblue2"),tipColours=c("black","purple2","skyblue2","grey"),lwd=1,infoFile="info.csv",colourNodesBy="location",treeWidth=10,dataWidth=10,infoCols=c("name","year"),infoWidth=8) -------------------------------------------------------------------------------- /data-backup/tree.nwk: -------------------------------------------------------------------------------- 1 | (((((((((((Phy000G05U_EMENI:0.451986,((Phy000GDP6_ASPNG:0.1209,Phy003AMS0_602072:0.0987718)0.99985:0.291259,Phy000FJDH_ASPFL:0.360311)0.985965:0.0482813)0.955419:0.0598141,(Phy000FCLK_ASPCL:0.22779,Phy000FQ5O_ASPFU:0.170269)0.99985:0.134498)0.99985:0.173404,(Phy003QBJJ_PENDI:0.183512,Phy003DGO9_PENCH:0.0985641)0.99985:0.603378)0.993843:0.140555,((Phy003BOHC_AJECA:0.911204,(Phy000PFY6_UNCRE:0.311286,Phy000IAZP_COCIM:0.186071)0.99985:0.393614)0.99985:0.291107,(Phy003PHXT_PENMQ:0.0918492,Phy003PVXT_TALSN:0.166689)0.99985:0.659075)0.998568:0.16495)0.99985:0.522657,(((Phy00201Y5_COCHE:0.163381,Phy0020GNV_PYRTR:0.0970357)0.99985:0.245847,Phy0044G80_PHANO:0.283161)0.99985:0.528345,Phy00208KX_MYCGR:1.44102)0.99985:0.366048)0.99985:0.428771,(Phy000HD5X_BOTFU:0.0491427,Phy000ODBJ_SCLSC:0.121984)0.99985:0.751838)0.99985:0.457222,Phy000B0HV_NEUCR:0.990537)0.991353:0.113714,((Phy003BKXA_GIBZE:0.247315,Phy003PZPF_FUSOX:0.080715)0.99985:0.678916,Phy0022J75_CRYPA:0.824262)0.976401:0.106342)0.72129:0.0396991,(Phy0043OCA_COLGM:0.480278,Phy0022OIS_VERA1:0.515005)0.99985:0.302607)0.99985:0.336031,Phy0043W64_36779:0.354123)0.99985:0.522727,Phy000KG2Q_MAGGR:0,Phy00443NV_MAGO7:0); 2 | -------------------------------------------------------------------------------- /setup-git-branches.md: -------------------------------------------------------------------------------- 1 | 2 | setup git branches: 3 | 4 | ## 把master重命名为all 5 | git checkout master 6 | git branch -m master all 7 | git push -u origin all 8 | 9 | ## 上github把master的default去掉,然后删掉github的master 10 | git push origin --delete master 11 | 12 | ## 重新创建master 13 | git checkout --orphan master 14 | 15 | ## 把不要的文件删掉,只留下源文件和一些必要的文件 16 | 17 | git add . 18 | git commit -m 'source files' 19 | git push -u origin master 20 | 21 | 22 | ## 删掉本地all branch 23 | 24 | git branch -d all 25 | 26 | 27 | ## 重新创建gh-pages 28 | git checkout --orphan gh-pages 29 | touch README.md 30 | git add . 31 | git commit -m 'readme' 32 | git push -u origin gh-pages 33 | 34 | git checkout master 35 | ## 创建gh-pages 36 | mkdir gh-pages 37 | ## 把当前文件夹所有内容,copy 到 gh-pages,等同于这个repo有两个copy 38 | 39 | ## 修改书的html输出到gh-pages文件夹中。 40 | ## 到gh-pages文件夹里,删掉其它的本地branch 41 | 42 | cp -R * gh-pages/ 43 | cd gh-pages 44 | git checkout gh-pages 45 | git branch -d master 46 | 47 | ## 到master中删掉gh-pages分支 48 | cd .. 49 | git branch -d gh-pages 50 | 51 | 52 | ## 这样子就有两个分支,分别在两个目录里,当前目录是master入源文件, 53 | ## gh-pages是gh-pages分支,放html输出。 54 | 55 | ## 把gh-pages目录放到master分支的gitignore中。 56 | echo 'gh-pages' >> .gitignore 57 | 58 | ## 然后就可以push到master,以及make生成书,然后到gh-pages里push到github中 59 | ## 这样书就分成了两个分支。 60 | 61 | -------------------------------------------------------------------------------- /data-backup/tip_data.csv: -------------------------------------------------------------------------------- 1 | Newick_label,vernacularName,imageURL,imageLicense,imageAuthor,infoURL,mass_in_kg,trophic_habit,ncbi_taxid,rank 2 | Rangifer_tarandus,Reindeer,http://media.eol.org/content/2012/06/13/00/48543_orig.jpg,CC-BY-SA,Alexandre Buisse (Nattfodd),http://eol.org/pages/328653/overview,109.09,herbivore,9870,species 3 | Cervus_elaphus,Red deer,http://media.eol.org/content/2014/09/16/00/20239_orig.jpg,CC-BY-SA,Sciadopitys,http://eol.org/pages/328649/overview,240.87,herbivore,9860,species 4 | Bos_taurus,Cattle,https://media.eol.org/content/2014/09/29/06/46535_orig.jpg,CC-BY-SA,Cynthia Sims Parr,http://eol.org/pages/328699/overview,618.64,herbivore,9913,species 5 | Ovis_orientalis,Asiatic mouflon,http://media.eol.org/content/2015/05/20/03/80720_orig.jpg,CC-BY-SA,Jšrg Hempel,http://eol.org/pages/311906/overview,39.1,herbivore,469796,species 6 | Suricata_suricatta,Meerkat,http://media.eol.org/content/2016/08/16/05/67138_orig.jpg,CC-BY-SA,Sara&Joachim,http://eol.org/pages/311580/overview,0.73,carnivore,37032,species 7 | Cystophora_cristata,Hooded seal,http://media.eol.org/content/2013/06/18/07/63362_orig.jpg,CC-BY-SA,"Ecomare, Salko de Wolf",http://eol.org/pages/328632/overview,278.9,omnivore,39293,species 8 | Mephitis_mephitis,Striped skunk,http://media.eol.org/content/2012/06/15/06/75234_orig.jpg,CC-BY,Kevin Bowman,http://eol.org/pages/328593/overview,2.4,omnivore,30548,species 9 | -------------------------------------------------------------------------------- /software-info.Rmd: -------------------------------------------------------------------------------- 1 | 2 | ## Software information and conventions {-} 3 | 4 | ```{r include=FALSE} 5 | #options(width = 30) 6 | 7 | source('conflicted.R') 8 | source("software-link.R") 9 | ``` 10 | 11 | The R and core packages information when compiling this book is as follows: 12 | 13 | ```{r tidy=FALSE, message=TRUE} 14 | R.version.string 15 | 16 | library(treedataverse) 17 | ``` 18 | 19 | The `r pkg_treedataverse` is a meta package to make it easy to install and load core packages for processing and visualizing tree with data using the packages described in this book. The installation guide for `r pkg_treedataverse` can be found in FAQ. 20 | 21 | The datasets used in this book have three sources: 22 | 23 | 1. Simulation data 24 | 2. Datasets in the R packages 25 | 3. Data downloaded from the Internet 26 | 27 | In order to make the data downloaded from the Internet more accessible, we packed the data in an R package, `r CRANpkg("TDbook")`, with detailed documentation of the original source, including URL, authors, and citation if the information is available. The `r CRANpkg("TDbook")` is available on CRAN and can be installed using `install.packages("TDbook")`. 28 | 29 | 30 | Package names in this book are formatted as bold text (*e.g.*, `r Biocpkg("ggtree")`), and function names are followed by parentheses (*e.g.*, `treeio::read.beast()`). The double-colon operator (`::`) means accessing an object from a package. 31 | 32 | -------------------------------------------------------------------------------- /publications.md: -------------------------------------------------------------------------------- 1 | \newpage 2 | 3 | # Publications of the `r Biocpkg("ggtree")` Package Suite 4 | 5 | > Note: ^\*^ Co-corresponding authors 6 | 7 | 1. S Xu, Z Dai, P Guo, X Fu, S Liu, L Zhou, W Tang, T Feng, M Chen, L Zhan, T Wu, E Hu, Y Jiang^\*^, X Bo^\*^, __G Yu__^\*^. ggtreeExtra: Compact visualization of richly annotated phylogenetic data. __*Molecular Biology and Evolution*__. 2021, 38(9):4039-4042. 8 | doi: [10.1093/molbev/msab166](https://doi.org/10.1093/molbev/msab166) 9 | 2. __G Yu__. Using ggtree to visualize data on tree-like structures. __*Current Protocols in Bioinformatics*__, 2020, 69:e96. doi: [10.1002/cpbi.96](https://doi.org/10.1002/cpbi.96) 10 | 3. LG Wang, TTY Lam, S Xu, Z Dai, L Zhou, T Feng, P Guo, CW Dunn, BR Jones, T Bradley, H Zhu, Y Guan, Y Jiang, __G Yu__^\*^. treeio: an R package for phylogenetic tree input and output with richly annotated and associated data. __*Molecular Biology and Evolution*__. 2020, 37(2):599-603. 11 | doi: [10.1093/molbev/msz240](http://dx.doi.org/10.1093/molbev/msz240) 12 | 4. __G Yu__^\*^, TTY Lam, H Zhu, Y Guan^\*^. Two methods for mapping and visualizing associated data on phylogeny using ggtree. __*Molecular Biology and Evolution*__. 2018, 35(2):3041-3043. 13 | doi: [10.1093/molbev/msy194](https://doi.org/10.1093/molbev/msy194) 14 | 5. __G Yu__, DK Smith, H Zhu, Y Guan, TTY Lam^\*^. ggtree: an R package for 15 | visualization and annotation of phylogenetic trees with their covariates and 16 | other associated data. __*Methods in Ecology and Evolution*__. 2017, 8(1):28-36. 17 | doi: [10.1111/2041-210X.12628](https://doi.org/10.1111/2041-210X.12628) 18 | 19 | -------------------------------------------------------------------------------- /latex/preamble.tex: -------------------------------------------------------------------------------- 1 | \usepackage{booktabs} 2 | \usepackage{longtable} 3 | \usepackage[bf,singlelinecheck=off]{caption} 4 | \captionsetup[table]{labelsep=space} 5 | \captionsetup[figure]{labelsep=space} 6 | \usepackage[scale=.8]{sourcecodepro} 7 | 8 | \usepackage{framed,color} 9 | \definecolor{shadecolor}{RGB}{248,248,248} 10 | 11 | \renewcommand{\textfraction}{0.05} 12 | \renewcommand{\topfraction}{0.8} 13 | \renewcommand{\bottomfraction}{0.8} 14 | \renewcommand{\floatpagefraction}{0.75} 15 | 16 | \renewenvironment{quote}{\begin{VF}}{\end{VF}} 17 | \let\oldhref\href 18 | \renewcommand{\href}[2]{#2\footnote{\url{#1}}} 19 | 20 | \makeatletter 21 | \newenvironment{kframe}{% 22 | \medskip{} 23 | \setlength{\fboxsep}{.8em} 24 | \def\at@end@of@kframe{}% 25 | \ifinner\ifhmode% 26 | \def\at@end@of@kframe{\end{minipage}}% 27 | \begin{minipage}{\columnwidth}% 28 | \fi\fi% 29 | \def\FrameCommand##1{\hskip\@totalleftmargin \hskip-\fboxsep 30 | \colorbox{shadecolor}{##1}\hskip-\fboxsep 31 | % There is no \\@totalrightmargin, so: 32 | \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}% 33 | \MakeFramed {\advance\hsize-\width 34 | \@totalleftmargin\z@ \linewidth\hsize 35 | \@setminipage}}% 36 | {\par\unskip\endMakeFramed% 37 | \at@end@of@kframe} 38 | \makeatother 39 | 40 | \renewenvironment{Shaded}{\begin{kframe}}{\end{kframe}} 41 | 42 | \usepackage{makeidx} 43 | \makeindex 44 | 45 | \urlstyle{tt} 46 | 47 | \usepackage{amsthm} 48 | \makeatletter 49 | \def\thm@space@setup{% 50 | \thm@preskip=8pt plus 2pt minus 4pt 51 | \thm@postskip=\thm@preskip 52 | } 53 | \makeatother 54 | 55 | \frontmatter 56 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | pdfbook: 3 | sed -i 's/gh-pages/pdf/g' _bookdown.yml;\ 4 | sed -i 's/colorlinks: true/colorlinks: false/g' index.Rmd;\ 5 | # Rscript -e 'library(bookdown); render_book("index.Rmd", pdf_book(keep_tex=TRUE))' 6 | Rscript -e 'library(bookdown); render_book("index.Rmd", "pdf_book")' 7 | 8 | bs4: 9 | rm -rf gh-pages/libs;\ 10 | sed -i 's/pdf/gh-pages/g' _bookdown.yml;\ 11 | sed -i 's/colorlinks: false/colorlinks: true/g' index.Rmd;\ 12 | Rscript -e 'library(bookdown); render_book("index.Rmd", "bs4_book")';\ 13 | sed -i 's/Chalkduster/Comic Sans MS/g' gh-pages/related-tools.html 14 | 15 | gitbook: 16 | rm -rf gh-pages/libs;\ 17 | Rscript -e 'library(bookdown); render_book("index.Rmd", "gitbook")';\ 18 | sed -i 's/Chalkduster/Comic Sans MS/g' gh-pages/related-tools.html 19 | 20 | ##pdf: 21 | ## pagedjs-cli ./gh-pages/index.html -o treedata-book.pdf 22 | 23 | 24 | latex: 25 | Rscript -e 'rmarkdown::pandoc_convert("treedata.knit.md", to = "latex", output = "treedata.tex", options = "--standalone")' 26 | 27 | epub: 28 | Rscript -e 'library(bookdown); render_book("index.Rmd", "epub_book")' 29 | 30 | word: 31 | Rscript -e 'library(bookdown); render_book("index.Rmd", "word_document2")';\ 32 | mv gh-pages/treedata.docx ./treedata.docx 33 | 34 | softwareinfo: 35 | Rscript -e 'rmarkdown::render("software-info.Rmd", rmarkdown::md_document(variant="gfm"))';\ 36 | sed -i 's/─//g' software-info.md;\ 37 | sed -i 's/✔//g' software-info.md 38 | 39 | clean: 40 | Rscript -e 'bookdown::clean_book()';\ 41 | rm -rf _bookdown_files 42 | 43 | cover: 44 | Rscript -e 'source("book-cover.R")' 45 | 46 | largeImg: 47 | ls -lhS gh-pages/treedata_files/figure-html | head 48 | 49 | publish: 50 | cd gh-pages;\ 51 | git add .;\ 52 | git commit -m 'update';\ 53 | git push -u origin gh-pages 54 | 55 | -------------------------------------------------------------------------------- /software-info.md: -------------------------------------------------------------------------------- 1 | ## Software information and conventions {-} 2 | 3 | The R and core packages information when compiling this book is as 4 | follows: 5 | 6 | ``` r 7 | R.version.string 8 | ``` 9 | 10 | ## [1] "R version 4.1.2 (2021-11-01)" 11 | 12 | ``` r 13 | library(treedataverse) 14 | ``` 15 | 16 | ## Attaching packages treedataverse 0.0.1 17 | 18 | ## ape 5.5 treeio 1.18.1 19 | ## dplyr 1.0.7 ggtree 3.2.1 20 | ## ggplot2 3.3.5 ggtreeExtra 1.4.1 21 | ## tidytree 0.3.6 22 | 23 | The [**treedataverse**](https://github.com/YuLab-SMU/treedataverse) is a 24 | meta package to make it easy to install and load core packages for 25 | processing and visualizing tree with data using the packages described 26 | in this book. The installation guide for 27 | [**treedataverse**](https://github.com/YuLab-SMU/treedataverse) can be 28 | found in FAQ. 29 | 30 | The datasets used in this book have three sources: 31 | 32 | 1. Simulation data 33 | 2. Datasets in the R packages 34 | 3. Data downloaded from the Internet 35 | 36 | In order to make the data downloaded from the Internet more accessible, 37 | we packed the data in an R package, 38 | [**TDbook**](https://CRAN.R-project.org/package=TDbook), with detailed 39 | documentation of the original source, including URL, authors, and 40 | citation if the information is available. The 41 | [**TDbook**](https://CRAN.R-project.org/package=TDbook) is available on 42 | CRAN and can be installed using `install.packages("TDbook")`. 43 | 44 | Package names in this book are formatted as bold text (*e.g.*, 45 | [**ggtree**](http://bioconductor.org/packages/ggtree)), and function 46 | names are followed by parentheses (*e.g.*, `treeio::read.beast()`). The 47 | double-colon operator (`::`) means accessing an object from a package. 48 | -------------------------------------------------------------------------------- /data-backup/RMI.phy_phyml_tree_rooted_labeled.txt: -------------------------------------------------------------------------------- 1 | ((Unifoliolatus:0.01356408,Subpinnatus:0.01387845)999:0.03185050,(((Spectabilis:0.00479723,(Australis:0.01185889,(Garcinii:0.01234754,Arabicus:0.00271635)992:0.00554744)714:0.00307324)500:0.00165009,(((Edulis:0.01401936,((Peregrinus:0.00000001,Ornithopodioides:0.00057372)997:0.00414993,(Villosus:0.00261277,(Cytisoides:0.00000004,(Drepanocarpus:0.00000003,Creticus:0.00057519)957:0.00172998)985:0.00261288)790:0.00197741)988:0.00701749)611:0.00226795,(Conjugatus:0.00970402,Maritimus:0.01774284)778:0.00411824)752:0.00305268,(Weilleri:0.00571527,(Eriosolen:0.00172763,(((Arenarius:0.00230230,Collinus:0.00000001)690:0.00057248,(Glaucus:0.00000001,Maroccanus:0.00000001)343:0.00000001)974:0.00230696,((Tenellus:0.00000001,(Emeroides:0.00000004,Kunkelii:0.00057252)272:0.00000001)726:0.00056895,(Campylocladus:0.00000007,(Dumetorum:0.00114880,(Hillebrandii:0.00000001,Spartioides:0.00000001)326:0.00000001)729:0.00114837)677:0.00115265)916:0.00173432)774:0.00057358)965:0.00309324)999:0.00976851)901:0.00385361)944:0.00836931,(((Halophilus:0.01283601,(Hispidus:0.00404270,(Castellanus:0.00000004,(Cruentus:0.00000001,(Palustris:0.00000006,Subbiflorus:0.00000002)71:0.00000005)230:0.00000004)966:0.00219381)999:0.02235103)178:0.00251625,(Pedunculatus:0.00191555,Uliginosus:0.00260807)999:0.00852384)228:0.00594936,(Conimbricensis:0.02624226,(Alpinus:0.00248718,(Mearnsii:0.00285526,(Tenuis:0.01094004,((Gebelia:0.00282885,Filicaulis:0.00166240)997:0.00627934,((Japonicus:0.00224690,(Krylovii:0.00055863,Burttii:0.00055945)557:0.00000005)955:0.00276325,((Corniculatus:0.00460601,Parviflorus:0.00612435)409:0.00178992,((Preslii:0.00000001,Angustissimus:0.00000001)742:0.00116511,(Baorbasii:0.00111793,Glinoides:0.00055855)835:0.00106967)311:0.00055818)52:0.00000003)214:0.00060761)207:0.00000005)304:0.00052635)890:0.00440634)997:0.01099405)668:0.00064045)499:0.00901187)999:0.03185050); 2 | -------------------------------------------------------------------------------- /ggtree-plotly.Rmd: -------------------------------------------------------------------------------- 1 | ## Convert a `ggtree` object to a `plotly` object {#plotly} 2 | 3 | One way to make a quick interactive phylogenetic tree is using `r Biocpkg("ggtree")` with the `r CRANpkg("plotly")` package. The [ggplotly()](https://plotly-r.com/improving-ggplotly.html) is able to convert `ggtree` object to a `plotly` object. Note that the `r Biocpkg("ggtree")` package also supports interactive manipulation of the phylogenetic tree via the [identify()](#identify) method. 4 | 5 | 6 | ```r 7 | # example from https://twitter.com/drandersgs/status/965996335882059776 8 | 9 | # LOAD LIBS --------------------------------------------------------------- 10 | library(ape) 11 | library(ggtree) 12 | library(plotly) 13 | # CREATE A TREE ------------------------------------------------------------- 14 | n_samples <- 20 15 | n_grp <- 4 16 | tree <- ape::rtree(n = n_samples) 17 | # CREATE SOME METADATA ---------------------------------------------------- 18 | id <- tree$tip.label 19 | set.seed(42) 20 | grp <- sample(LETTERS[1:n_grp], size = n_samples, replace = T) 21 | dat <- tibble::tibble(id = id, 22 | grp = grp) 23 | # PLOT THE TREE ----------------------------------------------------------- 24 | p1 <- ggtree(tree) 25 | metat <- p1$data %>% 26 | dplyr::inner_join(dat, c('label' = 'id')) 27 | p2 <- p1 + 28 | geom_point(data = metat, 29 | aes(x = x, 30 | y = y, 31 | colour = grp, 32 | label = id)) 33 | plotly::ggplotly(p2) 34 | ``` 35 | 36 | 37 | (ref:ggtreeplotlyscap) Interactive phylogenetic tree by combining ggtree with plotly. 38 | 39 | (ref:ggtreeplotlycap) **Interactive phylogenetic tree by combining ggtree with plotly.** 40 | 41 | 42 | 43 | ```{r ggtreeplotly, fig.cap="(ref:ggtreeplotlycap)", fig.scap="(ref:ggtreeplotlyscap)", echo=FALSE, out.width='100%'} 44 | knitr::include_graphics("img/ggtree-plotly.gif") 45 | ``` 46 | -------------------------------------------------------------------------------- /data-backup/difftax_tab.csv: -------------------------------------------------------------------------------- 1 | f,DIAGNOSIS,pvalue 2 | f__Ruminococcaceae,Healthy,1.51267065035054e-06 3 | c__Clostridia,Healthy,3.05838049063017e-06 4 | o__Clostridiales,Healthy,3.05838049063017e-06 5 | s__un_g__Faecalibacterium,Healthy,4.75087462907852e-06 6 | g__Faecalibacterium,Healthy,4.75329373881338e-06 7 | g__un_f__Ruminococcaceae,Healthy,1.69837255768906e-05 8 | s__un_f__Ruminococcaceae,Healthy,1.69837255768906e-05 9 | o__Coriobacteriales,Healthy,4.25456823627024e-05 10 | f__Coriobacteriaceae,Healthy,4.72583865107421e-05 11 | c__Fusobacteria (class),Tumor,4.76057216365154e-05 12 | f__Fusobacteriaceae,Tumor,4.76057216365154e-05 13 | o__Fusobacteriales,Tumor,4.76057216365154e-05 14 | p__Fusobacteria,Tumor,4.76057216365154e-05 15 | g__Fusobacterium,Tumor,0.000103448683078524 16 | f__Alcaligenaceae,Healthy,0.00012148100023334 17 | f__Lachnospiraceae,Healthy,0.000189840649798373 18 | f__Bacteroidaceae,Healthy,0.000228643348833595 19 | g__Bacteroides_f__Bacteroidaceae,Healthy,0.000228643348833595 20 | g__Sutterella,Healthy,0.000237311074736752 21 | p__Firmicutes,Healthy,0.000252107547230567 22 | s__un_g__Sutterella,Healthy,0.000265692855921201 23 | s__un_g__Fusobacterium,Tumor,0.000410314108015989 24 | s__un_g__Bacteroides,Healthy,0.000520931732075829 25 | o__Burkholderiales,Healthy,0.00116451786808939 26 | c__Epsilonproteobacteria,Tumor,0.00130732690640795 27 | f__Campylobacteraceae,Tumor,0.00130732690640795 28 | o__Campylobacterales,Tumor,0.00130732690640795 29 | g__Collinsella,Healthy,0.00135289251384375 30 | c__Betaproteobacteria,Healthy,0.00171691468792643 31 | s__un_g__Clostridium_g__Clostridium_f__Erysipelotrichaceae,Healthy,0.00198539462978982 32 | f__un_o__Clostridiales,Healthy,0.00199169046802336 33 | g__un_o__Clostridiales,Healthy,0.00199169046802336 34 | s__un_o__Clostridiales,Healthy,0.00199169046802336 35 | g__Campylobacter,Tumor,0.00211127741038884 36 | g__Parabacteroides,Healthy,0.00226737467018806 37 | f__Rikenellaceae,Healthy,0.0024517180612936 38 | -------------------------------------------------------------------------------- /setup.R: -------------------------------------------------------------------------------- 1 | if (!requireNamespace("pacman", quietly = TRUE)) { 2 | install.packages("pacman") 3 | } 4 | 5 | library(pacman) 6 | 7 | p_load(ape) 8 | p_load(Biostrings) 9 | ## p_load(OutbreakTools) 10 | p_load(igraph) 11 | p_load(phylobase) 12 | 13 | p_load(emojifont) 14 | p_load(ggplot2) 15 | p_load(dplyr) 16 | p_load(kableExtra) 17 | p_load(tidytree) 18 | p_load(treeio) 19 | p_load(ggtree) 20 | 21 | p_load(cowplot) 22 | p_load(patchwork) 23 | p_load(aplot) 24 | 25 | p_load(phytools) 26 | p_load(hexbin) 27 | p_load(TDbook) 28 | p_load(ggimage) 29 | p_load(phyloseq) 30 | p_load(treemap) 31 | p_load(ggtreeExtra) 32 | p_load(ggstar) 33 | p_load(MicrobiotaProcess) 34 | p_load(tanggle) 35 | p_load(gggenes) 36 | p_load(ggtext) 37 | p_load(ggbreak) 38 | p_load(rotl) 39 | p_load(gridSVG) 40 | p_load(data.tree) 41 | p_load(rsvg) 42 | 43 | source("conflicted.R") 44 | source("software-link.R") 45 | 46 | theme_set(theme_grey()) 47 | 48 | 49 | badge_version <- function(pkg, color="green") { 50 | v <- packageVersion(pkg) 51 | url <- paste0("https://github.com/YuLab-SMU/", pkg) 52 | badger::badge_custom(pkg, v, color, url) 53 | } 54 | 55 | 56 | ## based on https://bookdown.org/yihui/rmarkdown-cookbook/fig-process.html 57 | 58 | svg2png <- function(path, options) { 59 | if (!grepl('[.]svg$', path)) return(path) 60 | 61 | if (file.size(path)/1000000 < 1.2) { 62 | ## less than 1.2M 63 | return(path) 64 | } 65 | 66 | output <- sub(".svg$", ".png", path) 67 | system2("convert", paste("-density 150", path, output)) 68 | file.remove(path) 69 | return(output) 70 | } 71 | 72 | 73 | trim_fig <- function(path, options) { 74 | output <- sub(".png$", "-crop.png", path) 75 | system2("convert", paste("-trim", path, output)) 76 | file.remove(path) 77 | return(output) 78 | } 79 | 80 | squote <- function(string) { 81 | if (knitr::is_latex_output()) { 82 | left_quote_mark <- "`" 83 | } else { 84 | left_quote_mark <- "'" 85 | } 86 | 87 | right_quote_mark <- "'" 88 | 89 | fmt <- "%s%s%s" 90 | sprintf(fmt, left_quote_mark, string, right_quote_mark) 91 | } 92 | -------------------------------------------------------------------------------- /00_author.Rmd: -------------------------------------------------------------------------------- 1 | \newpage 2 | \frontmatter 3 | # About the Author {#author .unnumbered} 4 | 5 | **Guangchuang Yu** (https://yulab-smu.top) is a professor of Bioinformatics and director of the Department of Bioinformatics at Southern Medical University. He earned his Ph.D. from the School of Public Health, The University of Hong Kong. As an active R user, he has authored several R packages, such as `r CRANpkg("aplot")`, `r CRANpkg("badger")`, `r Biocpkg("ChIPseeker")`, `r Biocpkg("clusterProfiler")`, `r Biocpkg("DOSE")`, `r CRANpkg("emojifont")`, `r Biocpkg("enrichplot")`, `r CRANpkg("ggbreak")`, `r CRANpkg("ggfun")`, `r CRANpkg("ggimage")`, `r CRANpkg("ggplotify")`, `r Biocpkg("ggtree")`, `r Biocpkg("GOSemSim")`, `r CRANpkg("hexSticker")`, `r CRANpkg("meme")`, `r Biocpkg("meshes")`, `r CRANpkg("nCov2019")`, `r CRANpkg("plotbb")`, `r Biocpkg("ReactomePA")`, `r CRANpkg("scatterpie")`, `r CRANpkg("seqmagick")`, `r Biocpkg("seqcombo")`, `r CRANpkg("shadowtext")`, `r CRANpkg("tidytree")` and `r Biocpkg("treeio")`. He has supervised post-graduate students to develop a few other packages, including `r Biocpkg("ggmsa")`, `r Biocpkg("ggtreeExtra")`, `r Biocpkg("MicrobiomeProfiler")` and `r Biocpkg("MicrobiotaProcess")`. 6 | 7 | 8 | His research group aims to generate new insights into human health and disease through the development of new software tools and novel analysis of biomedical data. The software package developed by his research group helps biologists analyze data and reveal biological clues hidden in the data. 9 | 10 | 11 | He has published several journal articles, including 5 highly cited papers [@yu2012; @yu_dose_2015; @yu_chipseeker:_2015; @yu_reactomepa_2016; @yu_ggtree:_2017]. The articles have been cited more than 10,000 times. The ggtree [@yu_ggtree:_2017] paper was selected as a feature article to celebrate the 10^th^ anniversary of the launch of _Methods in Ecology and Evolution_^[10th Anniversary Volume 8: Phylogenetic tree visualization with multivariate data: ]. He was one of the 2020 Highly Cited Chinese Researchers (Elsevier-Scopus) in Biomedical Engineering. 12 | 13 | 14 | -------------------------------------------------------------------------------- /mind-map.R: -------------------------------------------------------------------------------- 1 | x=tibble::tribble(~x, ~y, 2 | 'a', 'a1', 3 | 'a', 'a2', 4 | 'a', 'a3', 5 | 'a', 'a4', 6 | 'a', 'a5', 7 | 'a1', 'b1', 8 | 'a1', 'b2', 9 | 'a1', 'b3', 10 | 'a1', 'b4', 11 | 'a2', 'c1', 12 | 'a2', 'c2', 13 | 'a2', 'c3', 14 | 'a2', 'c4', 15 | 'a3', 'd1', 16 | 'a3', 'd2', 17 | 'a3', 'd3', 18 | 'a4', 'e1', 19 | 'a4', 'e2', 20 | 'a5', 'f1', 21 | 'a5', 'f2', 22 | 'a5', 'f3') 23 | 24 | 25 | 26 | require(treeio) 27 | require(ggtree) 28 | 29 | f = function(n) { 30 | paste(sample(LETTERS,n, replace=T), collapse="") 31 | } 32 | 33 | n = sample(5:8, 7, replace=T) 34 | lab=sapply(n, f) 35 | names(lab) = letters[1:7] 36 | lab 37 | 38 | lab <- c('a' = '项目计划', 39 | 'a1' = '需求讨论', 40 | 'a2' = '讨论解决方案', 41 | 'a3' = '项目设计', 42 | 'a4' = '汇报讨论', 43 | 'a5' = '结果确认', 44 | 'b1' = '现状说明', 45 | 'b2' = '需求分析', 46 | 'b3' = '需求定义', 47 | 'b4' = '明确目标', 48 | 'c1' = '获取基本信息', 49 | 'c2' = '明确需求目标', 50 | 'c3' = '功能范围确认', 51 | 'c4' = '解决方案初步商讨', 52 | 'd1' = '解决方案', 53 | 'd2' = '实施计划', 54 | 'd3' = '原型设计', 55 | 'e1' = '解决方案汇报', 56 | 'e2' = '方案讨论', 57 | 'f1' = '目标明确', 58 | 'f2' = '范围确定', 59 | 'f3' = '方案可靠' 60 | ) 61 | y = as.phylo(x) 62 | 63 | require(tidytree) 64 | yy = as_tibble(y) %>% mutate(cat = ifelse(node %in% parent, 1, parent)) 65 | yy$cat[rootnode(y)] = 0 66 | 67 | ## http://www.bio-review.com/mind-mapping/ 68 | ggtree(as.treedata(yy), ladderize=F, layout='roundrect') + 69 | geom_nodelab(aes(x=x*.95, label=lab[label], 70 | fill=factor(cat)), hjust=1, geom='label') + 71 | geom_tiplab(aes(label=lab[label], fill=factor(cat)), geom='label') + 72 | scale_y_reverse() + 73 | hexpand(.2) + hexpand(.06, -1) + 74 | theme(legend.position = 'none') 75 | 76 | 77 | -------------------------------------------------------------------------------- /software-link.R: -------------------------------------------------------------------------------- 1 | 2 | pacman::p_load(yulab.utils) 3 | 4 | # pkg name in bold 5 | options("yulab.utils_pkgfmt" = '**%s**') 6 | 7 | pkg_archaeopteryx <- mypkg("Archaeopteryx", "https://sites.google.com/site/cmzmasek/home/software/archaeopteryx") 8 | pkg_astral <- mypkg("ASTRAL", "https://github.com/smirarab/ASTRAL") 9 | pkg_atv <- mypkg("ATV", "http://phylogeny.lirmm.fr/phylo_cgi/one_task.cgi?task_type=atv") 10 | pkg_baseml <- mypkg("BASEML", "http://abacus.gene.ucl.ac.uk/software/paml.html") 11 | pkg_beast <- mypkg("BEAST", "http://beast2.org/") 12 | pkg_codeml <- mypkg("CODEML", "http://abacus.gene.ucl.ac.uk/software/paml.html") 13 | pkg_devout <- mypkg("devout", "https://github.com/coolbutuseless/devout") 14 | pkg_epa <- mypkg("EPA", "http://sco.h-its.org/exelixis/web/software/epa/index.html") 15 | pkg_evolview <- mypkg("EvolView", "https://www.evolgenius.info/evolview/") 16 | pkg_figtree <- mypkg("FigTree", "http://beast.community/figtree") 17 | pkg_hyphy <- mypkg("HyPhy", "https://veg.github.io/hyphy-site/") 18 | pkg_itol <- mypkg("iTOL", "https://itol.embl.de/") 19 | pkg_mega <- mypkg("MEGA", "https://www.megasoftware.net/") 20 | pkg_mothur <- mypkg("mothur", "http://mothur.org/") 21 | pkg_mrbayes <- mypkg("MrBayes", "http://nbisweden.github.io/MrBayes/") 22 | pkg_paml <- mypkg("PAML", "http://abacus.gene.ucl.ac.uk/software/paml.html") 23 | pkg_paup <- mypkg("PAUP\\*", "https://paup.phylosolutions.com/") 24 | pkg_phyldog <- mypkg("PHYLDOG", "http://pbil.univ-lyon1.fr/software/phyldog/") 25 | pkg_phylip <- mypkg("PHYLIP", "https://evolution.genetics.washington.edu/phylip.html") 26 | pkg_phyloch <- mypkg("PHYLOCH", "http://www.christophheibl.de/Rpackages.html") 27 | pkg_phyml <- mypkg("PhyML", "http://www.atgc-montpellier.fr/phyml/") 28 | pkg_pplacer <- mypkg("PPLACER", "http://matsen.fhcrc.org/pplacer/") 29 | pkg_pyrotagger <- mypkg("PyroTagger", "http://pyrotagger.jgi-psf.org/") 30 | pkg_qiime <- mypkg("QIIME", "http://qiime.org/") 31 | pkg_r8s <- mypkg("r8s", "http://loco.biosci.arizona.edu/r8s/") 32 | pkg_raxml <- mypkg("RAxML", "http://evomics.org/learning/phylogenetics/raxml/") 33 | pkg_revbayes <- mypkg("RevBayes", "http://revbayes.github.io/intro.html") 34 | pkg_treedataverse <- mypkg("treedataverse", "https://github.com/YuLab-SMU/treedataverse") 35 | pkg_treedyn <- mypkg("TreeDyn", "http://www.treedyn.org/") 36 | pkg_treeview <- mypkg("TreeView", "http://en.bio-soft.net/tree/TreeView.html") -------------------------------------------------------------------------------- /data-backup/long-branch-example.newick: -------------------------------------------------------------------------------- 1 | ((((((((((((1:0.0019495867,2:0.0018235031)100:0.0011969927,(3:0.002127256,4:0.0017653282)100:0.0009607227)81:0.0007800209,(5:0.0020609633,6:0.0015594842)100:0.0014696957)99:0.00076205103,(7:0.00103844,8:0.00090185576)100:0.004002927)71:0.00052354374,((((9:0.0005960867,10:0.00029718556)100:0.0021998067,11:0.0017635386)49:0.00032220557,12:0.002093067)100:0.0026289858,((13:0.00030378695,14:0.0004093477)100:0.0020059645,15:0.001714428)100:0.0035134256)88:0.0010869319)47:0.00044896273,((16:0.00089676643,17:0.00091339916)100:0.0012717035,(18:0.00058965845,19:0.00077034876)100:0.0019610838)100:0.003681053)100:0.000986163,((20:0.0017197495,21:0.002026437)100:0.0021111318,(22:0.0014789673,23:0.001172614)100:0.0033353607)100:0.0010296783)75:0.00046172284,((((((24:0.0011399257,25:0.0010135229)100:0.0028160322,26:0.002061178)89:0.00074120885,(27:0.0020872736,28:0.002363772)65:0.00048745636)78:0.00047038822,29:0.0031853558)100:0.0010860511,(((30:0.001801027,31:0.0017156169)50:0.00043764967,(32:0.0019378961,33:0.0018494674)75:0.0005115647)86:0.0008589981,34:0.0031367077)100:0.0010175441)100:0.0011168303,((((35:0.0014192878,36:0.00171504)71:0.00045325398,37:0.0013418088)100:0.0018567514,38:0.0027288173)100:0.0009646732,(39:0.001189804,40:0.0011016381)100:0.0035758137)94:0.00063564494)49:0.00043702923)99:0.00076586666,(((((((41:0.0016199668,42:0.0021672894)98:0.0011483912,(43:0.0020666104,44:0.0020453448)66:0.0008078704)100:0.0008597766,45:0.0020089832)63:0.0004861389,(46:0.001844409,47:0.0015979814)100:0.0008071767)63:0.0004452633,(((48:0.0022112913,49:0.001554472)97:0.0006460188,50:0.0017128587)33:0.00049529294,((51:0.0016750101,52:0.0020238631)97:0.0006743917,(53:0.0019474783,54:0.0021088324)56:0.0005045439)36:0.00047344062)39:0.00039581355)93:0.0006986046,((55:0.0011095047,56:0.0008730135)52:0.00050178525,57:0.0018560977)100:0.00268682)93:0.0006230792,(58:0.00020127192,59:0.0011574014)100:0.0031308904)100:0.0014613273)91:0.00072693784,((((60:0.0008727719,61:0.0013847539)94:0.00042951023,62:0.001326798)35:0.0002063098,63:0.0012339546)46:0.00032965123,((64:0.0016134583,65:0.0015117446)80:0.0006614659,(66:0.0012233815,67:0.0015928008)80:0.0005838249)88:0.0005176356)100:0.0036002458)94:0.0012113276,((((68:0.0024613454,69:0.0004856562)100:0.0017308649,70:0.0029311234)86:0.0007909904,(71:0.00084207306,72:0.0009942316)100:0.0029447847)99:0.0010581666,(73:0.003773614,74:0.002541475)100:0.0030124304)100:0.0012545331)99:0.008205896,(75:0.027509606,76:0.093684964)99:0.00022178098); 2 | -------------------------------------------------------------------------------- /data-backup/svl.csv: -------------------------------------------------------------------------------- 1 | species,svl 2 | ahli,4.039125443 3 | alayoni,3.815704818 4 | alfaroi,3.526654599 5 | aliniger,4.036556538 6 | allisoni,4.375390078 7 | allogus,4.040138442 8 | altitudinalis,3.842994419 9 | alumina,3.588940722 10 | alutaceus,3.554890814 11 | angusticeps,3.788595498 12 | argenteolus,3.971307363 13 | argillaceus,3.757868992 14 | armouri,4.121684075 15 | bahorucoensis,3.827445029 16 | baleatus,5.05305601 17 | baracoae,5.042779747 18 | barahonae,5.076957937 19 | barbatus,5.003946306 20 | barbouri,3.663931948 21 | bartschi,4.280547466 22 | bremeri,4.113370744 23 | breslini,4.051110808 24 | brevirostris,3.874154977 25 | caudalis,3.911742966 26 | centralis,3.697941213 27 | chamaeleonides,5.04234927 28 | chlorocyanus,4.275448057 29 | christophei,3.884651809 30 | clivicola,3.758726128 31 | coelestinus,4.297965447 32 | confusus,3.938442349 33 | cooki,4.091535064 34 | cristatellus,4.189820018 35 | cupeyalensis,3.462013706 36 | cuvieri,4.875011919 37 | cyanopleurus,3.630161001 38 | cybotes,4.210982161 39 | darlingtoni,4.302036009 40 | distichus,3.928795837 41 | dolichocephalus,3.908550316 42 | equestris,5.113993807 43 | etheridgei,3.657990601 44 | eugenegrahami,4.128504414 45 | evermanni,4.165605231 46 | fowleri,4.288779949 47 | garmani,4.769473237 48 | grahami,4.154274265 49 | guafe,3.87745744 50 | guamuhaya,5.036952602 51 | guazuma,3.76388385 52 | gundlachi,4.18810472 53 | haetianus,4.316542212 54 | hendersoni,3.859834574 55 | homolechis,4.032805981 56 | imias,4.099687407 57 | inexpectatus,3.537438641 58 | insolitus,3.80047052 59 | isolepis,3.657087744 60 | jubar,3.952604971 61 | krugi,3.886500048 62 | lineatopus,4.128611788 63 | longitibialis,4.242103429 64 | loysiana,3.701240244 65 | lucius,4.198914766 66 | luteogularis,5.101085197 67 | macilentus,3.715764783 68 | marcanoi,4.079484699 69 | marron,3.831810283 70 | mestrei,3.987147344 71 | monticola,3.770613039 72 | noblei,5.083472618 73 | occultus,3.663048694 74 | olssoni,3.79389884 75 | opalinus,3.838376465 76 | ophiolepis,3.637962029 77 | oporinus,3.845669505 78 | paternus,3.802961204 79 | placidus,3.773967107 80 | poncensis,3.820377531 81 | porcatus,4.258990989 82 | porcus,5.038034268 83 | pulchellus,3.799022266 84 | pumilis,3.46686027 85 | quadriocellifer,3.901619072 86 | reconditus,4.482606994 87 | ricordii,5.013963084 88 | rubribarbus,4.078469213 89 | sagrei,4.067161768 90 | semilineatus,3.696630586 91 | sheplani,3.682924257 92 | shrevei,3.983003234 93 | singularis,4.057997494 94 | smallwoodi,5.035095592 95 | strahmi,4.274271278 96 | stratulus,3.869880695 97 | valencienni,4.321524401 98 | vanidicus,3.62620586 99 | vermiculatus,4.802849398 100 | websteri,3.916546094 101 | whitemani,4.097478535 102 | -------------------------------------------------------------------------------- /book-cover.R: -------------------------------------------------------------------------------- 1 | require(tidyr) 2 | require(ggplot2) 3 | require(ggtree) 4 | require(grid) 5 | 6 | oldwd <- getwd() 7 | setwd("~/github/plotting_tree_with_data/plotTree/tree_example_april2015/") 8 | info <- read.csv("info.csv") 9 | tree <- read.tree("tree.nwk") 10 | 11 | ##tp <- tree$tip.label 12 | 13 | ## set.seed(2018-04-10) 14 | ## tree=rtree(230) 15 | ## tree$tip.label <- tp 16 | 17 | heatmap.colours=c("steelblue","grey","seagreen3","darkgreen","green","brown","tan", "red", 18 | "orange","pink","magenta","purple","blue","skyblue3","blue","skyblue2") 19 | names(heatmap.colours) <- 0:15 20 | heatmapData=read.csv("res_genes.csv", row.names=1) 21 | 22 | rn <- rownames(heatmapData) 23 | heatmapData <- as.data.frame(sapply(heatmapData, as.character)) 24 | 25 | rownames(heatmapData) <- rn 26 | 27 | cols <- c(HCMC='black', Hue='purple2', KH='skyblue2') 28 | p <- ggtree(tree, layout='circular', size=.1) %<+% info + theme(legend.position='none') + 29 | # geom_tippoint(aes(color=location), size=.001) + scale_color_manual(values=cols) #+ 30 | geom_tiplab2(aes(label=name), align=T, linetype=NA, linesize=.05, size=.5, offset=1, hjust=0.5) #+ 31 | # geom_tiplab2(aes(label=year), align=T, linetype=NA, size=.2, offset=3.5, hjust=0.5) 32 | 33 | #p + xlim(-3, NA) 34 | 35 | df <- p$data 36 | df <- df[df$isTip,] 37 | start <- max(df$x) + 2 38 | 39 | dd <- as.data.frame(heatmapData) 40 | ## dd$lab <- rownames(dd) 41 | lab <- df$label[order(df$y)] 42 | dd <- dd[lab, , drop=FALSE] 43 | dd$y <- sort(df$y) 44 | dd$lab <- lab 45 | ## dd <- melt(dd, id=c("lab", "y")) 46 | dd <- gather(dd, variable, value, -c(lab, y)) 47 | 48 | i <- which(dd$value == "") 49 | if (length(i) > 0) { 50 | dd$value[i] <- NA 51 | } 52 | width=.5 53 | width <- width * (p$data$x %>% range %>% diff) / ncol(heatmapData) 54 | 55 | V2 <- start + as.numeric(as.factor(dd$variable)) * width 56 | 57 | dd$x <- V2 58 | dd$width <- width 59 | 60 | dd$value[dd$value == 0] = NA 61 | 62 | p2 <- p + geom_tile(data=dd, aes(x, y, fill=value), width=width, inherit.aes=FALSE) 63 | 64 | p2 = p2 + scale_fill_manual(values=heatmap.colours, na.value=NA) #"white") 65 | 66 | setwd(oldwd) 67 | #p2 <- p2+theme_tree()+theme_transparent() 68 | #p2 69 | p3 <- rotate_tree(open_tree(p2, 120), -35) 70 | 71 | 72 | # dev.new(height=297, width=210, unit="mm") 73 | png("book-cover.png", width=210, height=297, units="mm", res=150) 74 | #grid.newpage() 75 | 76 | grid.text("Data Integration, Manipulation and\nVisualization of Phylogenetic Trees", 77 | y=.82, gp=gpar(cex=2.5), just="left", x=.1) 78 | 79 | vp = viewport(x=.5, y=.42, width=.9, height=.8) 80 | pushViewport(vp) 81 | grid.draw(ggplotGrob(p3)) 82 | 83 | upViewport() 84 | grid.text("Guangchuang Yu", y=.22, x=.9, just="right", gp=gpar(cex=2)) 85 | grid.text("School of Basic Medical Sciences\nSouthern Medical University", y=.15, x=.9, just="right", 86 | gp=gpar(cex=1.5, fontface="italic")) 87 | dev.off() 88 | 89 | -------------------------------------------------------------------------------- /data-backup/HPV58.tree: -------------------------------------------------------------------------------- 1 | ((((((SC144|FJ385264:0.00136,((PPH58|D90400:0.00027,(SC165|FJ385265:0.00055,SC147|FJ385263:0.00054)18:0.00014)6:0,(SC100|FJ385261:0.00068,LZCC86|EU918765:0.00081)74:0.00027)5:0.00041)4:0.00014,(SC78|FJ385268:0.00029,(QE00190|KY225919:0.00028,((TW00060|KY225918:0,CNZJ3|KC860270:0.00014)95:0.00027,(SC101|FJ385262:0.00041,(SC174|FJ385266:0.00068,SC185|FJ385267:0.00054)7:0)8:0.00027)7:0.00013)7:0.00038)3:0.002)2:0.00041,(ZWE058771|KY225920:0,ZWE047402|KY225921:0.00014)98:0.00163)87:0.00073,(QV00861|HQ537755:0.00163,(QE01538|KY225934:0.00054,((KORK01712|KY225922:0,KORK03505|KY225923:0)100:0.00054,(((JP0221|AB819275:0.00014,QV03554|HQ537754:0.00245)15:0,(JP1352|AB819278:0.00027,(RW791|HQ537753:0.00041,(ZWE052265|KY225924:0,ZWE051406|KY225925:0.00027)97:0.00041)73:0.00014)12:0)45:0.00014,((CNZJ1|KC860269:0.00027,(((KORK00020|KY225926:0.00027,(KORK00038|KY225927:0.00014,KORK00643|KY225928:0.00027)62:0)94:0.00041,(JP0891|AB819277:0.00027,CNZJ2|KC860271:0.00027)32:0)63:0.00014,((KORK00053|KY225929:0,KORK02118|KY225930:0)100:0.00041,(KORK00421|KY225931:0,(JP0302|AB819276:0.00014,KORK00025|KY225932:0.00014)2:0)95:0.00041)29:0)62:0.00014)6:0,(QV15606|HQ537752:0.00014,(36A|KU298920:0.00041,TJ18|GQ472850:0.0019)6:0)0:0)0:0)9:0)61:0.00014)77:0.00026)100:0.0024)71:0.00054,((QV32351|HQ537757:0,QV15563|HQ537756:0.00027)63:0.00014,((AS405|HQ537759:0.00041,(AS347|HQ537760:0.00041,((KORK00613|KY225938:0.00054,(KORK02546|KY225936:0.00068,KORK00008|KY225937:0.00027)29:0)58:0.00014,(((KORK00191|KY225939:0.00014,KORK01374|KY225941:0)86:0.00027,((JP1870|AB819279:0,KORK00034|KY225942:0.00041)63:0.00014,(KORK03823|KY225943:0.00014,KORK00099|KY225944:0.00014)42:0)65:0.00013)64:0,(KORK02277|KY225945:0.00014,(KORK00064|KY225946:0.00014,KORK00043|KY225947:0.00014)34:0)71:0.00014)57:0)76:0.00027)83:0.00027)60:0.00014,((QE00150|KY225948:0.00027,(JPNJ00739|KY225953:0.00081,((THA00468|KY225949:0.00081,KORK02550|KY225950:0)62:0.00014,(KORK00011|KY225951:0,KORK03762|KY225952:0)99:0.00014)18:0)61:0.00014)26:0,(QV00961|HQ537758:0.0019,(QE00470|KY225954:0.00014,QE01132|KY225955:0.00054)93:0.00027)38:0.00013)17:0.00013)10:0)100:0.00225):0.00496,((Z023|HQ537763:0.00082,(BF134|HQ537762:0.00028,BF077|HQ537761:0.00109)87:0.00041)100:0.00342,(((ZWE051089|KY225956:0.00096,ZWE043998|KY225957:0.00027)100:0.00106,(RW937|HQ537764:0.00096,RW754|HQ537765:0.00027)78:0.00031)100:0.00213,(((Z094|HQ537777:0.00042,(ZWE062097|KY225958:0,ZWE050364|KY225959:0)100:0.00067)99:0.00103,((RW792|HQ537775:0.00027,RW644|HQ537776:0)100:0.0007,((QV13816|HQ537774:0.00041,QV34982|HQ537772:0.00027)58:0.00014,(ZWE054176|KY225961:0,(QV03666|HQ537773:0.00136,ZWE044033|KY225963:0.00068)42:0)40:0)86:0.00052)56:0.0005)100:0.00367,((ARGP00138|KY225964:0.00165,(QV03858|HQ537766:0.00178,(QV04732|HQ537767:0.00027,QV03841|HQ537768:0.00027)58:0)100:0.00124)99:0.00079,(ZWE064436|KY225966:0.00073,(ZWE051402|KY225967:0.00044,(RW841|HQ537769:0.00069,(RW697|HQ537770:0.00015,RW63|HQ537771:0.00273)38:0.00014)78:0.00079)64:0.00066)100:0.00169)100:0.00267)98:0.00141)95:0.0013):0.00031)100; 2 | -------------------------------------------------------------------------------- /data-backup/tree.nex: -------------------------------------------------------------------------------- 1 | #NEXUS 2 | [created by the 10kTree Website - http://10kTrees.fas.harvard.edu] 3 | BEGIN TREES; 4 | translate 5 | 1 Allenopithecus_nigroviridis, 6 | 2 Cercopithecus_mitis, 7 | 3 Cercopithecus_petaurista, 8 | 4 Chlorocebus_sabaeus, 9 | 5 Erythrocebus_patas, 10 | 6 Miopithecus_ogouensis, 11 | 7 Avahi_laniger, 12 | 8 Cheirogaleus_major, 13 | 9 Daubentonia_madagascarensis, 14 | 10 Eulemur_fulvus, 15 | 11 Hapalemur_griseus, 16 | 12 Indri_indri, 17 | 13 Lemur_catta, 18 | 14 Lepilemur_mustelinus, 19 | 15 Microcebus_murinus, 20 | 16 Mirza_zaza, 21 | 17 Propithecus_diadema, 22 | 18 Varecia_variegata, 23 | 19 Alouatta_caraya, 24 | 20 Ateles_geoffroyi, 25 | 21 Lagothrix_lagotricha, 26 | 22 Aotus_trivirgatus, 27 | 23 Callimico_goeldii, 28 | 24 Callithrix_humeralifera, 29 | 25 Cebuella_pygmaea, 30 | 26 Cebus_apella, 31 | 27 Leontopithecus_rosalia, 32 | 28 Saguinus_fuscicollis, 33 | 29 Saimiri_sciureus, 34 | 30 Arctocebus_aureus, 35 | 31 Loris_lydekkerianus, 36 | 32 Nycticebus_coucang, 37 | 33 Perodicticus_potto, 38 | 34 Hoolock_hoolock, 39 | 35 Gorilla_gorilla, 40 | 36 Homo_sapiens, 41 | 37 Hylobates_lar, 42 | 38 Nomascus_concolor, 43 | 39 Pan_troglodytes, 44 | 40 Pongo_pygmaeus, 45 | 41 Symphalangus_syndactylus, 46 | 42 Cacajao_calvus, 47 | 43 Callicebus_moloch, 48 | 44 Chiropotes_chiropotes, 49 | 45 Pithecia_pithecia, 50 | 46 Cercocebus_albigena, 51 | 47 Macaca_fascicularis, 52 | 48 Macaca_nemestrina, 53 | 49 Mandrillus_sphinx, 54 | 50 Papio_papio, 55 | 51 Theropithecus_gelada, 56 | 52 Colobus_polykomos, 57 | 53 Nasalis_larvatus, 58 | 54 Presbytis_rubicunda, 59 | 55 Procolobus_badius, 60 | 56 Pygathrix_nigriceps, 61 | 57 Rhinopithecus_roxellana, 62 | 58 Semnopithecus_schistaceus, 63 | 59 Trachypithecus_cristatus, 64 | 60 Euoticus_elegantulus, 65 | 61 Galago_senegalensis, 66 | 62 Otolemur_crassicaudatus, 67 | 63 Cephalopachus_bancanus, 68 | 64 Tarsius_tarsier, 69 | 65 Carlito_syrichta; 70 | tree consensus_65species = (((((((1:11.894902,(((2:6.429209,3:6.429209):3.418917,(5:8.627245,4:8.627244):1.220881):1.644988,6:11.493113):0.401789):2.980276,(((46:5.304298,49:5.304297):6.046166,(51:5.769164,50:5.769163):5.581300):1.502062,(48:6.877996,47:6.877995):5.974530):2.022653):6.535196,((52:12.537452,55:12.537452):2.897705,((((53:9.634813,56:9.634813):0.839771,57:10.474584):2.310063,(58:11.461377,59:11.461378):1.323270):0.523455,54:13.308102):2.127056):5.975217):8.589626,((34:8.241196,((37:6.598361,41:6.598362):0.749537,38:7.347898):0.893297):11.364750,((35:8.652233,(36:6.175880,39:6.175879):2.476353):6.480222,40:15.132455):4.473491):10.394055):16.811821,(((19:14.760240,(20:9.147391,21:9.147391):5.612849):6.561060,((22:19.487521,(((23:13.232628,(24:4.789811,25:4.789812):8.442815):1.797437,27:15.030065):0.682187,28:15.712252):3.775269):0.605006,(26:18.569905,29:18.569905):1.522623):1.228773):1.411478,(((42:2.274028,44:2.274028):7.368851,45:9.642879):9.753209,43:19.396087):3.336691):24.079043):22.028211,((63:16.314276,65:16.314276):7.983376,64:24.297652):44.542381):4.162986,(((((((15:14.271122,16:14.271123):8.292266,8:22.563389):5.865706,14:28.429095):2.516810,(12:20.909032,(7:16.502600,17:16.502600):4.406432):10.036873):2.318811,((10:15.019595,(11:9.280518,13:9.280517):5.739079):5.523206,18:20.542802):12.721914):17.859349,9:51.124065):11.612487,(((30:18.734550,33:18.734550):15.900706,(31:24.057527,32:24.057528):10.577729):3.364744,((60:5.384501,61:5.384501):7.979917,62:13.364418):24.635583):24.736553):10.266465); 71 | END; -------------------------------------------------------------------------------- /Introduction.Rmd: -------------------------------------------------------------------------------- 1 | 2 | # Introduction {-} 3 | 4 | ```{r, eval = !knitr::is_latex_output(), echo=FALSE, results='asis'} 5 | badge_version("tidytree") 6 | badge_version("treeio") 7 | badge_version("ggtree") 8 | badge_version("ggtreeExtra") 9 | ``` 10 | 11 | > You can't even begin to understand biology, you can't understand life, unless 12 | > you understand what it's all there for, how it arose - and that means 13 | > evolution. 14 | > 15 | > --- Richard Dawkins 16 | 17 | 18 | ## `r if (!knitr::is_latex_output()) emoji("dart")` Motivation {-} 19 | 20 | The book is meant as a guide for data integration, manipulation and visualization of phylogenetic trees using a suite of R packages, `r CRANpkg("tidytree")`, `r Biocpkg("treeio")` and `r Biocpkg("ggtree")`. Hence, if you are starting to read this book, we assume you have a working knowledge of how to use R and `r CRANpkg("ggplot2")`. 21 | 22 | ## `r if (!knitr::is_latex_output()) emoji("memo")` Citation {-} 23 | 24 | If you use the software suite in published research, please cite the most appropriate paper(s) from this list: 25 | 26 | 1. __G Yu__. Using ggtree to visualize data on tree-like structures. __*Current Protocols in Bioinformatics*__, 2020, 69:e96. doi: [10.1002/cpbi.96](https://doi.org/10.1002/cpbi.96). 27 | 2. LG Wang, TTY Lam, S Xu, Z Dai, L Zhou, T Feng, P Guo, CW Dunn, BR Jones, T Bradley, H Zhu, Y Guan, Y Jiang, __G Yu__^\*^. treeio: an R package for phylogenetic tree input and output with richly annotated and associated data. __*Molecular Biology and Evolution*__. 2020, 37(2):599-603. 28 | doi: [10.1093/molbev/msz240](http://dx.doi.org/10.1093/molbev/msz240). 29 | 3. __G Yu__^\*^, TTY Lam, H Zhu, Y Guan^\*^. Two methods for mapping and visualizing associated data on phylogeny using ggtree. __*Molecular Biology and Evolution*__. 2018, 35(2):3041-3043. 30 | doi: [10.1093/molbev/msy194](https://doi.org/10.1093/molbev/msy194). 31 | 4. __G Yu__, DK Smith, H Zhu, Y Guan, TTY Lam^\*^. ggtree: an R package for 32 | visualization and annotation of phylogenetic trees with their covariates and 33 | other associated data. __*Methods in Ecology and Evolution*__. 2017, 8(1):28-36. 34 | doi: [10.1111/2041-210X.12628](https://doi.org/10.1111/2041-210X.12628). 35 | 36 | ## `r if (!knitr::is_latex_output()) emoji("books")` Book structure {-} 37 | 38 | 39 | + Part 1 (Tree data input, output and manipulation) describes `r Biocpkg("treeio")` package for tree data input and output, and `r CRANpkg("tidytree")` package for tree data manipulation. 40 | + Part 2 (Tree data visualization and annotation) introduces tree visualization and annotation using grammar of graphic syntax implemented in the `r Biocpkg("ggtree")` package. It emphasizes on presenting tree associated data on the tree. 41 | + Part 3 (ggtree extensions) introduces ggtreeExtra for presenting data on circular layout trees and other extensions including MicrobiotaProcess and ggnetworx *etc.*. 42 | + Part 4 (Miscellaneous topics) describes utilities provided by the `r Biocpkg("ggtree")` package suite and presents a set of reproducible examples. 43 | 44 | 45 | ## `r if (!knitr::is_latex_output()) emoji("sparkling_heart")` Want to help? {-} 46 | 47 | 48 | The book’s source code is hosted on GitHub, at . Any feedback on the book is very welcome. Feel free to [open an issue](https://github.com/YuLab-SMU/treedata-book/issues/new) on GitHub or send me a pull request if you notice typos or other issues (I'm not a native English speaker ;) ). 49 | 50 | -------------------------------------------------------------------------------- /data-backup/anole.tre: -------------------------------------------------------------------------------- 1 | ((((((((ahli:0.1308887296,allogus:0.1308887296):0.109078899,rubribarbus:0.2399676286):0.3477240729,imias:0.5876917015):0.1279779191,((((sagrei:0.2576204042,(bremeri:0.1097436524,quadriocellifer:0.1097436524):0.1478767518):0.06150599843,ophiolepis:0.3191264027):0.08721921759,mestrei:0.4063456203):0.1298140501,(((jubar:0.1188659524,homolechis:0.1188659524):0.09052271908,confusus:0.2093886715):0.04215577182,guafe:0.2515444433):0.2846152271):0.1795099503):0.1377237125,((((garmani:0.2000335809,opalinus:0.2000335809):0.01968719882,grahami:0.2197207797):0.2178099139,valencienni:0.4375306936):0.1226128606,(lineatopus:0.4713710622,reconditus:0.4713710622):0.08877249208):0.2932497789):0.06703519523,(((evermanni:0.2135202715,stratulus:0.2135202715):0.3521520586,(((krugi:0.3267560653,pulchellus:0.3267560653):0.1312930371,(gundlachi:0.3864660126,poncensis:0.3864660126):0.0715830898):0.03035078065,(cooki:0.395288192,cristatellus:0.395288192):0.09311169105):0.07727244709):0.1495575755,(((brevirostris:0.2757423466,(caudalis:0.1704974619,marron:0.1704974619):0.1052448847):0.02672749452,websteri:0.3024698411):0.09835748687,distichus:0.400827328):0.3144025776):0.2051986227):0.03488732303,(((barbouri:0.8021085018,(((alumina:0.2681076879,semilineatus:0.2681076879):0.219367178,olssoni:0.4874748658):0.2622236606,(etheridgei:0.5883072151,(fowleri:0.3770938401,insolitus:0.3770938401):0.211213375):0.1613913113):0.05240997539):0.0672038969,((((whitemani:0.3420271265,((haetianus:0.2669834072,breslini:0.2669834072):0.06962183477,((armouri:0.1483909526,cybotes:0.1483909526):0.04416718222,shrevei:0.1925581348):0.1440471072):0.005421884492):0.1066560095,(longitibialis:0.2521253346,strahmi:0.2521253346):0.1965578014):0.09143002532,marcanoi:0.5401131613):0.2505275207,((((((baleatus:0.04173045424,barahonae:0.04173045424):0.05263675531,ricordii:0.09436720956):0.2036021511,eugenegrahami:0.2979693606):0.0851110199,christophei:0.3830803805):0.09095334022,cuvieri:0.4740337207):0.1076385501,(barbatus:0.1467942669,(porcus:0.09310584235,(chamaeleonides:0.07630236186,guamuhaya:0.07630236186):0.01680348049):0.05368842459):0.4348780039):0.2089684112):0.07867171672):0.07597999248,((((((((altitudinalis:0.1748899419,oporinus:0.1748899419):0.09220318062,isolepis:0.2670931225):0.2538920892,(allisoni:0.29602293,porcatus:0.29602293):0.2249622817):0.03703491197,(((argillaceus:0.1142165228,centralis:0.1142165228):0.0249762444,pumilis:0.1391927672):0.2356256274,loysiana:0.3748183946):0.1832017291):0.08522862529,guazuma:0.6432487489):0.04644117492,((placidus:0.1869579579,sheplani:0.1869579579):0.3773659809,(alayoni:0.3793818065,(angusticeps:0.2172126961,paternus:0.2172126961):0.1621691104):0.1849421323):0.125365985):0.07887044542,((alutaceus:0.120861969,inexpectatus:0.120861969):0.4042515809,(((clivicola:0.3359598029,(cupeyalensis:0.08606303065,cyanopleurus:0.08606303065):0.2498967723):0.1189736423,(alfaroi:0.2802339379,macilentus:0.2802339379):0.1746995073):0.0092278683,vanidicus:0.4641613135):0.06095223642):0.2434468193):0.09435314761,(argenteolus:0.6564331946,lucius:0.6564331946):0.2064803223):0.08237887432):0.01002346021):0.04468414858,(((bartschi:0.5247253674,vermiculatus:0.5247253674):0.249459768,((((baracoae:0.05853977536,(noblei:0.02140617522,smallwoodi:0.02140617522):0.03713360014):0.02849164237,luteogularis:0.08703141773):0.017899207,equestris:0.1049306247):0.6297194497,(((monticola:0.6055537678,(bahorucoensis:0.3841100683,(dolichocephalus:0.1509270933,hendersoni:0.1509270933):0.2331829749):0.2214436996):0.03149201716,darlingtoni:0.637045785):0.03288736013,(((aliniger:0.1783542747,singularis:0.1783542747):0.1377057507,chlorocyanus:0.3160600254):0.2135626601,coelestinus:0.5296226856):0.1403104596):0.0647169293):0.0395350609):0.1207482386,occultus:0.8949333739):0.1050666261); 2 | -------------------------------------------------------------------------------- /hdvips.def: -------------------------------------------------------------------------------- 1 | %% 2 | %% This is file `hdvips.def', 3 | %% generated with the docstrip utility. 4 | %% 5 | %% The original source files were: 6 | %% 7 | %% hyperref.dtx (with options: `dvips') 8 | %% 9 | %% File: hyperref.dtx Copyright 1995-2001 Sebastian Rahtz, 10 | %% with portions written by David Carlisle and Heiko Oberdiek, 11 | %% 2001-2012 Heiko Oberdiek. 12 | %% 13 | %% This file is part of the `Hyperref Bundle'. 14 | %% ------------------------------------------- 15 | %% 16 | %% This work may be distributed and/or modified under the 17 | %% conditions of the LaTeX Project Public License, either version 1.3 18 | %% of this license or (at your option) any later version. 19 | %% The latest version of this license is in 20 | %% http://www.latex-project.org/lppl.txt 21 | %% and version 1.3 or later is part of all distributions of LaTeX 22 | %% version 2005/12/01 or later. 23 | %% 24 | %% This work has the LPPL maintenance status `maintained'. 25 | %% 26 | %% The Current Maintainer of this work is Heiko Oberdiek. 27 | %% 28 | %% The list of all files belonging to the `Hyperref Bundle' is 29 | %% given in the file `manifest.txt'. 30 | %% 31 | \ProvidesFile{hdvips.def} 32 | [2012/08/13 v6.83a % 33 | Hyperref driver for dvips] 34 | \Hy@VersionCheck{hdvips.def} 35 | \providecommand*{\XR@ext}{pdf} 36 | \let\Hy@raisedlink\ltx@empty 37 | \def\literalps@out#1{\special{ps:SDict begin #1 end}}% 38 | \def\headerps@out#1{\special{! #1}}% 39 | \input{pdfmark.def}% 40 | \ifx\@pdfproducer\relax 41 | \def\@pdfproducer{dvips + Distiller}% 42 | \fi 43 | \providecommand*\@pdfborder{0 0 1} 44 | \providecommand*\@pdfborderstyle{} 45 | \providecommand*\@pdfview{XYZ} 46 | \providecommand*\@pdfviewparams{ H.V} 47 | \def\Hy@BorderArrayPatch{BorderArrayPatch} 48 | \g@addto@macro\Hy@FirstPageHook{% 49 | \headerps@out{% 50 | /DvipsToPDF{72.27 mul Resolution div} def% 51 | /PDFToDvips{72.27 div Resolution mul} def% 52 | /BPToDvips{72 div Resolution mul}def% 53 | /BorderArrayPatch{% 54 | [exch{% 55 | dup dup type/integertype eq exch type/realtype eq or% 56 | {BPToDvips}if% 57 | }forall]% 58 | }def% 59 | /HyperBorder {1 PDFToDvips} def% 60 | /H.V {pdf@hoff pdf@voff null} def% 61 | /H.B {/Rect[pdf@llx pdf@lly pdf@urx pdf@ury]} def% 62 | /H.S {% 63 | currentpoint % 64 | HyperBorder add /pdf@lly exch def % 65 | dup DvipsToPDF 72 add /pdf@hoff exch def % 66 | HyperBorder sub /pdf@llx exch def% 67 | } def% 68 | /H.L {% 69 | 2 sub dup% 70 | /HyperBasePt exch def % 71 | PDFToDvips /HyperBaseDvips exch def % 72 | currentpoint % 73 | HyperBaseDvips sub /pdf@ury exch def% 74 | /pdf@urx exch def% 75 | } def% 76 | /H.A {% 77 | H.L % 78 | currentpoint exch pop % 79 | vsize 72 sub exch DvipsToPDF % 80 | HyperBasePt sub % baseline skip 81 | sub /pdf@voff exch def% 82 | } def% 83 | /H.R {% 84 | currentpoint % 85 | HyperBorder sub /pdf@ury exch def % 86 | HyperBorder add /pdf@urx exch def % 87 | currentpoint exch pop vsize 72 sub % 88 | exch DvipsToPDF sub /pdf@voff exch def% 89 | } def% 90 | }% 91 | } 92 | \AtBeginShipoutFirst{% 93 | \ifHy@setpagesize 94 | \begingroup 95 | \@ifundefined{stockwidth}{% 96 | \ifdim\paperwidth>\z@ 97 | \ifdim\paperheight>\z@ 98 | \special{papersize=\the\paperwidth,\the\paperheight}% 99 | \fi 100 | \fi 101 | }{% 102 | \ifdim\stockwidth>\z@ 103 | \ifdim\stockheight>\z@ 104 | \special{papersize=\the\stockwidth,\the\stockheight}% 105 | \fi 106 | \fi 107 | }% 108 | \endgroup 109 | \fi 110 | \Hy@DisableOption{setpagesize}% 111 | } 112 | \endinput 113 | %% 114 | %% End of file `hdvips.def'. 115 | -------------------------------------------------------------------------------- /data-backup/Tree 30.4.19.nwk: -------------------------------------------------------------------------------- 1 | ((((((((pCLEC1A:0.14601826674556895,'hCLEC-1':0.16762545044957797)100:0.4487372288932428,(pMICL:0.3643247811150186,hMICL:0.3041373536572071)100:0.3411900445983226)47:0.04276786842152591,(pCLEC1B:0.15740280638959947,'hCLEC-2':0.17532844803527595)100:0.47941988298717475)38:0.07535633456488004,(((pCLEC12B:0.17693062422653527,hCLEC12B:0.13671309296861162)100:0.310642252364283,('pNKG2-D':0.08385368675820182,'hNKG2-D':0.201768273709363)100:0.4777792796502023)28:0.03788343185228904,'pCD94-like':0.6456893265259034)8:0.03150725815420157)1:0.02257072976889341,(('pNKG2-A_NKG2-B':0.36981190589959595,('hNKG2-E':0.11366889120032904,('hNKG2-C':0.036220683526554553,'hNKG2-A_NKG2-B':0.03503611608928042)88:0.05533876883725714)100:0.36788884718991927)99:0.31617829589176294,hCD94:0.576128777198662)30:0.07382043086396345)3:0.057038543048694414,(('pLOX-1':0.14575853945683723,'hLOX-1':0.1319410002976278)100:0.4138573889086859,('pDectin-1':0.14907136249022993,'hDectin-1':0.14961633455566395)100:0.3771529804367283)39:0.09508271809945566)2:0.01847556702989483,'hDNGR-1':0.6137746784283739)3:0.02833384894401211,((((((((('chCLEC2D-like':0.038953359620031686,chCD69:0.06439188207620382)46:0.021288821059535053,(('chCLEC2B-like':0.04323010213488172,chCLC2DL3:0.0932181350395363)42:0.014976966452222015,chCD69L:0.04838466618134898)34:0.020984133063093654)55:0.031495559883571944,(ch17.5:0.07284305324070889,(chCLC2DL4:0.01141653009997212,chCLC2DL5:0.008452583730810618)99:0.07633538378054305)50:0.027642352511500833)98:0.1045033434553104,(((((chYLEC2:0.0,(chCLEC2LL:0.014672611632043848,chCLC2IL1:0.07786684913018543)44:0.013915261877916217)29:0.010756645901612856,chCLC2BL1:0.014701698230401222)34:0.011800346892848451,'chCLEC2B-like2':5.857432878854363E-4)25:0.006386082522277098,chCLEC2B:0.013065656555238905)19:0.0036961023736960287,((chYLEC1:0.0,chCLC2BL2:0.014987904484240524)70:0.019885141119590007,chCLEC2DL2L:0.010205863654174405)35:0.012074881117080551)100:0.1586265669801198)99:0.247563992819982,'chB-lec3':0.601997921647818)36:0.07255750219140303,((('chB-lec':0.3881008981545003,(pCLEC2D:0.23654219861446676,hLLT1:0.24698164913371545)98:0.1794050591421903)34:0.05902510306232683,(pCLEC2B:0.3624056428258452,hAICL:0.26042242643882507)98:0.18449899773300238)26:0.054951735479244423,(pCD69:0.22106414027156654,hCD69:0.2468198217864983)100:0.3725427676558367)12:0.011397359800003086)52:0.1171214242619695,(pKLRG2:0.08182384078977115,hKLRG2:0.30219002826054636)100:0.624871886643143)11:0.017027795854082414,(((('chCLEC17AL-B':0.49691918109403455,'chCLEC17AL-A':0.3757879543962193)52:0.07369738364689125,(((chHL:0.5241398293711138,(pLangerin:0.12285257299826495,hLangerin:0.14479983181192066)100:0.3950196714975552)36:0.04118253514246677,(pCLEC17A:0.09777723619131576,hCLEC17A:0.08216216347839302)100:0.3105844628873924)22:0.04528799177791,((pFCER2:0.227298470698032,hFCER2:0.23942186366530588)100:0.3136615908632548,(pLSECtin:0.1531269879130641,hLSECtin:0.1910375963323229)100:0.3256889342664785)40:0.042278133852850716)4:0.01814425900668496)9:0.030490422344535015,((pASGR1:0.06623137171398556,hASGR1:0.13753620647792597)94:0.1019313905359055,hMGL:0.16210415187406077)100:0.3639612648892316)12:0.004789811382226676,(('pDC-SIGN':0.325616429159241,('hDC-SIGNR':0.11844908105606396,'hDC-SIGN':0.09996400375717877)100:0.2378255710198905)74:0.10336413658540554,(((hBDCA2:0.2560132191723029,hDCIR:0.2715352121747238)77:0.048831139093403406,'hDectin-2':0.3598936759213317)99:0.16101750768822484,hMincle:0.4070515896228743)58:0.06440068142509242)18:0.03009835779651192)72:0.18099928876587226)5:0.020568951164260448,((chCLEC5A:0.6506803601292,'chB-NK':0.7627885947037941)30:0.08262898786475112,(((((chB1r:0.2636503234983862,chCD72AGL:0.24158425186964336)100:0.30336707112237526,chB1:0.46334866022259985)86:0.15412702042602108,('pMDL-1':0.11508028578501642,'hMDL-1':0.18557525496745625)100:0.5810676402918764)19:0.050960388940723945,('chCLEC-2':0.7284705958418881,(pCD72:0.44897925745682943,hCD72:0.596551202935631)97:0.3116993865957303)15:0.029405524861256527)7:0.05193818112011289,((pKLRG1:0.18814887131387614,hKLRG1:0.2092036606617225)100:0.4184208390562423,(((pKLRF1:0.03980400268667969,hKLRF1:0.18015571590783389)100:0.33434672002795873,hKLRF2:0.5813585093968546)35:0.02181565796198749,(pKLRB1:0.17043935641451397,hKLRB1:0.32201518839856463)99:0.32408391709917955)41:0.14480209736112998)8:0.04214590095664535)0:0.033511576083625365)0:0.020568951164260448)3:0.02833384894401211):0.0; 2 | -------------------------------------------------------------------------------- /img/apple_emoji.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 🐮 61 | 🐳 62 | 🐬 63 | 🐖 64 | 🐗 65 | 🐫 66 | 🐟 67 | 🌱 68 | 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /11_ggtree_exts-others.Rmd: -------------------------------------------------------------------------------- 1 | \newpage 2 | 3 | # Other ggtree Extensions {#chapter11} 4 | 5 | ```{r include=F} 6 | library(knitr) 7 | opts_chunk$set(message=FALSE, warning=FALSE, eval=TRUE, echo=TRUE, cache=TRUE) 8 | ``` 9 | 10 | The `r Biocpkg("ggtree")` package is a general package for visualizing tree structures and associated data. If you have some special requirements that are not directly provided by `r Biocpkg("ggtree")`, you may need to use one of the extension packages built on top of `r Biocpkg("ggtree")`. For example, the `r CRANpkg("RevGadgets")` package for visualizing the output of the `r pkg_revbayes`, the `r Biocpkg("sitePath")` package for visualizing fixation events on phylogenetic pathways, and the `r Biocpkg("enrichplot")` package for visualizing hierarchical structure of the enriched pathways. 11 | 12 | 13 | ```{r revdep} 14 | rp <- BiocManager::repositories() 15 | db <- utils::available.packages(repo=rp) 16 | x <- tools::package_dependencies('ggtree', db=db, 17 | which = c("Depends", "Imports"), 18 | reverse=TRUE) 19 | print(x) 20 | ``` 21 | 22 | There are `r length(unlist(x))` packages in CRAN or Bioconductor that depend on or import `r Biocpkg("ggtree")` and several packages on GitHub that extend `r Biocpkg("ggtree")`. Here we briefly introduce some extension packages, including `r Biocpkg("MicrobiotaProcess")` and `r Biocpkg("tanggle")`. 23 | 24 | 25 | 26 | ## Taxonomy Annotation Using MicrobiotaProcess {#MicrobiotaProcess} 27 | 28 | The `r Biocpkg("MicrobiotaProcess")` package provides a LEfSe-like algorithm [@segata_metagenomic_2011] to discover microbiome biomarkers by comparing taxon abundance between different classes. It provides several methods to visualize the analysis result. The `ggdiffclade` is developed based on `r Biocpkg("ggtree")` [@yu_ggtree:_2017]. In addition to the `diff_analysis()` result, it also supports a data frame that contains a hierarchical relationship (*e.g.*, [taxonomy annotation](#MicrobiotaProcess-taxonomy) or KEGG annotation) with another data frame that contains taxa and factor information and/or pvalue. The following example demonstrates how to use data frames (*i.e.*, analysis results) to visualize the differential taxonomy tree. More details can be found on the vignette of the `r Biocpkg("MicrobiotaProcess")` package. 29 | 30 | 31 | (ref:CRCdiffscap) Visualize differential taxonomy clade. 32 | 33 | (ref:CRCdiffcap) **Visualize differential taxonomy clade.** 34 | 35 | ```{r CRCdiffclade, fig.width=7, fig.height=7, message=FALSE, fig.cap="(ref:CRCdiffcap)", fig.scap="(ref:CRCdiffscap)", out.extra='', warning=FALSE, message=FALSE, results='hide'} 36 | library(MicrobiotaProcess) 37 | library(ggplot2) 38 | library(TDbook) 39 | 40 | # load `df_difftax` and `df_difftax_info` from TDbook 41 | taxa <- df_alltax_info 42 | dt <- df_difftax 43 | 44 | ggdiffclade(obj=taxa, 45 | nodedf=dt, 46 | factorName="DIAGNOSIS", 47 | layout="radial", 48 | skpointsize=0.6, 49 | cladetext=2, 50 | linewd=0.2, 51 | taxlevel=3, 52 | # This argument is to remove the branch of unknown taxonomy. 53 | reduce=TRUE) + 54 | scale_fill_manual(values=c("#00AED7", "#009E73"))+ 55 | guides(color = guide_legend(keywidth = 0.1, keyheight = 0.6, 56 | order = 3,ncol=1)) + 57 | theme(panel.background=element_rect(fill=NA), 58 | legend.position="right", 59 | plot.margin=margin(0,0,0,0), 60 | legend.spacing.y=unit(0.02, "cm"), 61 | legend.title=element_text(size=7.5), 62 | legend.text=element_text(size=5.5), 63 | legend.box.spacing=unit(0.02,"cm") 64 | ) 65 | ``` 66 | 67 | The data frame of this example is from the analysis result of `diff_analysis()` using public datasets [@kostic2012genomic]. The `colors` represent the features enriched in the relevant class groups. The size of circle points represents the `-log10(pvalue)`, *i.e.*, a larger point indicates a greater significance. In Figure \@ref(fig:CRCdiffclade), we can find that *Fusobacterium* sequences were enriched in carcinomas, while Firmicutes, Bacteroides, and Clostridiales were greatly reduced in tumors. These results were consistent with the original article [@kostic2012genomic]. The species of *Campylobacter* has been proven to be associated with colorectal cancer [@He289; @wu2013dysbiosis; @amer2017microbiome]. We can find in Figure \@ref(fig:CRCdiffclade) that *Campylobacter* was enriched in tumors, while its relative abundance is lower than *Fusobacterium*. 68 | 69 | 70 | ## Visualizing Phylogenetic Network Using Tanggle 71 | 72 | The `r Biocpkg("tanggle")` package provides functions to display a split network. It extends the `r Biocpkg("ggtree")` package [@yu_ggtree:_2017] to allow the visualization of phylogenetic networks (Figure \@ref(fig:phylonetworx)). 73 | 74 | 75 | (ref:phylonetworxscap) Phylogenetic network. 76 | 77 | (ref:phylonetworxcap) **Phylogenetic network**. 78 | 79 | ```{r phylonetworx, fig.width=7, fig.height=7, message=FALSE, fig.cap="(ref:phylonetworxcap)", fig.scap="(ref:phylonetworxscap)", out.extra='', warning=FALSE} 80 | library(ggplot2) 81 | library(ggtree) 82 | library(tanggle) 83 | 84 | file <- system.file("extdata/trees/woodmouse.nxs", package = "phangorn") 85 | Nnet <- phangorn::read.nexus.networx(file) 86 | 87 | ggsplitnet(Nnet) + 88 | geom_tiplab2(aes(color=label), hjust=-.1)+ 89 | geom_nodepoint(color='firebrick', alpha=.4) + 90 | scale_color_manual(values=rainbow(15)) + 91 | theme(legend.position="none") + 92 | ggexpand(.1) + ggexpand(.1, direction=-1) 93 | ``` 94 | 95 | 96 | ## Summary {#summary11} 97 | 98 | 99 | The `r Biocpkg("ggtree")` is designed to support the grammar of graphics, allowing users to quickly explore phylogenetic data through visualization. When users have special needs and `r Biocpkg("ggtree")` does not provide them, it is highly recommended to develop extension packages to implement these missing functions. This is a good mechanism, and we also hope that `r Biocpkg("ggtree")` users can become a `r Biocpkg("ggtree")` community. In this way, more functions for special needs can be developed and shared among users. Everyone will benefit from it, and it's exciting that this is happening. 100 | 101 | -------------------------------------------------------------------------------- /data-backup/tree_example_april2015/bar.csv: -------------------------------------------------------------------------------- 1 | id,dummy_bar_value CS14_Brazil_2001,5 CS2_Brazil_1997,10 CS20_Brazil_2002,2 CS6_Brazil_2000,7 CS7_Brazil_2000,8 373_Cameroun_1973,10 32222_Cuba_2003,7 54185_Denmark_1945,2 20061758_Dominican,6 20051272_Egypt_2005,1 20060018_Egypt_2006,7 20061309_Egypt_2006,8 20062087_Egypt_Tunisia_2006,8 259_France_1959,2 476_France_1976,8 658_France_1958,9 1166_France_1966,3 1167_France_1967,4 1173_France_1973,2 1263_France_1963,7 1265_France_1965,2 1267_France_1967,10 1274_France_1974,4 1460_France_1960,9 1461_France_1961,4 1761_France_1961,5 2073_France_1973,9 2574_France_1974,4 4374_France_1974,10 4474_France_1974,1 8883_France_1983,3 54213_France_1945,7 998911_France_1999,8 IB48279_France_NA,9 pWR105_France_NA,1 2225_French,4 988743_French,3 10014_HCMC_2009,10 10021_HCMC_2009,1 10031_HCMC_2009,4 10035_HCMC_2009,3 10060_HCMC_2009,2 10063_HCMC_2009,2 10071_HCMC_2009,10 10073_HCMC_2009,2 10083_HCMC_2009,8 10093_HCMC_2009,6 10102_HCMC_2009,5 10111_HCMC_2009,4 10115_HCMC_2009,3 10134_HCMC_2009,7 10135_HCMC_2009,5 10152_HCMC_2009,9 10159_HCMC_2009,9 10188_HCMC_2009,2 10263_HCMC_2009,1 10320_HCMC_2010,5 10365_HCMC_2010,9 20006_HCMC_2009,5 20021_HCMC_2009,7 20023_HCMC_2009,9 20037_HCMC_2009,7 20070_HCMC_2009,3 20094_HCMC_2009,8 20228_HCMC_2009,3 20261_HCMC_2009,6 20263_HCMC_2009,3 20343_HCMC_2009,10 30003_HCMC_2009,1 30008_HCMC_2009,3 30010_HCMC_2009,1 30037_HCMC_2009,10 30054_HCMC_2009,5 30059_HCMC_2009,5 30071_HCMC_2009,7 30073_HCMC_2009,8 30100_HCMC_2009,8 30112_HCMC_2009,1 30124_HCMC_2009,8 30162_HCMC_2009,7 30164_HCMC_2009,7 30169_HCMC_2009,1 30172_HCMC_2009,2 30174_HCMC_2009,3 30233_HCMC_2009,2 30293_HCMC_2009,8 30366_HCMC_2009,10 30371_HCMC_2009,7 30387_HCMC_2010,8 30450_HCMC_2010,4 30451_HCMC_2010,2 DE0115_HCMC_2000,5 DE0127_HCMC_2000,10 DE0199_HCMC_2000,5 DE0248_HCMC_2000,3 DE0295_HCMC_2000,3 DE0303_HCMC_2000,6 DE0306_HCMC_2000,10 DE0330_HCMC_2000,5 DE0427_HCMC_2000,5 DE0477_HCMC_2000,2 DE0489_HCMC_2000,5 DE0490_HCMC_2000,5 DE0579_HCMC_2001,4 DE0611_HCMC_2001,1 DE0654_HCMC_2001,8 DE0655_HCMC_2001,8 DE0685_HCMC_2001,6 DE0816_HCMC_2001,7 DE0846_HCMC_2001,7 DE0885_HCMC_2001,4 DE0891_HCMC_2001,8 DE0900_HCMC_2001,2 DE0965_HCMC_2001,9 DE1063_HCMC_2002,7 DE1140_HCMC_2002,2 DE1150_HCMC_2002,2 DE1165_HCMC_2002,7 DE1191_HCMC_2002,9 DE1198_HCMC_2002,9 DE1208_HCMC_2002,2 DE1209_HCMC_2002,7 DE1256_HCMC_2002,1 DE1318_HCMC_2002,3 DE1336_HCMC_2002,2 DE1404_HCMC_2002,1 DE1486_HCMC_2002,2 EG0129_HCMC_2007,2 EG0159_HCMC_2007,3 EG0204_HCMC_2008,2 EG0255_HCMC_2008,1 EG0304_HCMC_2006,7 EG0309_HCMC_2006,1 EG0313_HCMC_2006,2 EG0315_HCMC_2006,4 EG0318_HCMC_2006,4 EG0352_HCMC_2007,7 EG0357_HCMC_2007,5 EG0362_HCMC_2007,5 EG0365_HCMC_2007,6 EG0369_HCMC_2007,3 EG0372_HCMC_2007,6 EG0373_HCMC_2007,8 EG0375_HCMC_2007,3 EG0379_HCMC_2007,5 EG0383_HCMC_2007,9 EG0385_HCMC_2007,5 EG0386_HCMC_2007,8 EG0388_HCMC_2007,7 EG0390_HCMC_2007,10 EG0392_HCMC_2007,6 EG0393_HCMC_2007,4 EG0394_HCMC_2007,8 EG0395_HCMC_2007,3 EG0401_HCMC_2007,2 EG0404_HCMC_2007,10 EG0410_HCMC_2007,4 EG0425_HCMC_2008,7 EG0430_HCMC_2008,7 EG0451_HCMC_2008,9 EG0467_HCMC_2008,4 EG0472_HCMC_2008,8 EG1001_HCMC_2008,9 EG1004_HCMC_2008,5 EG1008_HCMC_2008,10 EG1014_HCMC_2009,4 EG1015_HCMC_2009,3 EG1016_HCMC_2009,4 EG1017_HCMC_2009,10 EG1018_HCMC_2009,10 EG1019_HCMC_2009,9 EG1020_HCMC_2009,8 EG1021_HCMC_2009,4 EG1022_HCMC_2009,5 EG1023_HCMC_2009,6 EG1024_HCMC_2009,6 EG1025_HCMC_2009,9 EG1026_HCMC_0,7 EG1027_HCMC_0,6 EG1028_HCMC_0,5 EG1029_HCMC_0,4 HUE01_HCMC_2008,1 HUE02_HCMC_2008,3 HUE05_HCMC_2008,7 HUE16_HCMC_2009,7 HUE17_HCMC_2009,5 HUE19_HCMC_2009,5 HUE20_HCMC_2009,10 HUE21_HCMC_2009,6 HUE22_HCMC_2009,1 HUE23_HCMC_2009,10 HUE24_HCMC_2009,8 HUE25_HCMC_2009,1 HUE26_HCMC_2009,8 HUE27_HCMC_2009,3 HUE29_HCMC_2009,10 HUE30_HCMC_2009,9 HUE31_HCMC_2009,2 HUE32_HCMC_2009,6 HUE33_HCMC_2009,7 HUE34_HCMC_2009,1 HUE40_HCMC_2009,2 HUE42_HCMC_2009,2 HUE43_HCMC_2009,1 HUE46_HCMC_2009,5 HUE47_HCMC_2009,4 HUE48_HCMC_2009,4 HUE50_HCMC_2009,6 HUE53_HCMC_2010,1 HUE55_HCMC_2010,7 HUE57_HCMC_2010,1 HUE58_HCMC_2010,6 HUE60_HCMC_2010,6 HUE62_HCMC_2010,6 HUE64_HCMC_2010,4 HUE67_HCMC_2010,3 HUE68_HCMC_2010,2 KH02_HCMC_2009,8 KH04_HCMC_2009,3 KH05_HCMC_2009,7 KH06_HCMC_2009,10 KH07_HCMC_2009,10 KH09_HCMC_2009,3 KH10_HCMC_2009,5 KH11_HCMC_2009,1 KH12_HCMC_2009,6 KH13_HCMC_2009,9 KH14_HCMC_2009,10 KH15_HCMC_2009,4 KH16_HCMC_2009,5 KH17_HCMC_2009,4 KH18_HCMC_2009,6 KH19_HCMC_2009,8 KH20_HCMC_2009,3 KH21_HCMC_2009,2 KH23_HCMC_2009,4 KH24_HCMC_2009,5 KH25_HCMC_2009,9 KH26_HCMC_2009,3 KH27_HCMC_2009,7 KH28_HCMC_2009,9 KH29_HCMC_2009,3 KH30_HCMC_2009,9 KH32_HCMC_2009,8 KH33_HCMC_2009,7 KH34_HCMC_2009,5 KH35_HCMC_2009,10 KH37_HCMC_2009,3 KH38_HCMC_2009,4 KH40_HCMC_2009,6 KH41_HCMC_2009,9 KH42_HCMC_2010,6 KH43_HCMC_2010,7 KH45_HCMC_2010,2 KH53_HCMC_2010,6 KH54_HCMC_2010,1 KH55_HCMC_2010,2 KH57_HCMC_2010,8 MS0004_HCMC_1995,5 MS0011_HCMC_1995,4 MS0032_HCMC_1995,9 MS0034_HCMC_1995,9 MS0035_HCMC_1995,4 MS0039_HCMC_1995,2 MS0042_HCMC_1995,4 MS0043_HCMC_1995,5 MS0048_HCMC_1995,7 MS0063_HCMC_1995,5 MS0065_HCMC_1995,5 MS0069_HCMC_1995,6 MS0070_HCMC_1995,7 MS0080_HCMC_1995,10 MS0083_HCMC_1996,3 MS0094_HCMC_1996,2 MS0102_HCMC_1996,8 MS0110_HCMC_1996,6 MS0111_HCMC_1996,3 MS0119_HCMC_1996,9 MS0122_HCMC_1996,4 MS0127_HCMC_1996,7 MS0128_HCMC_1996,10 20031275_Iran_2003,7 31382_Israel_2003,8 20040924_Kenya_Egypt_2004,8 IB1_Korea_2003,1 IB10_Korea_2003,10 IB2_Korea_2003,1 IB2493_Korea_NA,10 IB3_Korea_2003,6 IB681_Korea_1991,6 IB683_Korea_1994,8 IB687_Korea_1998,5 IB690_Korea_2000,3 IB691_Korea_1999,6 IB694_Korea_1979,7 IB695_Korea_1983,3 IB696_Korea_1980,9 IB697_Korea_1982,5 IB698_Korea_1983,1 IB713_Korea_1981,5 IB716_Korea_1981,7 IB717_Korea_1982,1 IB739_Korea_1985,9 IB748_Korea_1987,8 53G_Korea_2000,1 5827_Madagascar_2000,2 989560_Madagascar_1998,9 9810267_Madagascar_1998,3 19984123_Mexico_1998,7 20062313_Nepal_2006,8 970044_New,10 IB3277_Pakistan_2002,9 IB3300_Pakistan_2002,3 IB3374_Pakistan_2002,10 IB3488_Pakistan_2003,8 IB3507_Pakistan_2003,4 IB3580_Pakistan_2003,4 IB3599_Pakistan_2003,5 20052631_Peru_2005,2 273_Senegal_1973,4 1567_Senegal_1967,8 36224_Senegal_2003,3 20040880_SriLanka_2004,5 Ss046_Ref_1950,2 54178_Sweden_1945,6 54179_Sweden_1944,6 54181_Sweden_1945,9 54184_Sweden_1945,4 54190_Sweden_1945,6 54210_Sweden_1943,1 54216_Sweden_1946,1 54228_Sweden_1947,3 19904011_unk_1990,5 19910761_unk_1991,1 19911483_unk_1991,1 19920319_unk_1992,5 20003593_unk_2000,1 20010007_unk_2001,3 20011685_unk_2001,3 20021122_unk_2002,8 20040489_unk_2004,2 20041367_unk_2004,4 20071599_unk_2007,9 20081885_unk_2008,7 20051541_Uzbekistan_2005,7 IB1970_Vietnam_2001,2 IB1976_Vietnam_2002,9 IB1980_Vietnam_2002,2 IB1985_Vietnam_2002,1 IB1987_Vietnam_2002,3 IB1990_Vietnam_2003,2 IB1993_Vietnam_2003,3 IB1995_Vietnam_2003,2 IB1997_Vietnam_2003,1 IB2000_Vietnam_2003,10 IB2004_Vietnam_2003,7 IB2008_Vietnam_2003,4 IB2009_Vietnam_2003,3 IB2012_Vietnam_2001,3 IB2013_Vietnam_2001,5 IB2015_Vietnam_2002,3 IB2018_Vietnam_2002,8 IB2024_Vietnam_2002,5 IB2026_Vietnam_2003,1 #N/A,9 10083_HCMC_NA,7 10093_HCMC_NA,9 10102_HCMC_NA,8 10111_HCMC_NA,8 10115_HCMC_NA,4 10134_HCMC_NA,3 10135_HCMC_NA,5 10152_HCMC_NA,1 10159_HCMC_NA,7 10188_HCMC_NA,4 10014_HCMC_NA,5 10263_HCMC_NA,7 10320_HCMC_NA,6 10365_HCMC_NA,8 10021_HCMC_NA,4 10031_HCMC_NA,1 10035_HCMC_NA,2 10060_HCMC_NA,4 10063_HCMC_NA,10 10071_HCMC_NA,1 10073_HCMC_NA,6 -------------------------------------------------------------------------------- /data-backup/tree_example_april2015/res_genes.csv: -------------------------------------------------------------------------------- 1 | id,gyrA,pEK204,CT-X-M-15,pEG356,CTX-M-14,colicinPlasmid1,pMG828-3 KH09_HCMC_2009,4,0,0,0,0,5,0 KH11_HCMC_2009,4,0,0,0,0,5,0 DE0579_HCMC_2001,4,0,0,0,0,5,6 EG0159_HCMC_2007,4,0,0,0,0,5,6 KH54_HCMC_2010,4,0,0,0,0,5,6 EG0392_HCMC_2007,4,0,0,0,0,5,6 EG0372_HCMC_2007,4,0,0,0,0,5,6 KH02_HCMC_2009,4,0,0,0,0,5,6 EG0385_HCMC_2007,4,0,0,0,0,5,6 KH53_HCMC_2010,4,0,0,0,0,5,6 HUE58_HCMC_2010,4,0,0,0,0,5,6 EG0404_HCMC_2007,4,0,0,0,0,5,6 30010_HCMC_2009,4,0,0,0,0,5,6 KH27_HCMC_2009,4,0,0,14,15,5,6 KH20_HCMC_2009,4,0,0,14,15,5,6 KH26_HCMC_2009,4,0,0,14,15,5,6 KH24_HCMC_2009,4,0,0,14,15,5,6 KH15_HCMC_2009,4,0,0,0,0,5,6 KH18_HCMC_2009,4,0,0,0,0,5,6 KH23_HCMC_2009,4,0,0,0,0,5,6 20261_HCMC_2009,4,0,0,0,0,5,6 IB1997_Vietnam_2003,4,0,0,0,0,5,6 IB1987_Vietnam_2002,4,0,0,0,0,5,6 30293_HCMC_2009,4,7,8,14,15,5,0 KH55_HCMC_2010,4,0,0,0,0,5,0 10073_HCMC_2009,4,0,0,0,15,5,0 KH41_HCMC_2009,4,0,0,0,0,5,0 KH37_HCMC_2009,4,0,0,0,0,5,0 KH35_HCMC_2009,4,0,0,0,0,5,0 30450_HCMC_2010,4,0,0,0,0,5,0 DE1150_HCMC_2002,3,0,0,0,0,5,6 DE1336_HCMC_2002,3,0,0,0,0,5,6 DE1209_HCMC_2002,3,0,0,0,0,5,6 IB2024_Vietnam_2002,3,0,0,0,0,5,6 IB2026_Vietnam_2003,3,0,0,0,0,5,6 IB1995_Vietnam_2003,3,0,0,0,0,5,6 EG1015_HCMC_2009,2,7,8,0,0,0,0 10111_HCMC_2009,2,7,8,0,0,5,0 EG0129_HCMC_2007,2,0,0,0,0,5,0 EG0401_HCMC_2007,2,0,0,0,0,5,0 EG0383_HCMC_2007,2,0,0,0,0,5,0 EG0204_HCMC_2008,2,7,8,0,0,5,0 EG0255_HCMC_2008,2,0,0,0,0,5,0 30124_HCMC_2009,2,7,8,0,0,5,0 10115_HCMC_2009,2,7,8,0,0,5,0 10135_HCMC_2009,2,7,8,0,0,5,0 EG1001_HCMC_2008,2,7,8,0,0,5,0 EG1023_HCMC_2009,2,7,8,0,0,5,0 10134_HCMC_2009,2,7,8,0,0,5,0 10152_HCMC_2009,2,7,8,0,0,5,0 KH07_HCMC_2009,2,0,0,14,15,5,0 EG1008_HCMC_2008,2,7,8,0,0,5,0 EG1024_HCMC_2009,2,7,8,0,0,5,0 EG0393_HCMC_2007,2,0,0,0,0,5,0 20037_HCMC_2009,2,7,8,0,0,5,0 EG1004_HCMC_2008,2,7,8,0,0,5,0 KH10_HCMC_2009,2,0,0,0,0,5,0 KH19_HCMC_2009,2,0,0,14,15,5,0 30008_HCMC_2009,2,7,8,0,0,5,0 KH12_HCMC_2009,2,0,0,14,15,5,0 10083_HCMC_2009,2,7,8,0,0,5,0 30054_HCMC_2009,2,7,8,0,0,5,0 KH17_HCMC_2009,2,0,0,0,0,5,0 EG1025_HCMC_2009,2,7,8,0,0,5,0 KH21_HCMC_2009,2,0,0,0,0,5,0 10093_HCMC_2009,2,7,8,0,0,5,0 20070_HCMC_2009,2,7,8,0,0,5,0 30059_HCMC_2009,2,7,8,0,0,5,0 10102_HCMC_2009,2,7,8,0,0,5,0 20021_HCMC_2009,2,7,8,0,0,5,0 EG0430_HCMC_2008,2,7,8,0,0,5,0 EG0357_HCMC_2007,2,0,0,0,0,5,0 10159_HCMC_2009,2,7,8,0,0,5,0 KH30_HCMC_2009,2,0,0,14,15,5,0 20023_HCMC_2009,2,7,8,0,0,5,0 30037_HCMC_2009,2,7,8,0,0,5,0 30071_HCMC_2009,2,7,8,0,0,5,0 EG1026_HCMC_0,2,7,8,0,0,5,0 30100_HCMC_2009,2,7,8,0,0,5,0 20228_HCMC_2009,2,7,8,0,0,5,0 KH25_HCMC_2009,2,0,0,14,15,5,6 30371_HCMC_2009,2,7,8,0,0,5,6 KH05_HCMC_2009,2,0,0,0,0,5,6 KH06_HCMC_2009,2,0,0,14,15,5,6 20006_HCMC_2009,2,7,8,0,0,5,6 KH14_HCMC_2009,2,0,0,14,15,5,6 HUE55_HCMC_2010,2,0,0,0,0,5,6 EG0318_HCMC_2006,2,0,0,0,0,5,6 HUE29_HCMC_2009,2,0,0,0,0,5,6 HUE50_HCMC_2009,2,0,0,14,15,5,6 EG0315_HCMC_2006,2,0,0,0,0,5,6 EG0313_HCMC_2006,2,0,0,0,0,5,6 EG0467_HCMC_2008,2,0,0,0,0,5,6 KH04_HCMC_2009,2,0,0,14,15,5,6 KH43_HCMC_2010,2,7,0,14,15,5,6 EG0375_HCMC_2007,2,0,0,0,0,5,6 EG0365_HCMC_2007,2,0,0,0,0,5,6 EG0362_HCMC_2007,2,0,0,0,0,5,6 EG0369_HCMC_2007,2,0,0,0,0,5,6 30073_HCMC_2009,2,0,0,0,0,5,6 EG0394_HCMC_2007,2,0,0,0,0,5,6 EG0388_HCMC_2007,2,0,0,0,0,5,6 KH16_HCMC_2009,2,0,0,0,0,5,6 EG0395_HCMC_2007,2,7,8,0,0,5,6 EG0390_HCMC_2007,2,7,8,0,0,5,6 KH28_HCMC_2009,2,0,0,0,0,5,6 KH29_HCMC_2009,2,0,0,0,0,5,6 20094_HCMC_2009,2,0,0,0,15,5,6 KH13_HCMC_2009,2,0,0,0,0,5,6 HUE53_HCMC_2010,2,0,0,0,0,5,6 EG0309_HCMC_2006,2,0,0,0,0,5,6 EG0451_HCMC_2008,2,0,0,0,0,5,6 EG0425_HCMC_2008,2,0,0,0,0,5,6 30112_HCMC_2009,2,7,8,0,0,5,6 EG0472_HCMC_2008,2,7,8,0,0,5,6 HUE17_HCMC_2009,2,7,8,0,0,5,6 HUE22_HCMC_2009,2,7,8,0,0,5,6 KH45_HCMC_2010,2,7,8,0,15,5,6 10021_HCMC_2009,2,0,0,0,0,5,0 30366_HCMC_2009,2,0,0,0,0,5,0 KH33_HCMC_2009,2,0,0,0,0,5,0 KH40_HCMC_2009,2,0,0,0,15,5,0 KH32_HCMC_2009,2,0,0,14,15,5,0 KH34_HCMC_2009,2,0,0,14,15,5,0 30003_HCMC_2009,2,0,0,0,0,5,0 KH57_HCMC_2010,2,0,0,0,0,5,0 30451_HCMC_2010,2,0,0,0,0,5,0 HUE46_HCMC_2009,2,0,0,0,0,5,0 EG1017_HCMC_2009,2,7,8,0,0,5,0 EG1014_HCMC_2009,2,7,8,0,0,5,0 EG1018_HCMC_2009,2,7,8,0,0,5,0 EG1022_HCMC_2009,2,7,8,0,0,5,0 EG1019_HCMC_2009,2,7,8,0,0,5,0 10060_HCMC_2009,2,7,8,0,0,5,0 30174_HCMC_2009,2,7,8,0,0,5,0 EG1027_HCMC_0,2,7,8,0,0,5,0 10035_HCMC_2009,2,7,8,0,0,5,0 30162_HCMC_2009,2,7,8,0,0,5,0 10365_HCMC_2010,2,7,8,0,0,5,0 10320_HCMC_2010,2,7,8,0,0,5,0 20343_HCMC_2009,2,7,8,0,0,5,0 30164_HCMC_2009,2,7,8,0,0,5,0 EG1028_HCMC_0,2,7,8,0,0,5,0 EG1016_HCMC_2009,2,7,8,0,0,5,0 30172_HCMC_2009,2,7,8,0,0,5,0 HUE20_HCMC_2009,2,7,8,0,0,5,0 10063_HCMC_2009,2,7,8,0,0,5,0 10014_HCMC_2009,2,7,8,0,0,5,0 EG1020_HCMC_2009,2,7,8,0,0,5,0 EG1021_HCMC_2009,2,7,8,0,0,5,0 HUE19_HCMC_2009,2,7,8,0,0,5,0 20263_HCMC_2009,2,7,8,0,0,5,0 30169_HCMC_2009,2,7,8,0,0,5,0 EG1029_HCMC_0,2,7,8,0,0,5,0 30387_HCMC_2010,2,7,8,0,0,5,0 KH38_HCMC_2009,2,7,8,0,0,5,0 30233_HCMC_2009,2,7,8,0,0,5,0 10188_HCMC_2009,2,7,8,0,0,5,0 10263_HCMC_2009,2,7,8,0,0,5,0 DE0303_HCMC_2000,0,0,0,0,0,5,6 DE0816_HCMC_2001,0,0,0,0,0,5,6 DE0248_HCMC_2000,0,0,0,0,0,5,6 DE0685_HCMC_2001,0,0,0,0,0,5,6 DE0611_HCMC_2001,0,0,0,0,15,5,6 DE0489_HCMC_2000,0,0,0,0,0,5,6 DE0477_HCMC_2000,0,0,0,0,0,5,6 MS0110_HCMC_1996,0,0,0,0,0,5,6 DE0654_HCMC_2001,0,0,0,0,0,5,6 DE0900_HCMC_2001,0,0,0,0,0,5,6 DE0965_HCMC_2001,0,0,0,0,0,5,6 DE1140_HCMC_2002,0,0,0,0,0,5,6 DE0846_HCMC_2001,0,0,0,0,0,5,6 IB2008_Vietnam_2003,0,0,0,0,0,5,6 IB2000_Vietnam_2003,0,0,0,0,0,5,6 DE1318_HCMC_2002,0,0,0,0,0,5,6 MS0128_HCMC_1996,0,0,0,0,0,5,6 DE0127_HCMC_2000,0,0,0,0,0,5,6 DE1256_HCMC_2002,0,0,0,0,0,5,6 DE0115_HCMC_2000,0,0,0,0,0,5,6 DE0427_HCMC_2000,0,0,0,0,0,5,6 DE0295_HCMC_2000,0,0,0,0,0,5,6 IB2004_Vietnam_2003,0,0,0,0,0,5,6 IB1970_Vietnam_2001,0,0,0,0,0,5,6 IB2009_Vietnam_2003,0,0,0,0,0,5,6 IB2015_Vietnam_2002,0,0,0,0,0,5,6 DE0199_HCMC_2000,0,0,0,0,0,5,6 DE1486_HCMC_2002,0,0,0,0,0,5,6 DE1198_HCMC_2002,0,0,0,0,0,5,6 DE0306_HCMC_2000,0,0,0,0,0,5,6 DE1165_HCMC_2002,0,0,0,0,0,5,6 IB2018_Vietnam_2002,0,0,0,0,0,5,6 IB1993_Vietnam_2003,0,0,0,0,0,5,6 IB1990_Vietnam_2003,0,0,0,0,0,5,6 DE1404_HCMC_2002,0,0,0,0,0,5,6 EG0304_HCMC_2006,0,0,0,0,0,5,6 EG0410_HCMC_2007,0,0,0,0,0,5,6 EG0379_HCMC_2007,0,0,0,0,0,5,6 DE1063_HCMC_2002,0,0,0,0,0,5,6 DE1191_HCMC_2002,0,0,0,0,0,5,6 DE1208_HCMC_2002,0,0,0,0,0,5,6 EG0386_HCMC_2007,0,0,0,0,0,5,6 KH42_HCMC_2010,0,0,0,0,15,5,6 HUE25_HCMC_2009,0,0,0,0,0,5,6 EG0373_HCMC_2007,0,7,8,0,0,5,6 HUE26_HCMC_2009,0,0,0,0,0,5,6 HUE47_HCMC_2009,0,0,0,0,0,5,6 HUE16_HCMC_2009,0,0,0,0,0,5,6 HUE23_HCMC_2009,0,0,0,0,0,5,6 HUE21_HCMC_2009,0,0,0,0,0,5,6 HUE67_HCMC_2010,0,0,0,0,0,5,6 HUE64_HCMC_2010,0,0,0,0,0,5,6 HUE27_HCMC_2009,0,0,0,0,0,5,6 HUE24_HCMC_2009,0,0,0,0,0,5,6 HUE48_HCMC_2009,0,0,0,0,0,5,6 HUE60_HCMC_2010,0,0,0,0,0,5,6 HUE57_HCMC_2010,0,0,0,0,0,5,6 HUE68_HCMC_2010,0,0,0,0,0,5,6 HUE62_HCMC_2010,0,0,0,0,0,5,6 HUE43_HCMC_2009,0,0,0,0,0,5,0 HUE33_HCMC_2009,0,0,0,0,15,5,0 10071_HCMC_2009,0,0,0,0,0,5,0 10031_HCMC_2009,0,0,0,0,0,5,0 HUE30_HCMC_2009,0,0,0,0,0,5,0 HUE01_HCMC_2008,0,0,0,0,0,5,0 HUE02_HCMC_2008,0,0,0,0,0,5,0 HUE05_HCMC_2008,0,0,0,0,0,5,0 HUE34_HCMC_2009,0,0,0,0,15,5,0 HUE32_HCMC_2009,0,0,0,0,0,5,0 HUE40_HCMC_2009,0,0,0,0,0,5,0 HUE42_HCMC_2009,0,0,0,0,0,5,0 HUE31_HCMC_2009,0,0,0,0,0,5,0 DE0655_HCMC_2001,0,0,0,0,0,0,0 MS0111_HCMC_1996,0,0,0,0,0,0,0 MS0063_HCMC_1995,0,0,0,0,0,0,0 DE0490_HCMC_2000,4,0,0,0,0,0,0 DE0885_HCMC_2001,4,0,0,0,0,0,0 DE0891_HCMC_2001,4,0,0,0,0,0,0 MS0119_HCMC_1996,0,0,0,0,0,0,0 MS0069_HCMC_1995,0,0,0,0,0,0,0 MS0065_HCMC_1995,0,0,0,0,0,0,0 MS0070_HCMC_1995,0,0,0,0,0,0,0 MS0048_HCMC_1995,0,0,0,0,0,0,0 MS0083_HCMC_1996,0,0,0,0,0,0,0 MS0102_HCMC_1996,0,0,0,0,0,0,0 MS0032_HCMC_1995,0,0,0,0,0,0,0 MS0034_HCMC_1995,0,0,0,0,0,0,0 MS0039_HCMC_1995,0,0,0,0,0,0,0 MS0004_HCMC_1995,0,0,0,0,0,0,0 -------------------------------------------------------------------------------- /A-app-fig-tab.Rmd: -------------------------------------------------------------------------------- 1 | \newpage 2 | 3 | 4 | # Figures and Tables 5 | 6 | 7 | 8 | ```{r facet-geom, echo=FALSE,results='asis'} 9 | 10 | x <- "ggalt\tgeom_dumbbell\tcreates dumbbell charts\n 11 | ggbio\tgeom_alignment\tshows interval data as alignment\n 12 | ggfittext\tgeom_fit_text\tshrinks, grows, or wraps text to fit inside a defined rectangular area\n 13 | gggenes\tgeom_gene_arrow\tdraws genes as arrows\n 14 | ggimage\tgeom_image\tvisualizes image files\n 15 | ggimage\tgeom_phylopic\tqueries image files from the PhyloPic database and visualizes them\n 16 | ggplot2\tgeom_hline\tadds horizontal lines\n 17 | ggplot2\tgeom_jitter\tadds a small amount of random variation to the location of each point\n 18 | ggplot2\tgeom_label\tdraws a rectangle behind the text\n 19 | ggplot2\tgeom_point\tcreates scatterplots\n 20 | ggplot2\tgeom_raster\ta high-performance special case for all the tiles that are the same size\n 21 | ggplot2\tgeom_rect\tdraws rectangle by using the locations of the four corners\n 22 | ggplot2\tgeom_segment\tdraws a straight line between points\n 23 | ggplot2\tgeom_spoke\ta polar parameterization of `geom_segment()'\n 24 | ggplot2\tgeom_text\tadds text to the plot\n 25 | ggplot2\tgeom_tile\tdraws rectangle by using the center of the tile and its size\n 26 | ggplot2\tgeom_vline\tadds vertical lines\n 27 | ggrepel\tgeom_text_repel\tadds text to the plot. The text labels repel away from each other and away from the data points\n 28 | ggrepel\tgeom_label_repel\tdraws a rectangle underneath the text. The text labels repel away from each other and away from the data points\n 29 | ggridges\tgeom_density_ridges\tarranges multiple density plots in a staggered fashion\n 30 | ggridges\tgeom_density_ridges_gradient\tworks just like `geom_density_ridges' except that the `fill' aesthetic can vary along the *x*-axis\n 31 | ggridges\tgeom_ridgeline\tplots the sum of the `y' and `height' aesthetics vs. `x', filling the area between `y' and `y + height' with a color\n 32 | ggridges\tgeom_ridgeline_gradient\tworks just like `geom_ridgeline' except that the `fill' aesthetic can vary along the *x*-axis\n 33 | ggstance\tgeom_barh\thorizontal version of `geom_bar()'\n 34 | ggstance\tgeom_boxploth\thorizontal version of `geom_boxplot()'\n 35 | ggstance\tgeom_crossbarh\thorizontal version of `geom_crossbar()'\n 36 | ggstance\tgeom_errorbarh\thorizontal version of `geom_errorbarh()'\n 37 | ggstance\tgeom_histogramh\thorizontal version of `geom_histogram()'\n 38 | ggstance\tgeom_linerangeh\thorizontal version of `geom_linerange()'\n 39 | ggstance\tgeom_pointrangeh\thorizontal version of `geom_pointrange()'\n 40 | ggstance\tgeom_violinh\thorizontal version of `geom_violin()'\n 41 | ggtree\tgeom_motif\tdraws aligned motifs\n 42 | " 43 | 44 | if (!knitr::is_latex_output()) { 45 | x <- gsub("`", "'", x) 46 | } 47 | 48 | xx <- strsplit(x, "\n\n")[[1]] 49 | y <- strsplit(xx, "\t") %>% do.call("rbind", .) 50 | y <- as.data.frame(y) 51 | colnames(y) <- c("Package", "Geom Layer", "Description") 52 | 53 | require(kableExtra) 54 | 55 | if (knitr::is_latex_output()) { 56 | caption = "Geometric layers that supported by, `geom\\textunderscore facet()'" 57 | } else { 58 | caption = "Geometric layers that supported by `geom_facet()'" 59 | } 60 | 61 | 62 | knitr::kable(y, caption=caption, booktabs = T) %>% 63 | collapse_rows(columns = 1, latex_hline = "major", valign ="top") %>% 64 | kable_styling(latex_options = c("striped", "scale_down", "hold_position"), 65 | bootstrap_options = c("striped", "hover")) %>% landscape 66 | ``` 67 | 68 | 69 | 70 | ```{r tree-objects, echo=FALSE,results='asis'} 71 | x <- tibble::tribble( 72 | ~Package, ~Object, ~Description, 73 | "ape", "phylo", "basic phylogenetic tree structure", 74 | "ape", "multiPhylo", "list of phylo objects", 75 | "ade4", "phylog", "tree structure for ecological data", 76 | "phylobase", "phylo4", "S4 version of phylo object", 77 | "phylobase", "phylo4d", "extend phylo4 with trait data", 78 | "phyloseq", "phyloseq", "phylogenetic tree with microbiome data", 79 | "tidytree", "tbl_tree", "phylogenetic tree as a tidy data frame", 80 | "treeio", "treedata", "phylogenetic tree with heterogeneous associated data", 81 | "treeio", "jplace", "treedata object with placement information", 82 | "stats", "hclust", "hierarchical cluster result", 83 | "stats", "dendrogram", "hierarchical clustering or classification/regression tree", 84 | "cluster", "agnes", "agglomerative hierarchical clustering", 85 | "cluster", "diana", "divisive hierarchical clustering", 86 | "cluster", "twins", "agglomerative or divisive (polythetic) hierarchical clustering", 87 | "pvclust", "pvclust", "hierarchical clustering with p-values calculated by multiscale bootstrap resampling", 88 | "igraph", "igraph", "network (currently only tree graph supported)" 89 | ) 90 | 91 | 92 | y <- as.data.frame(x) 93 | 94 | require(kableExtra) 95 | 96 | 97 | caption = "Tree-like objects supported by ggtree" 98 | 99 | 100 | 101 | knitr::kable(y, caption=caption, booktabs = T) %>% 102 | collapse_rows(columns = 1, latex_hline = "major", valign ="top") %>% 103 | kable_styling(latex_options = c("striped", "scale_down"), 104 | bootstrap_options = c("striped", "hover")) #%>% landscape 105 | 106 | ``` 107 | 108 | 109 | 148 | 149 | 150 | ```{r, child="publications.md"} 151 | ``` 152 | 153 | 154 | 155 | ```{r, eval = FALSE, child="session-info.Rmd"} 156 | ``` 157 | 158 | 159 | -------------------------------------------------------------------------------- /index.Rmd: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Data Integration, Manipulation and Visualization of Phylogenetic Trees' 3 | author: Guangchuang Yu 4 | date: "`r Sys.Date()`" 5 | knit: "bookdown::render_book" 6 | site: bookdown::bookdown_site 7 | header-includes: 8 | - \usepackage{makeidx} 9 | - \makeindex 10 | documentclass: book 11 | classoption: numberinsequence,twoside 12 | bibliography: references.bib 13 | csl: apa.csl 14 | always_allow_html: yes 15 | toc_appendix: yes 16 | toc-depth: 2 17 | link-citations: yes 18 | colorlinks: true 19 | language: 20 | ui: 21 | chapter_name: "Chapter " 22 | lot: yes 23 | lof: yes 24 | fontsize: 11pt 25 | monofont: "Source Code Pro" 26 | monofontoptions: "Scale=0.7" 27 | github-repo: YuLab-SMU/treedata-book 28 | twiter-handle: guangchuangyu 29 | description: "Master ggtree package suite to handle tree with data." 30 | highlight_bw: yes 31 | graphics: yes 32 | #papersize: a4 33 | geometry: "left=35mm,right=35mm,top=25mm,bottom=25mm" 34 | cover-image: book-cover.png 35 | --- 36 | 37 | 38 | ```{r include=FALSE} 39 | source("setup.R") 40 | 41 | options( 42 | htmltools.dir.version = FALSE, formatR.indent = 2, width = 55, digits = 4 43 | ) 44 | 45 | options(tinytex.clean = FALSE) 46 | 47 | ## manual setting. the ropenscilabs/icons package will set up everything for you. 48 | ## fontawesome supports 49 | ## htmltools::tagList(rmarkdown::html_dependency_font_awesome()) 50 | ## icons::download_fontawesome() 51 | 52 | library(knitr) 53 | #knit_hooks$set(crop = hook_pdfcrop) 54 | 55 | opts_chunk$set(message=FALSE, warning=FALSE, eval=TRUE, 56 | echo=TRUE, cache=TRUE, out.width="98%", 57 | fig.process=svg2png) 58 | 59 | if (knitr::is_latex_output()) { 60 | opts_chunk$set(dev = "cairo_pdf") 61 | } else { 62 | opts_chunk$set(dev = "svg") 63 | } 64 | 65 | ``` 66 | 67 | 68 | 69 | 70 | 81 | 82 | \newpage 83 | \frontmatter 84 | # Preface {-} 85 | 86 | 87 | ```{asis, echo=identical(knitr:::pandoc_to(), 'html')} 88 | **Note**: This book has been published by [Chapman & Hall/CRC](https://www.routledge.com/Data-Integration-Manipulation-and-Visualization-of-Phylogenetic-Trees/Yu/p/book/9781032233574). The online version of this book is free to read here (thanks to Chapman & Hall/CRC), and licensed under the [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](http://creativecommons.org/licenses/by-nc-sa/4.0/). 89 |

The ggtree book cover

90 | ``` 91 | 92 | 93 | 94 | I am so excited to have this book published. The book is meant as a guide for data integration, manipulation and visualization of phylogenetic trees using a suite of R packages, `r CRANpkg("tidytree")`, `r Biocpkg("treeio")`, `r Biocpkg("ggtree")` and `r Biocpkg("ggtreeExtra")`. Hence, if you are starting to read this book, we assume you have a working knowledge of how to use R and `r CRANpkg("ggplot2")`. 95 | 96 | The development of the `r Biocpkg("ggtree")` package started during my PhD study at the University of Hong Kong. I joined the State Key Laboratory of Emerging Infectious Diseases (SKLEID) under the supervision of Yi Guan and Tommy Lam. I was asked to provide assistance to modify the newick tree string to incorporate some additional information, such as amino acid substitutions, in the internal node labels of the phylogeny for visualization. I wrote an R script to do it and soon realized that most phylogenetic tree visualization software can only display one type of data through node labels. Basically, we cannot display two data variables at the same time for comparative analysis. In order to produce tree graphs displaying different types of branch/node associated information, such as bootstrap values and substitutions, people mostly relied on post-processing image software. This situation motivates me to develop `r Biocpkg("ggtree")`. First of all, I think a good user interface must fully support the `r CRANpkg("ggplot2")` syntax, which allows us to draw graphs by superimposing layers. In this way, simple graphs are simple, and complex graphs are just a combination of simple layers, which are easy to generate. 97 | 98 | After several years of development, `r Biocpkg("ggtree")` has evolved into a package suite, including `r CRANpkg("tidytree")` for manipulating tree with data using the tidy interface; `r Biocpkg("treeio")` for importing and exporting tree with richly annotated data; `r Biocpkg("ggtree")` for tree visualization and annotation and `r Biocpkg("ggtreeExtra")` for presenting data with a phylogeny side-by-side for a rectangular layout or in outer rings for a circular layout. The `r Biocpkg("ggtree")` is a general tool that supports different types of tree and tree-like structures and can be applied to different disciplines to help researchers presenting and interpreting data in the evolutionary or hierarchical context. 99 | 100 | 101 | ## Structure of the book {-} 102 | 103 | 104 | + Part I (Tree data input, output and manipulation) describes `r Biocpkg("treeio")` package for tree data input and output, and `r CRANpkg("tidytree")` package for tree data manipulation. 105 | + Part II (Tree data visualization and annotation) introduces tree visualization and annotation using the grammar of graphic syntax implemented in the `r Biocpkg("ggtree")` package. It emphasizes presenting tree-associated data on the tree. 106 | + Part III (ggtree extensions) introduces `r Biocpkg("ggtreeExtra")` for presenting data on circular layout trees and other extensions including `r Biocpkg("MicrobiotaProcess")` and `r Biocpkg("tanggle")` *etc*. 107 | + Part IV (Miscellaneous topics) describes utilities provided by the `r Biocpkg("ggtree")` package suite and presents a set of reproducible examples. 108 | 109 | 110 | ```{r, child="software-info.md"} 111 | ``` 112 | 113 | ## Acknowledgments {-} 114 | 115 | Many people have contributed to this book with spelling and grammar corrections. I'd particularly like to thank Shuangbin Xu, Lin Li and Xiao Luo for their detailed technical reviews of the book, and Tiao You for designing the front cover of the book. 116 | 117 | Many others have contributed during the development of the `r Biocpkg("ggtree")` package suite. I would like to thank Hadley Wickham, for creating the `r CRANpkg("ggplot2")` package that `r Biocpkg("ggtree")` relies on; Tommy Tsan-Yuk Lam and Yi Guan for being great advisors and supporting the development of `r Biocpkg("ggtree")` during my PhD; Richard Ree for inviting me to catalysis meeting on phylogenetic tree visualization; William Pearson for inviting me to publish a protocol paper of `r Biocpkg("ggtree")` in the *Current Procotols in Bioinformatics* journal; Shuangbin Xu, Yonghe Xia, Justin Silverman, Bradley Jones, Watal M. Iwasaki, Ruizhu Huang, Casey Dunn, Tyler Bradley, Konstantinos Geles, Zebulun Arendsee and many others who have contributed source code or given me feedback; and last, but not least, the members of the `r Biocpkg("ggtree")` mailing list^[], for providing many challenging problems that have helped improve the `r Biocpkg("ggtree")` package suite. 118 | -------------------------------------------------------------------------------- /data-backup/tree_example_april2015/tree.nwk: -------------------------------------------------------------------------------- 1 | ((((DE0655_HCMC_2001:5.8032794,MS0111_HCMC_1996:0.8032793):3.2539742,(MS0063_HCMC_1995:0.5929808,(DE0490_HCMC_2000:0.6927232,(DE0885_HCMC_2001:0.66264933,DE0891_HCMC_2001:0.66264933):1.0300739):4.9002576):2.4642727):7.377318,((MS0119_HCMC_1996:5.44911,(MS0069_HCMC_1995:0.46310937,(MS0065_HCMC_1995:0.2289469,MS0070_HCMC_1995:0.2289469):0.23416248):3.9860005):4.526132,(MS0048_HCMC_1995:7.537512,(MS0083_HCMC_1996:8.017781,(MS0102_HCMC_1996:4.3871775,(MS0032_HCMC_1995:1.725267,(MS0034_HCMC_1995:1.3453876,(MS0039_HCMC_1995:0.7213195,MS0004_HCMC_1995:0.7213195):0.62406814):0.37987942):1.6619103):3.630604):0.5197302):1.4377306):1.4593295):2.3088996,(((DE0816_HCMC_2001:4.3169746,DE0303_HCMC_2000:3.3169746):1.7689667,((DE1318_HCMC_2002:2.248374,(DE1209_HCMC_2002:1.3276712,(DE1336_HCMC_2002:0.5616553,DE1150_HCMC_2002:0.5616553):0.7660158):0.92070293):4.566584,((MS0110_HCMC_1996:0.38845667,(DE0654_HCMC_2001:1.0745678,DE0900_HCMC_2001:1.0745678):4.313889):0.09005634,(DE0965_HCMC_2001:4.2770276,(DE0846_HCMC_2001:1.3503177,DE1140_HCMC_2002:2.3503177):2.92671):1.2014855):0.33644536):0.27098292):0.36677948,((DE0685_HCMC_2001:3.3104615,(DE0248_HCMC_2000:2.1315928,(DE0611_HCMC_2001:2.1621506,(DE0477_HCMC_2000:0.8892436,DE0489_HCMC_2000:0.8892436):0.2729069):0.96944225):0.17886876):2.8215983,((DE1486_HCMC_2002:5.19946,(DE1198_HCMC_2002:3.4406295,DE0306_HCMC_2000:1.4406294):1.7588307):1.684639,((MS0128_HCMC_1996:0.73830974,((DE0579_HCMC_2001:4.4574614,DE0199_HCMC_2000:3.457461):0.9459294,((DE1256_HCMC_2002:3.7247095,DE0127_HCMC_2000:1.7247095):2.327542,(DE0115_HCMC_2000:2.7405453,(DE0295_HCMC_2000:0.14105976,DE0427_HCMC_2000:0.14105976):2.5994856):1.3117063):0.35113895):0.33491915):0.050606824,(DE1165_HCMC_2002:5.093656,((DE1404_HCMC_2002:0.557506,((KH02_HCMC_2009:2.5800672,EG0385_HCMC_2007:0.5800673):3.9254208,((EG0392_HCMC_2007:1.2242377,EG0372_HCMC_2007:1.2242377):2.93899,(EG0159_HCMC_2007:1.7672435,(30293_HCMC_2009:2.617739,(KH55_HCMC_2010:0.276287,KH54_HCMC_2010:0.276287):3.341452):1.1495047):2.3959842):0.34226042):1.0520179):1.3412366,((EG0304_HCMC_2006:4.813705,(EG0410_HCMC_2007:4.2868924,((10073_HCMC_2009:2.6962647,(KH53_HCMC_2010:2.1526585,(KH41_HCMC_2009:0.29114425,HUE58_HCMC_2010:1.2911443):0.8615141):1.5436063):0.41412598,(EG0404_HCMC_2007:0.7696753,(((KH11_HCMC_2009:0.078025736,KH09_HCMC_2009:0.078025736):0.65184283,(KH27_HCMC_2009:0.35741767,(KH24_HCMC_2009:0.20970763,(KH26_HCMC_2009:0.15865457,KH20_HCMC_2009:0.15865457):0.051053073):0.14771004):0.37245086):1.1103305,(30010_HCMC_2009:1.5896724,(KH37_HCMC_2009:1.1502044,((20261_HCMC_2009:0.08516318,30450_HCMC_2010:1.0851632):0.8404743,(KH35_HCMC_2009:0.7951829,(KH15_HCMC_2009:0.60741717,(KH23_HCMC_2009:0.42464504,KH18_HCMC_2009:0.42464504):0.18277211):0.1877657):0.13045461):0.22456689):0.4394681):0.25052658):0.9294763):0.34071532):3.176502):1.5268124):0.7114763,(((HUE43_HCMC_2009:0.36201376,HUE33_HCMC_2009:0.36201376):7.1241865,((KH42_HCMC_2010:3.3679163,EG0386_HCMC_2007:0.3679164):0.70920086,(10071_HCMC_2009:2.6898785,(10031_HCMC_2009:0.47469062,(HUE30_HCMC_2009:0.0918009,HUE25_HCMC_2009:0.0918009):0.38288972):2.2151878):0.3872388):4.4090834):0.6226607,((EG0379_HCMC_2007:5.4546046,(DE1208_HCMC_2002:0.20387767,(DE1191_HCMC_2002:0.093292266,DE1063_HCMC_2002:0.093292266):0.1105854):0.25072718):0.5096697,((EG0373_HCMC_2007:4.596729,((HUE05_HCMC_2008:0.5661828,(HUE01_HCMC_2008:0.45300022,HUE02_HCMC_2008:0.45300022):0.11318255):0.7151998,((HUE26_HCMC_2009:0.5150966,HUE47_HCMC_2009:0.5150966):1.3821286,((HUE34_HCMC_2009:0.32973218,(HUE16_HCMC_2009:0.075720444,HUE23_HCMC_2009:0.075720444):0.25401172):0.6174645,((HUE42_HCMC_2009:0.6127716,(HUE24_HCMC_2009:0.39078307,HUE48_HCMC_2009:0.39078307):0.2219885):0.12479895,((HUE60_HCMC_2010:0.4141967,(HUE62_HCMC_2010:0.25284857,(HUE68_HCMC_2010:0.1128484,HUE57_HCMC_2010:0.1128484):0.14000016):0.16134813):1.0245577,((HUE40_HCMC_2009:0.18138531,HUE31_HCMC_2009:0.18138531):0.16259845,((HUE27_HCMC_2009:0.09743744,HUE21_HCMC_2009:0.09743744):0.14581622,(HUE32_HCMC_2009:0.16771278,(HUE67_HCMC_2010:0.12057354,HUE64_HCMC_2010:0.12057354):1.0471393):0.07554087):0.10073009):0.094770655):0.29881608):0.20962612):0.9500286):0.38415742):4.3153462):0.70938575,((((EG0318_HCMC_2006:0.7907195,EG1015_HCMC_2009:3.7907195):1.2927706,(EG0315_HCMC_2006:0.6976699,EG0313_HCMC_2006:0.6976699):1.3858202):0.06450212,(EG0129_HCMC_2007:2.1558528,((10021_HCMC_2009:1.5945473,EG0467_HCMC_2008:0.5945472):1.0374268,(30366_HCMC_2009:1.6741632,(KH33_HCMC_2009:1.214116,(((KH17_HCMC_2009:0.20019487,KH21_HCMC_2009:0.20019487):0.46664792,(KH40_HCMC_2009:0.48855478,KH05_HCMC_2009:0.48855478):0.178288):0.36136207,(((KH32_HCMC_2009:0.28143814,(KH19_HCMC_2009:0.09562999,KH14_HCMC_2009:0.09562999):0.18580814):0.2679375,(KH04_HCMC_2009:0.30604878,(KH43_HCMC_2010:1.0811216,KH34_HCMC_2009:0.08112162):0.22492714):0.24332689):0.25284138,(KH30_HCMC_2009:0.6326716,(KH25_HCMC_2009:0.52252483,(KH12_HCMC_2009:0.42703867,(KH07_HCMC_2009:0.24101046,KH06_HCMC_2009:0.24101046):0.1860282):0.095486164):0.11014678):0.16954544):0.2259878):0.18591116):0.46004727):0.9578108):1.5238787):0.9921395):0.32343355,((HUE50_HCMC_2009:0.9875876,HUE29_HCMC_2009:0.9875876):4.093982,(((EG0383_HCMC_2007:1.0930482,(EG0369_HCMC_2007:0.8584623,(30073_HCMC_2009:2.7792876,((EG0362_HCMC_2007:0.5311965,(EG0365_HCMC_2007:0.43008167,EG0375_HCMC_2007:0.43008167):0.10111479):0.15812446,(EG0430_HCMC_2008:1.3735616,(EG0357_HCMC_2007:0.27279392,EG1001_HCMC_2008:1.2727939):0.10076768):0.3157593):0.089966774):0.07917458):0.23458594):0.38436875,((EG0394_HCMC_2007:0.77970237,EG0388_HCMC_2007:0.77970237):0.37730196,(KH16_HCMC_2009:2.8120885,(EG0395_HCMC_2007:0.60353893,(EG0390_HCMC_2007:0.44508734,((KH29_HCMC_2009:0.34328976,KH28_HCMC_2009:0.34328976):1.8971763,((KH10_HCMC_2009:0.083643876,KH13_HCMC_2009:0.083643876):0.8767341,(30003_HCMC_2009:0.72657967,20094_HCMC_2009:0.72657967):0.2337983):1.2800881):0.20462132):0.15845159):0.20854953):0.3449159):0.3204126):1.3297911,((((KH57_HCMC_2010:1.7996426,30451_HCMC_2010:1.7996426):1.505258,(HUE46_HCMC_2009:0.10950728,(HUE53_HCMC_2010:0.40261135,HUE55_HCMC_2010:0.40261135):0.70689595):2.1953933):1.7387503,(EG0309_HCMC_2006:0.5710684,((EG0451_HCMC_2008:0.5512447,EG0425_HCMC_2008:0.5512447):1.8021553,(EG0401_HCMC_2007:1.0234818,(EG0255_HCMC_2008:1.2049158,EG0393_HCMC_2007:0.20491578):0.8185661):0.32991803):0.21766852):0.47258243):0.38384464,((EG1017_HCMC_2009:0.42428076,EG1014_HCMC_2009:0.42428076):3.1158812,(((EG0472_HCMC_2008:1.3247443,(10063_HCMC_2009:1.6660695,(10014_HCMC_2009:1.0079165,(EG1025_HCMC_2009:0.4257418,EG1024_HCMC_2009:0.4257418):0.5821746):0.6581531):0.6586748):0.3036106,((EG1020_HCMC_2009:0.32170457,EG1023_HCMC_2009:0.32170457):1.8825513,((EG1021_HCMC_2009:0.7762185,(HUE17_HCMC_2009:0.1977663,HUE19_HCMC_2009:0.1977663):0.57845217):1.0972601,(EG1008_HCMC_2008:0.7484997,(30169_HCMC_2009:0.42480412,20263_HCMC_2009:0.42480412):1.3236955):0.12497892):0.33077726):0.42409903):0.30794248,((((EG1004_HCMC_2008:0.7502813,(EG1016_HCMC_2009:1.3527408,(10083_HCMC_2009:1.3309634,30100_HCMC_2009:1.3309634):0.021777324):0.39754057):0.20406148,(20006_HCMC_2009:0.5885145,(10159_HCMC_2009:0.46098584,(20021_HCMC_2009:0.09170538,30071_HCMC_2009:0.09170538):0.36928046):0.12752864):1.3658283):0.13290036,(30008_HCMC_2009:0.9339169,(30172_HCMC_2009:0.46886787,((30059_HCMC_2009:0.06837999,10093_HCMC_2009:0.06837999):0.15934758,(10111_HCMC_2009:0.0736825,30054_HCMC_2009:0.0736825):0.15404508):0.24114032):0.46504906):1.1533262):0.488436,(((HUE22_HCMC_2009:0.6245181,(30037_HCMC_2009:0.35643455,(10134_HCMC_2009:0.102605924,30387_HCMC_2010:1.1026059):0.25382864):0.26808354):1.4696217,((30112_HCMC_2009:0.62682027,(10188_HCMC_2009:0.598717,(30371_HCMC_2009:0.12725024,10263_HCMC_2009:0.12725024):0.47146675):0.028103273):0.9045901,((20023_HCMC_2009:1.0931172,((20037_HCMC_2009:0.30523556,30124_HCMC_2009:0.30523556):0.64873445,(KH45_HCMC_2010:1.7549813,20070_HCMC_2009:0.7549813):0.19898874):0.13914724):0.25823042,(10115_HCMC_2009:1.0115757,(KH38_HCMC_2009:0.78829896,(20228_HCMC_2009:0.30395183,30233_HCMC_2009:0.30395183):0.4843471):0.22327676):0.33977196):0.18006267):0.56272936):0.32713786,(((EG1018_HCMC_2009:0.50615525,EG1022_HCMC_2009:0.50615525):0.56690115,(EG1019_HCMC_2009:0.7863105,(10102_HCMC_2009:0.5945545,(30174_HCMC_2009:0.37238792,10060_HCMC_2009:0.37238792):0.22216657):0.19175601):0.2867459):1.1382207,(EG0204_HCMC_2008:1.0480666,(HUE20_HCMC_2009:2.046511,((10152_HCMC_2009:0.8673694,30164_HCMC_2009:0.8673694):0.28193346,((10320_HCMC_2010:1.3126699,20343_HCMC_2009:0.3126699):0.3879042,((10035_HCMC_2009:0.09392745,10135_HCMC_2009:0.09392745):0.33818772,(10365_HCMC_2010:1.1629158,30162_HCMC_2009:0.16291583):0.26919934):0.26845893):0.44872877):0.89720803):0.0015557038):0.16321044):0.21000053):0.15440157):0.36061823):0.6038646):0.88733345):0.37971255):0.27436194):0.3898559):1.8346889):0.6581598):0.14458658):0.41632017):0.3735612):3.1949134):1.6952608):0.09518246):0.24796072):0.320661):12.2907505); 2 | -------------------------------------------------------------------------------- /A-app-tools.Rmd: -------------------------------------------------------------------------------- 1 | 2 | \newpage 3 | 4 | 5 | # Related Tools {#related-tools} 6 | 7 | ## MicrobiotaProcess: Convert Taxonomy Table to a `treedata` Object {#MicrobiotaProcess-taxonomy} 8 | 9 | Taxonomy (genus, family, ...) data are widely used in microbiome or ecology. Hierarchical taxonomies are the tree-like structure that organizes items into subcategories and can be converted to a tree object (see also the [phylog object](#phylog)). The `r Biocpkg("MicrobiotaProcess")` supports converting a `taxonomyTable` object, defined in the `r Biocpkg("phyloseq")` package, to a `treedata` object, and the taxonomic hierarchical relationship can be visualized using `r Biocpkg("ggtree")` (Figure \@ref(fig:TaxaTree)). When there are taxonomy names that are [confused and missing](https://github.com/YuLab-SMU/MicrobiotaProcess/issues/14), the `as.treedata()` method for `taxonomyTable` objects will complete their upper-level taxonomic information automatically. 10 | 11 | 12 | 13 | (ref:TaxaToTreescap) Convert a `taxonomyTable` object to a `treedata` object. 14 | 15 | (ref:TaxaToTreecap) **Convert a `taxonomyTable` object to a `treedata` object.** 16 | 17 | ```{r TaxaTree, fig.widht=8, fig.height=8, fig.cap="(ref:TaxaToTreecap)", fig.scap="ref:TaxaToTreescap"} 18 | library(MicrobiotaProcess) 19 | library(ggtree) 20 | 21 | # The original kostic2012crc is a MPSE object 22 | data(kostic2012crc) 23 | 24 | taxa <- tax_table(kostic2012crc) 25 | #The rownames (usually is OTUs or other features ) of the taxa will be 26 | # served as the tip labels if include.rownames = TRUE 27 | tree <- as.treedata(taxa, include.rownames=TRUE) 28 | # Or extract the taxa tree (treedata) with mp_extract_tree, because the 29 | # taxonomy information is stored as treedata in the MPSE class (kostic2012crc). 30 | # tree <- kostic2012crc %>% mp_extract_tree() 31 | 32 | ggtree(tree, layout="circular", size=0.2) + 33 | geom_tiplab(size=1) 34 | ``` 35 | 36 | ## rtol: An R Interface to Open Tree API {#rtol} 37 | 38 | The `r CRANpkg("rtol")` [@michonneau_rotl:_2016] is an R package to interact with the Open Tree of Life data APIs. Users can use it to query phylogenetic trees and visualize the trees with `r Biocpkg("ggtree")` to explore species relationships (Figure \@ref(fig:rotlSubtree)). 39 | 40 | (ref:rotlSubtreescap) Get an induced subtree from the big Open Tree. 41 | 42 | (ref:rotlSubtreecap) **Get an induced subtree from the big Open Tree.** 43 | 44 | 45 | 46 | ```{r rotlSubtree, fig.width=8, fig.height=6, fig.cap="(ref:rotlSubtreecap)", fig.scap="(ref:rotlSubtreescap)", out.width='100%'} 47 | ## example from: https://github.com/ropensci/rotl 48 | library(rotl) 49 | apes <- c("Pongo", "Pan", "Gorilla", "Hoolock", "Homo") 50 | (resolved_names <- tnrs_match_names(apes)) 51 | tr <- tol_induced_subtree(ott_ids = ott_id(resolved_names)) 52 | ggtree(tr) + geom_tiplab() + xlim(NA, 5) 53 | ``` 54 | 55 | 56 | 57 | ```{r, eval = !knitr::is_latex_output(), child="ggtree-plotly.Rmd"} 58 | ``` 59 | 60 | 61 | ```{r, eval = !knitr::is_latex_output(), child="ggtree-comicR.Rmd"} 62 | ``` 63 | 64 | 65 | ## Print ASCII-art Rooted Tree {#ascii-tree} 66 | 67 | ```{r asciiTree, comment=NA} 68 | library(data.tree) 69 | tree <- rtree(10) 70 | d <- as.data.frame(as.Node(tree)) 71 | names(d) <- NULL 72 | print(d, row.names=FALSE) 73 | ``` 74 | 75 | It is neat to print ASCII-art of the phylogeny. Sometimes, we don't want to plot the tree, but just take a glance at the tree structure without leaving the focus from the R console. However, it is not a good idea to print the whole tree as ASCII text if the tree is large. Sometimes, we just want to look at a specific portion of the tree and its immediate relatives. In this scenario, we can use `treeio::tree_subset()` function (see [session 2.4](subsetting-tree-with-data)) to extract selected portion of a tree. Then we can print ASCII-art of the tree subset to explore the evolutionary relationship of the species of our interest in the R console. 76 | 77 | The `r Biocpkg("ggtree")` supports parsing tip labels as emoji to create [phylomoji](#phylomoji). With the `r CRANpkg("data.tree")` and `r CRANpkg("emojifont")` packages, we can also print phylomoji as ASCII text (Figure \@ref(fig:emojidatatree)). 78 | 79 | 80 | 81 | ```{r asciiTreeEmoji, comment=NA, eval=FALSE} 82 | library(data.tree) 83 | library(emojifont) 84 | 85 | tt <- '((snail,mushroom),(((sunflower,evergreen_tree),leaves),green_salad));' 86 | tree <- read.tree(text = tt) 87 | tree$tip.label <- emoji(tree$tip.label) 88 | d <- as.data.frame(as.Node(tree)) 89 | names(d) <- NULL 90 | print(d, row.names=FALSE) 91 | ``` 92 | 93 | 94 | (ref:emojidatatreescap) Print phylomoji as ASCII text. 95 | 96 | (ref:emojidatatreecap) **Print phylomoji as ASCII text.** 97 | 98 | 99 | 100 | ```{r emojidatatree, echo=FALSE, fig.cap="(ref:emojidatatreecap)", fig.scap="(ref:emojidatatreescap)", out.width='100%'} 101 | knitr::include_graphics("img/data-tree-emojim.png") 102 | ``` 103 | 104 | Another way to print ASCII-art of phylogeny is to use the `ascii()` device defined in the `r pkg_devout` package. Here is an example: 105 | 106 | ```{r devout-ascii, comment=NA} 107 | library(devout) 108 | ascii(width=80) 109 | ggtree(rtree(5)) 110 | invisible(dev.off()) 111 | ``` 112 | 113 | 114 | ## Zoom in on the Selected Portion {#facet-zoom} 115 | 116 | 117 | In addition to using `viewClade()` function, users can use the `r CRANpkg("ggforce")` package to zoom in on a selected clade (Figure \@ref(fig:facetZoom)). 118 | 119 | 120 | (ref:facetZoomscap) Zoom in on a selected clade. 121 | 122 | (ref:facetZoomcap) **Zoom in on a selected clade.** 123 | 124 | 125 | ```{r facetZoom, fig.width=6, fig.height=4, fig.cap="(ref:facetZoomcap)", fig.scap="(ref:facetZoomscap)"} 126 | set.seed(2019-08-05) 127 | x <- rtree(30) 128 | nn <- tidytree::offspring(x, 43, self_include=TRUE) 129 | ggtree(x) + ggforce::facet_zoom(xy = node %in% nn) 130 | ``` 131 | 132 | 133 | ## Tips for Using `ggtree` with `ggimage` {#ggimage-tips} 134 | 135 | The `r Biocpkg("ggtree")` supports annotating a tree with silhouette images via the `r CRANpkg("ggimage")` package. The `r CRANpkg("ggimage")` provides the grammar of graphic syntax to work with image files. It allows processing images on the fly via the `image_fun` parameter, which accepts a function to process `magick-image` objects (Figure \@ref(fig:ggimagebg)). The `r CRANpkg("magick")` package provides several functions, and these functions can be combined to perform a particular task. 136 | 137 | ### Example 1: Remove background of images {#ggimage-rm-image-bg} 138 | 139 | (ref:ggimagebgscap) Remove image background. 140 | 141 | (ref:ggimagebgcap) **Remove image background.** Plotting silhouette images on a phylogenetic tree with background not removed (A) and removed (B). 142 | 143 | 144 | ```{r ggimagebg, fig.width=8, fig.height=4, fig.cap="(ref:ggimagebgcap)", fig.scap="(ref:ggimagebgscap)", out.width='100%'} 145 | library(ggimage) 146 | 147 | imgdir <- system.file("extdata/frogs", package = "TDbook") 148 | 149 | set.seed(1982) 150 | x <- rtree(5) 151 | p <- ggtree(x) + theme_grey() 152 | p1 <- p + geom_nodelab(image=paste0(imgdir, "/frog.jpg"), 153 | geom="image", size=.12) + 154 | ggtitle("original image") 155 | p2 <- p + geom_nodelab(image=paste0(imgdir, "/frog.jpg"), 156 | geom="image", size=.12, 157 | image_fun= function(.) magick::image_transparent(., "white")) + 158 | ggtitle("image with background removed") 159 | plot_grid(p1, p2, ncol=2) 160 | ``` 161 | 162 | ### Example 2: Plot tree on a background image {#ggimage-bgimage} 163 | 164 | The `geom_bgimage()` adds a layer of the image and puts the layer to the bottom of the layer stack. It is a normal layer and doesn't change the structure of the output `ggtree` object. Users can add annotation layers without the background image layer (Figure \@ref(fig:bgimage)). 165 | 166 | (ref:bgimagescap) Use an image file as a tree background. 167 | 168 | (ref:bgimagecap) **Use an image file as a tree background.** 169 | 170 | 171 | ```{r bgimage, fig.width=6, fig.height=4, fig.cap="(ref:bgimagecap)", fig.scap="(ref:bgimagescap)"} 172 | ggtree(rtree(20), size=1.5, color="white") + 173 | geom_bgimage('img/blackboard.jpg') + 174 | geom_tiplab(color="white", size=5, family='xkcd') 175 | ``` 176 | 177 | 178 | ## Run ggtree in Jupyter Notebook 179 | 180 | If you have [Jupyter notebook](https://jupyter.org/) installed on your system, you can install [IRkernel](https://irkernel.github.io/) with the following command in R: 181 | 182 | ```r 183 | install.packages("IRkernel") 184 | IRkernel::installspec() 185 | ``` 186 | 187 | Then you can use `r Biocpkg("ggtree")` and other R packages in the Jupyter notebook (Figure \@ref(fig:jupyter)). Here is a screenshot of recreating Figure \@ref(fig:phylomoji1) in the Jupyter notebook. 188 | 189 | (ref:jupyterscap) ggtree in Jupyter notebook. 190 | 191 | (ref:jupytercap) **ggtree in Jupyter notebook.** Running ggtree in Jupyter notebook via R kernel. 192 | 193 | 194 | ```{r jupyter, echo=F, fig.cap="(ref:jupytercap)", fig.scap="(ref:jupyterscap)", out.width='100%'} 195 | ## htmltools::includeHTML("img/ggtree_jupyter.html") 196 | knitr::include_graphics("img/Screenshot_2019-06-24_ggtree-jupyter.png") 197 | ``` 198 | 199 | 200 | 201 | -------------------------------------------------------------------------------- /others.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | ## to do 5 | https://github.com/YuLab-SMU/ggtree/pull/434 6 | https://github.com/YuLab-SMU/ggtree/issues/367 7 | 8 | ggtree + deeptime can do something like this, . 9 | 10 | + [ introduce align argument in geom_hilight #431 ](https://github.com/YuLab-SMU/ggtree/pull/431) 11 | + [geom_facet() support discrete scale](https://github.com/YuLab-SMU/ggtree/issues/351) 12 | + [geom_cladelab: the devel version of geom_cladelabel to support aes mapping](https://github.com/YuLab-SMU/ggtree/pull/342) 13 | + [add horizontal parameter in geom_cladelabel](https://github.com/YuLab-SMU/ggtree/pull/343) 14 | + [branch size can be grandually changed](https://github.com/YuLab-SMU/ggtree/pull/349) 15 | + [add offset.label and label to geom_treescale](https://github.com/YuLab-SMU/ggtree/pull/360) 16 | + [fix extendto argument for geom_highlight when layout="inward_circular" or "dendrogram"](379) 17 | + [added new default tip.order to ggdensitree that is more similar to DensiTree's](382) 18 | + [update stat method of tree layout](385) 19 | + [ remove inhibit.size and use continuous replace](https://github.com/YuLab-SMU/ggtree/pull/387) 20 | + [The optimization of internal function of geom_tiplab](https://github.com/YuLab-SMU/ggtree/pull/392) 21 | + [optimize the angle of text in geom_cladelab and don't inherit the global aes in geom_cladelab and geom_taxalink](https://github.com/YuLab-SMU/ggtree/pull/396) 22 | + [fix ape layout branch.length](https://github.com/YuLab-SMU/ggtree/pull/403) 23 | + [update geom_tiplab for better compatibility with geom_nodelab](https://github.com/YuLab-SMU/ggtree/pull/406) 24 | + [new geom_nodelab and geom_tiplab](https://github.com/YuLab-SMU/ggtree/pull/408) 25 | + [Update geom_range.R to fix issue #306](https://github.com/YuLab-SMU/ggtree/pull/410) 26 | + [optimizing geom_range to support the mapping of color, size.](https://github.com/YuLab-SMU/ggtree/pull/411) 27 | + [Add branch.y (and branch.x = branch) in calculate_branch_mid() for positioning on branches in unrooted layouts](https://github.com/YuLab-SMU/ggtree/pull/412) 28 | + [add branch.x and branch.y for unrooted layout](https://github.com/YuLab-SMU/ggtree/pull/414) 29 | + [fixed fontface of aes](https://github.com/YuLab-SMU/ggtree/pull/418) 30 | + [add td_mutate and geom_hilight, geom_cladelab supporting fuction data](https://github.com/YuLab-SMU/ggtree/pull/421) 31 | + [fix the issue of data argument of geom_tiplab](https://github.com/YuLab-SMU/ggtree/pull/426) 32 | + [options to control the line type of radial](https://github.com/YuLab-SMU/ggtree/pull/427) 33 | + [ data argument of geom_facet supporting function #430 ](https://github.com/YuLab-SMU/ggtree/pull/430) 34 | + [add `select`, `filter`, `mutate`, `left_join`, `unnest`, `pull` and `rename` verbs for `treedata` object](https://github.com/YuLab-SMU/tidytree/pull/19) 35 | 36 | 37 | 38 | 39 | 40 | 41 | geom_zoom_clade 42 | 43 | ggtree for pvclust 44 | 45 | 46 | + [ggtree - updating a tree view](https://mp.weixin.qq.com/s/csZUfzoluTkXp9DxYR7w6g) 47 | 48 | 49 | ---------------- 50 | 51 | 52 | 写一段ggtree画思维导图的例子。 53 | 54 | x = tribble(~x, ~y, 55 | 'a', 'b', 56 | a', 'c') 57 | ggtree(as.phylo(x), layout='roundrect') + geom_label(aes(label=label)) 58 | 59 | 还可以把原来的label当做是个指代,替换成真正的label,可以用ggtext支持富文本。 60 | 61 | 62 | 63 | + [Regarding "read.beast" function](https://github.com/YuLab-SMU/treeio/issues/43) 64 | + [update method to parse phyloxml format file](https://github.com/YuLab-SMU/treeio/pull/44) 65 | + [Adding read.treeqza to parse tree qza file from output of qiime2](46) 66 | 67 | 68 | + [fix drop.tip when all tips removed](https://github.com/YuLab-SMU/treeio/pull/65) 69 | + [fix the add_pseudo_nodelabel when the node.label is not null in beast file](https://github.com/YuLab-SMU/treeio/pull/64) 70 | + [fixed bug when some node labels are blank in read.beast](https://github.com/YuLab-SMU/treeio/pull/63) 71 | + [to fix issues about additional parameters of drop.tip](https://github.com/YuLab-SMU/treeio/pull/62) 72 | + [As.phylo as.treedata](https://github.com/YuLab-SMU/treeio/pull/61) 73 | + [Optimization read.mcmctree](https://github.com/YuLab-SMU/treeio/pull/60) 74 | + [add read.mcmctree function](https://github.com/YuLab-SMU/treeio/pull/58) 75 | + [fix read.beast](https://github.com/YuLab-SMU/treeio/pull/56) 76 | + [add new as.phylo method for chronos class](https://github.com/YuLab-SMU/treeio/pull/54) 77 | + [fix bug for parsing MrBayes output](https://github.com/YuLab-SMU/treeio/pull/53) 78 | + [update read.fasta](https://github.com/YuLab-SMU/treeio/pull/52) 79 | + [update read.nhx to parse large tree file](https://github.com/YuLab-SMU/treeio/pull/51) 80 | + [Added read.beast.tree and exported write_beast_newick](https://github.com/YuLab-SMU/treeio/pull/50) 81 | + [update read.beast](https://github.com/YuLab-SMU/treeio/pull/48) 82 | 83 | 84 | 85 | 86 | ## tidytree 87 | 88 | + [给进化树加分支](https://mp.weixin.qq.com/s/OBb9sqR9IuEfAzDqEBr6Uw) 89 | 90 | 91 | ## treeio 92 | 93 | + [树变图,图变树?](https://mp.weixin.qq.com/s/Uhx3l3lKQS88OJ4SHntkNg) 94 | + [treeio: 进化树基础类和方法](https://mp.weixin.qq.com/s/uhxCqbnssgP_GHVHqANbaQ) 95 | + [进化树改名](https://mp.weixin.qq.com/s/-v1vklrKRwkEJ0amjVJjJQ) 96 | + [treeio: Phylogenetic data integration](https://mp.weixin.qq.com/s/vLcoF2yMpOa4VzO2nxhZEw) 97 | + [Subsetting Phylogenetic Trees](https://mp.weixin.qq.com/s/-wpzjkpHLGL8jEzNTSivJQ) 98 | + [treeio支持解析MEGA的输出](https://mp.weixin.qq.com/s/Ikp3hq8OBOsdkQY390grqA) 99 | 100 | 101 | 102 | ## ggtree 103 | 104 | 105 | + [Ask me anything about ggtree](https://mp.weixin.qq.com/s/IzSC1GnNPUwKdehhz-U8fQ) 106 | + [当年ggtree发布文,为整合数据而生!](https://mp.weixin.qq.com/s/4g2dPmm5ycTvbube4ujlgQ) 107 | + [ggtree无根树及注释](https://mp.weixin.qq.com/s/Jij3xQhvgsuZBH_g45MvvQ) 108 | + [无根树中加入枝长图例](https://mp.weixin.qq.com/s/kvCuKjHA9qZ6qL-7R855dg) 109 | + [ggtree画根分支](https://mp.weixin.qq.com/s/ObJlBkOTKIYjYpHTww6cIw) 110 | + [phylip树格式](https://mp.weixin.qq.com/s/NcS-yOsRxHJZStiZ7SPw4g) 111 | + [ggtree版本的plotTree](https://mp.weixin.qq.com/s/JM7m7fQSxW7SdRVyGhuxTA) 112 | + [align genomic features with phylogenetic tree](https://mp.weixin.qq.com/s/3j9qg0qpMUsxpp_QkTm9fA) 113 | + [ggjoy facet with ggtree](https://mp.weixin.qq.com/s/iTJzXJRHD3z_rq9OHZJ_4Q) 114 | + [reproducible logo generated by ggtree](https://mp.weixin.qq.com/s/Tp0ydzaInr80S6oVlEsBCA) 115 | + [用ggtree重现Figtree的示例进化树](https://mp.weixin.qq.com/s/3Fc83au6gV5p6ZdlzlAC2w) 116 | + [ggtree for microbiome data](https://mp.weixin.qq.com/s/KScSppwajYsuHuf1w3bQTQ) 117 | + [ggtree for outbreak data ](https://mp.weixin.qq.com/s/eo_lrVctJ3X3OCdAQqK9Dw) 118 | + [ggtree支持phylog对象](https://mp.weixin.qq.com/s/7MFS_OUVB5GkKCnHSGzUGA) 119 | + [ggtree画层次聚类](https://mp.weixin.qq.com/s/tLaboUnsm2iA20PWLuf6yg) 120 | + [用户数据注释进化树](https://mp.weixin.qq.com/s/ClTWsdyIYyHeNN0enwlglw) 121 | + [改变outgroup的枝长](https://mp.weixin.qq.com/s/d2sLLmuMTXLZNfQbWtKUxg) 122 | + [使用自己的数据来给进化树上色](https://mp.weixin.qq.com/s/8ryU-3HjMvE7RFgo4rQ3Ew) 123 | + [bootstrap分段标记](https://mp.weixin.qq.com/s/7dq1br8LCY5jAtQDm1bXPg) 124 | + [ggtree中标记树分支?](https://mp.weixin.qq.com/s/nlAGbHMJ2tBEaaBxCQC13A) 125 | + [xlim_tree: set x axis limits for only Tree panel](https://mp.weixin.qq.com/s/eOSLVtLC0KM61DVQjpCcig) 126 | + [reverse time scale](https://mp.weixin.qq.com/s/JdjWAIFfGDKBzYQOabzKaw) 127 | + [vertical dendrogram in ggtree](https://mp.weixin.qq.com/s/2sV5wGux37ytBZulB3p3JA) 128 | + [中空的环形树](https://mp.weixin.qq.com/s/7W6Z7wVQZEPR1A5P-sMHZA) 129 | + [可视化操作树的拓扑结构](https://mp.weixin.qq.com/s/SbAyY4WzB7hNRbID48NIgg) 130 | + [ggtree - updating a tree view](https://mp.weixin.qq.com/s/csZUfzoluTkXp9DxYR7w6g) 131 | + [facet_plot: 加图层到特定的分面上](https://mp.weixin.qq.com/s/hY38gr2x8AqRaTh4C7mrnA) 132 | + [facet_plot:加图层到特定分面,方法二](https://mp.weixin.qq.com/s/PnbasfW4HKILuZNdrLVX_g) 133 | + [facet_plot: 关联数据和进化树的通用方法](https://mp.weixin.qq.com/s/FlrnY9GeV5fHa6EZpZhTJA) 134 | + [facet_plot更改panel label](https://mp.weixin.qq.com/s/RC9TsEZRjflIZE15xpa0sg) 135 | + [同时让N颗树关联同一个数据集](https://mp.weixin.qq.com/s/LTK1tDPLEk8_BWEVB9kReQ) 136 | + [漫画版的进化树你见过吗?](https://mp.weixin.qq.com/s/P7yUFLwW4OLGBrPw05iQ_A) 137 | + [取子集画图](https://mp.weixin.qq.com/s/JXpakSKqPPRHhcyQQVdoGA) 138 | + [Y叔不想养蛙,只想养你!](https://mp.weixin.qq.com/s/S5K9HwgCC2LtUJsnKBx0Yg) 139 | + [用图片注释进化树](https://mp.weixin.qq.com/s/BV-8HtiZC-XSHUVAwiS7Vw) 140 | + [当生物女博士遇到小学二年级语文作业](https://mp.weixin.qq.com/s/BJjy28aru_l40v-jdPnSPA) 141 | + [identify: 交互式操作进化树](https://mp.weixin.qq.com/s/PIns29a9pwrUSK6kWpUBIw) 142 | + [plotly: 交互式探索进化树](https://mp.weixin.qq.com/s/a0XHr8Vfr49tEBYZWoRBxA) 143 | + [ggnetworx:让ggtree支持phylogenetic networks](https://mp.weixin.qq.com/s/YytLpKKkTqqpcrJJLFOhjg) 144 | + [ggtree买家秀](https://mp.weixin.qq.com/s/W9UI9doKKeq8YhbcA0N-_A) 145 | + [ggplot2 - 更改分面的相对宽度](https://mp.weixin.qq.com/s/72UHjAQTRXuHzoeWUc-ccA) 146 | + [听说你想画好几颗树在一起](https://mp.weixin.qq.com/s/Hx9fI-JaMN7gY_vElQiQKg) 147 | + [倒不如画一些渐变色的线条吧](https://mp.weixin.qq.com/s/0WGS6b11F1Ul0ZkceKYOvQ) 148 | + [python的世界里没有这么好的工具!](https://mp.weixin.qq.com/s/zops2EyAdJsLtBcGcxa3ZQ) 149 | + [风儿啊,它吹乱了我的头发](https://mp.weixin.qq.com/s/iUUyXtJG3Fj3uPfvfHmdQA) 150 | + [ggtree在线书](https://mp.weixin.qq.com/s/NwYXAxhAQNW0Xmq21FY2nw) 151 | + [进化树和基因组结构](https://mp.weixin.qq.com/s/rm6x7-sWnvQ9qRn26eP2nQ) 152 | + [ggtree所支持的各种树的布局](https://mp.weixin.qq.com/s/E0MfgCFdMxJyrVqpmwNUgA) 153 | + [进化树上随意选几条边来上色](https://mp.weixin.qq.com/s/TssW_2exj54YYrgHro3dtg) 154 | + [进化树上随意选几条边,换线条类型!](https://mp.weixin.qq.com/s/FcigGbaRR2RKTTza7fWx1w) 155 | + [听说你想在系统发育树上随意加个点?](https://mp.weixin.qq.com/s/L1eNG-bGXQmHu3spQoINRg) 156 | + [这么多年了,终于有个故事可以讲](https://mp.weixin.qq.com/s/okDgKJgV8wr5xDMufOEihw) 157 | + [对ggplot2指定的分面,任性调整xlim和分面宽度!](https://mp.weixin.qq.com/s/ClGhvr_sJi-6-SN8hgRUyg) 158 | + [给不同的分面分别设置x label?](https://mp.weixin.qq.com/s/sIoXMP000HJGEgAalTCrWg) 159 | + [度量生物多样性](https://mp.weixin.qq.com/s/ntgUi0-AZOu5nbZHvSS9aQ) 160 | + [进化树与序列的距离矩阵](https://mp.weixin.qq.com/s/Vb9MBt419sO69UOPfEb0UQ) 161 | + [画两颗面对面的树,还要分别加注释!](https://mp.weixin.qq.com/s/jevqlyaf7c7zudQCAkylJQ) 162 | + [对进化树的分支长度做数据变换](https://mp.weixin.qq.com/s/rUgOI2uMjE_lK4ou9x2hUw) 163 | + [一个legend伪装成三个,服气!](https://mp.weixin.qq.com/s/OcTP0mU3LPraza-7EHmy2w) 164 | + [听说你想给线条画个边框?](https://mp.weixin.qq.com/s/Cq6e_ZBUgyZtxJOHiXkpZA) 165 | + [纯文本的进化树](https://mp.weixin.qq.com/s/inI7RtaFAg3g9oH3iwMLwg) 166 | + [用ggtree画思维导图,小白也能学会!](https://mp.weixin.qq.com/s/NArmAQJp5OPt_SEVGmGv8g) 167 | 168 | 169 | 170 | ### ggtreeExtra 171 | 172 | + [用图层叠加方法绘制环形进化树](https://mp.weixin.qq.com/s/Il8yZqUoBVCvND7U7HKxxA) 173 | + [用ggtreeExtra给进化树加热图](https://mp.weixin.qq.com/s/rhv7xLgrY1TlpfbC_riAvQ) 174 | ### 直播 175 | 176 | + [webinar录播 (2017-10-24):plotting tree + data](https://mp.weixin.qq.com/s/YuUOztQg3nUnhdvyg8asvg) 177 | + [ggtree直播PPT第一部分](https://mp.weixin.qq.com/s/3yEN-8oUck2WPmNQ368qYA) 178 | + [ggtree直播PPT第二部分](https://mp.weixin.qq.com/s/7-YhGzzu_tVAwySrYOKGFg) 179 | 180 | -------------------------------------------------------------------------------- /data-backup/HMP_tree/hmptree.nwk: -------------------------------------------------------------------------------- 1 | ((t640427121:0.62306,t637000163:0.86427)1.00:1.20714,((t637000327:0.43426,(t649990026:0.44157,t645951869:0.42069)0.82:0.13553)1.00:2.28724,((((((t646206254:0.25238,(t645951859:0.05372,t646206275:0.05447)1.00:0.20326)1.00:0.22069,(t645951804:0.43651,(t647000254:0.08827,t645951848:0.09514)1.00:0.49290)0.76:0.12629)Fusobacterium1.00:0.57061,(t646311956:0.94182,(t647000268:0.25552,(t644736384:0.05250,t645951860:0.04949)1.00:0.25915)1.00:0.26943)1.00:0.55191)1.00:1.20558,((((t645951833:0.45158,t649989928:0.49364)1.00:0.86254,(t649989971:0.77561,(t648276753:0.08735,(t647000331:0.04084,t643886074:0.03151)1.00:0.07723)Veillonella1.00:0.87508)0.85:0.20223)1.00:0.34970,(t646311901:1.24020,(t650377958:0.64183,(t645951802:0.45313,(t642979367:0.31026,(t649989996:0.13520,(t645058738:0.18190,t645951808:0.12394)0.98:0.06557)1.00:0.46726)Selenomonas1.00:0.13201)1.00:0.24998)1.00:0.42320)0.79:0.12649)1.00:0.64941,(((((t645058834:0.12489,t649989952:0.13364)1.00:1.27427,(t650377974:0.24803,(t637000284:0.21116,(t646862342:0.17560,((t645058825:0.11274,(t643886010:0.08795,t637000281:0.10708)1.00:0.04396)0.89:0.02581,(t646564572:0.16321,(t643886039:0.11753,t642555160:0.09339)1.00:0.05215)1.00:0.05109)1.00:0.04368)1.00:0.08360)1.00:0.15227)Staphylococcus1.00:0.76048)0.95:0.25974,(t646311941:0.73682,((t647000207:1.06835,((t645951817:0.23965,t647533172:0.24700)1.00:0.39312,t643886188:0.99035)0.97:0.16723)1.00:0.19148,((((t644736382:0.05582,(t639633028:0.01316,t643886139:0.00679)1.00:0.06408)1.00:0.59390,(((t643886217:0.37955,t650377954:0.41989)0.97:0.06199,(t641228495:0.11149,(t650716045:0.08682,t647533176:0.08356)0.94:0.03880)1.00:0.17549)1.00:0.10128,(t648276682:0.48918,t645058712:0.17334)0.46:0.06868)1.00:0.76878)1.00:0.19034,(((t647533194:0.66861,(t639633027:0.48736,t644736381:0.42525)0.25:0.08973)0.25:0.05962,(((t649989969:0.16765,(t638341112:0.21999,t643886050:0.17986)0.95:0.04552)1.00:0.11993,(t647533178:0.31353,t646206276:0.30158)1.00:0.09813)1.00:0.37331,(t643886109:0.17390,(t649633064:0.14957,t641522636:0.17750)1.00:0.12022)1.00:1.02166)1.00:0.11589)1.00:0.10672,(t648276684:0.31905,t643886045:0.37635)1.00:0.29763)0.25:0.08750)Lactobacillus1.00:0.40974,((t650377929:0.26419,(t647533156:0.27068,t647533146:0.27655)0.97:0.07084)1.00:0.22589,(t640069315:0.62191,(((t637000302:0.04157,(t649990016:0.02274,t651053073:0.02748)0.68:0.02378)1.00:0.18880,(t646564575:0.25367,((t638341202:0.22691,(t648276747:0.08769,t650377975:0.04808)1.00:0.18943)1.00:0.08425,(t648276732:0.05642,t641736171:0.06627)1.00:0.12518)0.66:0.04343)0.91:0.04846)1.00:0.08064,(t648276749:0.33677,((((t649990007:0.02984,t649990011:0.06508)1.00:0.03108,(t648028055:0.06246,(t648276734:0.02455,(t649990014:0.01580,t648276739:0.03819)1.00:0.01296)1.00:0.02508)1.00:0.03783)1.00:0.10028,(t650716089:0.09784,t649990003:0.09781)1.00:0.07427)0.99:0.03355,(t649990001:0.18358,(t649990004:0.09027,t640753055:0.12204)0.94:0.04117)0.99:0.04208)1.00:0.10884)0.89:0.05668)Streptococcus1.00:0.45364)1.00:0.54881)0.66:0.10830)1.00:0.15718)1.00:0.40753)1.00:0.23244)1.00:0.79854,(((t646206251:0.54983,t643886110:0.61644)1.00:0.61319,(t643886103:0.68403,(t647000218:0.69258,t649989999:0.37936)1.00:0.66872)1.00:0.62461)0.91:0.23036,(t637000332:1.42246,t646311946:1.12938)1.00:1.33031)0.99:0.33694)1.00:0.63232,(((((t648276710:0.73586,(t649989982:0.48914,t647000289:0.54665)1.00:0.25699)1.00:0.47470,(((t645058761:0.07756,t651324009:0.13259)Anaerococcus1.00:0.32698,(t643886145:0.38805,t643886055:0.32650)1.00:0.17811)1.00:0.89120,(t641380421:1.14288,t648276674:0.87140)0.94:0.24806)1.00:0.23400)1.00:0.47471,t645058705:2.31829)0.95:0.18894,(((t648276712:0.28770,t647000290:0.29998)1.00:0.46439,(t642979371:0.37921,(t640069308:0.28255,t641736113:0.51731)1.00:0.12697)0.97:0.15256)1.00:0.65624,(t637000077:0.63998,t643692016:0.63175)1.00:0.66995)1.00:0.21158)0.49:0.11264,(((t643886181:1.04955,(t650377925:0.74496,(((((t642979369:0.37442,((t640963057:0.22659,(t642791604:0.21513,t640963025:0.26241)1.00:0.09125)1.00:0.13482,(t643886116:0.39599,((t642979359:0.23361,t641736197:0.20069)1.00:0.10447,(t641736133:0.28228,t640963046:0.19463)Dorea0.99:0.06006)1.00:0.09792)0.60:0.04989)Ruminococcus0.86:0.06459)1.00:0.17849,(t643886107:0.54690,(t643886146:0.48773,(t640963024:0.39829,t643886199:0.42881)0.43:0.09687)1.00:0.11526)1.00:0.13359)1.00:0.09840,((t643886104:1.30009,t649989950:0.71542)1.00:0.25959,(t649989922:0.48403,((t641380428:0.19283,t643886112:0.24361)1.00:0.17973,(t648028018:0.22906,t645951835:0.20343)1.00:0.16395)0.99:0.08667)1.00:0.13977)Clostridium1.00:0.19948)0.92:0.05894,(((t645951834:0.70309,(t642979337:0.42615,t644736366:0.44103)1.00:0.20028)0.99:0.14220,((t644736367:0.46986,(t642979356:0.22225,t643886006:0.20446)Roseburia1.00:0.16571)1.00:0.13546,t643886070:1.03339)1.00:0.14903)0.24:0.06889,t640963022:0.79399)0.20:0.05298)1.00:0.08365,(t641380422:0.78877,(t643886203:0.56913,t641736227:0.68083)1.00:0.14367)1.00:0.12104)0.97:0.07985)1.00:0.13824)1.00:0.71173,((((t640963014:1.43820,(t643886206:0.85890,t641736271:0.76972)0.99:0.13558)0.28:0.08445,(t641380427:0.59471,t650377966:0.87211)1.00:0.29480)1.00:0.11825,(t643886143:0.47083,t645951831:0.45539)1.00:0.87717)0.94:0.08006,(t650377938:0.88859,t649633094:0.80911)1.00:0.27472)1.00:0.44590)1.00:0.35200,(t641736193:1.29702,(t649989993:0.77072,:0.52965)1.00:0.66328)Eubacterium1.00:0.33542)0.81:0.11757)1.00:0.26344)1.00:0.17478)0.99:0.22121)0.99:0.22203,(t645951855:0.85506,t647000302:0.62721)1.00:1.79347)0.95:0.12970,(((((((t649989980:0.44052,(t646311928:0.30197,(t643348515:0.29154,((t641736189:0.07804,(t639633010:0.06256,(t642979313:0.02455,t642979312:0.02065)1.00:0.04651)0.89:0.02633)1.00:0.07669,(t642979361:0.16891,(t643886040:0.16533,(t651053005:0.05719,t642555107:0.04800)1.00:0.10646)1.00:0.07163)0.19:0.03981)1.00:0.07782)Bifidobacterium1.00:0.09572)1.00:0.15045)1.00:0.99317,(t648028043:0.79096,(t640963058:0.53569,(t643886015:0.22340,(t649989905:0.02479,t649989901:0.03171)1.00:0.18047)1.00:0.35723)Actinomyces0.62:0.10256)1.00:0.16599)0.99:0.11386,(t644736390:0.52702,(t642555133:0.36312,(t649633093:0.12636,t645058800:0.11675)1.00:0.44380)1.00:0.15632)1.00:0.34427)0.99:0.14775,(t641522641:0.59182,(t642979306:0.44711,((t643692019:0.48635,t647000231:0.38762)0.99:0.08924,(t648276634:0.38218,(t648276633:0.36355,((t643886058:0.09939,(t645058719:0.01224,t643886084:0.01137)1.00:0.06277)1.00:0.09133,(t643692018:0.13765,t643886057:0.14215)1.00:0.06077)1.00:0.21220)1.00:0.11135)1.00:0.15171)0.28:0.06082)Corynebacterium1.00:0.33701)1.00:0.39785)0.71:0.15358,(t651053058:0.52830,t649633084:0.56550)1.00:0.32539)1.00:1.85856,((t645951837:0.55683,(t644736346:0.56842,(t644736358:0.14675,t650377943:0.26040)1.00:0.23770)0.89:0.12932)1.00:0.30101,((t640612206:0.26559,(t642979321:0.12573,t642979320:0.10309)1.00:0.21297)1.00:0.34617,((t644736327:0.24170,t643886019:0.21960)1.00:0.25083,(t648028047:0.31060,t643886063:0.66789)1.00:0.11596)1.00:0.25201)1.00:0.48659)1.00:1.06483)1.00:0.63684,((t640069321:3.07389,(t640753047:1.82952,t637000092:2.64294)0.79:0.17326)0.86:0.17192,((((t637000271:0.90984,((t645058865:0.55603,(t639279312:0.47208,t641522638:0.54130)1.00:0.15964)1.00:0.24275,((t640069327:0.34903,t639633048:0.31147)1.00:0.54194,t648028010:0.94428)0.77:0.10475)1.00:0.17230)1.00:0.67617,((((t643886193:0.21583,(t647533210:0.24836,t649989956:0.19210)0.16:0.04382)1.00:0.11587,(t643886208:0.25511,(t647000283:0.15188,((t643886150:0.02189,t645058748:0.03897)1.00:0.03584,((t643886198:0.02189,t643886194:0.03018)1.00:0.07738,(t643886151:0.03095,(t647000284:0.01736,(t649633075:0.04336,(t641228498:0.02255,t647533186:0.03199)0.80:0.00819)1.00:0.01841)1.00:0.03098)1.00:0.06066)0.97:0.02113)1.00:0.11898)Neisseria1.00:0.12313)0.58:0.04778)1.00:0.82985,(t649990021:1.28919,(t649989970:0.76755,(t641228489:0.68974,(t637000046:0.45744,(t648028033:0.29669,t646206250:0.56508)1.00:0.21135)0.60:0.11121)0.97:0.11702)0.79:0.09869)1.00:0.18159)1.00:0.26088,(t642555169:1.19932,((((t643886024:0.30159,(t640753048:0.19241,(t651053056:0.22624,((t649633041:0.08649,((t643348560:0.00642,t646311937:0.00303)1.00:0.09381,t642979368:0.11613)0.84:0.02239)1.00:0.03586,(((t646862322:0.00605)Escherichia:0.00000,((t641522650:0.02230,t638341196:0.11900)1.00:0.00695,t640427143:0.01101)0.92:0.01075)0.82:0.01536,t643692022:0.03992)1.00:0.07254)1.00:0.12056)0.99:0.06453)1.00:0.09181)1.00:0.26445,((t641736156:0.17684,(t643886008:0.21958,t647533181:0.15327)0.60:0.04229)1.00:0.16278,(t640753001:0.25735,(t637000127:0.22907,((t637000203:0.10224,t647000288:0.09674)1.00:0.10841,((t649989906:0.05089,(t644736324:0.05395,t648028005:0.07584)0.91:0.02238)1.00:0.12402,(t651324039:0.08635,t650377944:0.13190)Haemophilus1.00:0.10250)1.00:0.05068)1.00:0.05656)0.35:0.04382)1.00:0.08047)1.00:0.40025)1.00:0.65600,((t638341158:0.20534,(t637000221:0.14730,t650377963:0.14842)1.00:0.14042)1.00:0.47929,((t646206271:0.10752,((t650377901:0.09491,t646206269:0.10747)1.00:0.06303,(t646206268:0.09860,t646206270:0.10625)1.00:0.05730)0.66:0.03487)Acinetobacter1.00:0.47243,(t646564552:0.49830,(t645951810:0.35249,(t637000226:0.03139,t637000227:0.03298)1.00:0.36282)0.57:0.10347)1.00:0.38615)1.00:0.66564)0.11:0.13932)1.00:0.22480,t645951819:1.42192)0.72:0.10714)0.54:0.14593)1.00:0.92506)1.00:0.75294,((t637000095:0.51681,(t649989917:0.53898,t642979316:0.60272)0.97:0.14948)1.00:1.38324,(t651053029:1.16977,(((t643886009:0.06077,t645058720:0.03647)1.00:0.23775,(t640753010:0.20079,t640753009:0.19765)1.00:0.10310)1.00:0.18727,(t645951857:0.34592,t640753011:0.40921)1.00:0.15998)Campylobacter1.00:0.67270)1.00:1.68116)0.08:0.13022)1.00:0.33470,(((t643886113:0.38687,(t642979305:0.05235,t649989920:0.04871)1.00:0.27483)1.00:0.52426,((t650377904:0.28945,t641736205:0.19327)1.00:0.71790,(t649633078:0.78521,((((t645951840:0.63372,(t648276716:0.30892,(((t649989986:0.19496,t643886200:0.25794)0.98:0.05732,((t648861012:0.07642,t649989989:0.10016)1.00:0.18949,(t645951825:0.33423,((t649989987:0.10015,(t648028051:0.08147,t645951836:0.10696)0.71:0.01992)1.00:0.07452,(t648276715:0.23810,(t648276713:0.17513,t647000292:0.08733)1.00:0.16206)0.99:0.06486)1.00:0.13555)0.99:0.05663)0.16:0.04370)1.00:0.06497,(t649989988:0.19822,(t647000293:0.12894,t647000295:0.14334)1.00:0.17101)0.78:0.04980)1.00:0.08817)1.00:0.26393)Prevotella1.00:0.24393,(((t645058788:0.12426,((t640963023:0.04145,(t642979319:0.05529,(t647000215:0.03155,t651324012:0.01315)1.00:0.02808)1.00:0.01776)0.98:0.01819,t637000026:0.04422)1.00:0.07121)1.00:0.04571,((t643886111:0.03342,t642791621:0.03498)1.00:0.07882,((t649989912:0.03891,t641736196:0.03700)1.00:0.05264,(t641380447:0.06685,t649633012:0.11346)0.99:0.02194)1.00:0.05685)1.00:0.05907)1.00:0.11533,((t642979370:0.00899,t640753008:0.01095)1.00:0.14185,(t643886197:0.11996,(t642979351:0.13831,(t649633013:0.16743,t642791613:0.09293)0.20:0.02952)0.94:0.02920)1.00:0.11861)1.00:0.09617)Bacteroides1.00:0.11562)1.00:0.24050,(t640753039:0.13352,(t640963016:0.03471,t642979358:0.02476)1.00:0.10827)1.00:0.23309)0.99:0.15469,(t642555148:0.39212,(t643886148:0.52057,(t649989985:0.02086,t643886142:0.03850)1.00:0.75598)1.00:0.27610)Porphyromonas1.00:0.27541)1.00:0.35830)0.49:0.16069)1.00:0.60588)1.00:1.04257,(t642555104:1.87557,t650633000:2.10387)0.95:0.37071)0.77:0.31073)0.99:0.21945)1.00:0.23723)0.83:0.13130)0.80:0.16410):1.20714):1.00000; 2 | -------------------------------------------------------------------------------- /data-backup/HMP_tree/barplot_attr.csv: -------------------------------------------------------------------------------- 1 | ID,Sites,HigherAbundance 2 | t637000026,Stool (prevalence),0.1322531 3 | t637000046,Vagina (prevalence),0.035 4 | t637000077,Stool (prevalence),0.035 5 | t637000092,Stool (prevalence),0.035 6 | t637000095,Stool (prevalence),0.035 7 | t637000127,Plaque (prevalence),0.035 8 | t637000163,Stool (prevalence),0.035 9 | t637000203,Tongue (prevalence),0.035 10 | t637000221,Vagina (prevalence),0.035 11 | t637000226,Stool (prevalence),0.035 12 | t637000227,Stool (prevalence),0.035 13 | t637000271,Stool (prevalence),0.035 14 | t637000281,Skin (prevalence),1.7287928 15 | t637000284,Stool (prevalence),0.035 16 | t637000302,Tongue (prevalence),0.035 17 | t637000327,Plaque (prevalence),0.0384153 18 | t637000332,Vagina (prevalence),0.0789712 19 | t638341112,Stool (prevalence),0.035 20 | t638341158,Stool (prevalence),0.035 21 | t638341196,Stool (prevalence),0.035 22 | t638341202,Stool (prevalence),0.035 23 | t639279312,Stool (prevalence),0.035 24 | t639633010,Stool (prevalence),0.0418075 25 | t639633027,Stool (prevalence),0.035 26 | t639633028,Stool (prevalence),0.035 27 | t639633048,Stool (prevalence),0.035 28 | t640069308,Stool (prevalence),0.035 29 | t640069315,Stool (prevalence),0.035 30 | t640069321,Tongue (prevalence),0.035 31 | t640069327,Stool (prevalence),0.035 32 | t640427121,Stool (prevalence),0.035 33 | t640427143,Stool (prevalence),0.035 34 | t640612206,Stool (prevalence),0.035 35 | t640753001,Stool (prevalence),0.035 36 | t640753008,Stool (prevalence),1.31244295 37 | t640753009,Tongue (prevalence),0.4131946 38 | t640753010,Plaque (prevalence),0.035 39 | t640753011,Stool (prevalence),0.035 40 | t640753039,Stool (prevalence),0.0596358 41 | t640753047,Stool (prevalence),0.035 42 | t640753048,Stool (prevalence),0.035 43 | t640753055,Plaque (prevalence),0.0598542 44 | t640963014,Stool (prevalence),0.035 45 | t640963016,Stool (prevalence),0.54832785 46 | t640963022,Stool (prevalence),0.0390922 47 | t640963023,Stool (prevalence),0.5207622 48 | t640963024,Stool (prevalence),0.035 49 | t640963025,Stool (prevalence),0.1643698 50 | t640963046,Stool (prevalence),0.035 51 | t640963057,Stool (prevalence),0.035 52 | t640963058,Tongue (prevalence),0.13555815 53 | t641228489,Stool (prevalence),0.035 54 | t641228495,Stool (prevalence),0.035 55 | t641228498,Plaque (prevalence),0.035 56 | t641380421,Tongue (prevalence),0.035 57 | t641380422,Stool (prevalence),0.035 58 | t641380427,Stool (prevalence),0.035 59 | t641380428,Stool (prevalence),0.035 60 | t641380447,Stool (prevalence),0.21505365 61 | t641522636,Stool (prevalence),0.035 62 | t641522638,Stool (prevalence),0.035 63 | t641522641,Stool (prevalence),0.035 64 | t641522650,Stool (prevalence),0.035 65 | t641736113,Stool (prevalence),0.035 66 | t641736133,Stool (prevalence),0.035 67 | t641736156,Stool (prevalence),0.035 68 | t641736171,Stool (prevalence),0.035 69 | t641736189,Stool (prevalence),0.035 70 | t641736193,Stool (prevalence),0.035 71 | t641736196,Stool (prevalence),0.69204345 72 | t641736197,Stool (prevalence),0.035 73 | t641736205,Stool (prevalence),1.0281943 74 | t641736227,Stool (prevalence),0.035 75 | t641736271,Stool (prevalence),0.035 76 | t642555104,Stool (prevalence),0.1756692 77 | t642555107,Stool (prevalence),0.035 78 | t642555133,Stool (prevalence),0.035 79 | t642555148,Tongue (prevalence),0.035 80 | t642555160,Stool (prevalence),0.035 81 | t642555169,Stool (prevalence),0.035 82 | t642791604,Stool (prevalence),0.0409892 83 | t642791613,Stool (prevalence),0.08686685 84 | t642791621,Stool (prevalence),0.0675612 85 | t642979305,Plaque (prevalence),0.34347635 86 | t642979306,Skin (prevalence),0.035 87 | t642979312,Stool (prevalence),0.035 88 | t642979313,Stool (prevalence),0.035 89 | t642979316,Stool (prevalence),0.035 90 | t642979319,Stool (prevalence),0.3462326 91 | t642979320,Stool (prevalence),0.035 92 | t642979321,Stool (prevalence),0.035 93 | t642979351,Stool (prevalence),0.1613409 94 | t642979356,Stool (prevalence),0.1223558 95 | t642979358,Stool (prevalence),0.07141785 96 | t642979359,Stool (prevalence),0.035 97 | t642979361,Stool (prevalence),0.035 98 | t642979367,Plaque (prevalence),0.035 99 | t642979368,Stool (prevalence),0.035 100 | t642979369,Stool (prevalence),0.035 101 | t642979370,Stool (prevalence),0.03755955 102 | t642979371,Stool (prevalence),0.035 103 | t643348515,Stool (prevalence),0.035 104 | t643348560,Stool (prevalence),0.035 105 | t643692016,Stool (prevalence),0.035 106 | t643692018,Stool (prevalence),0.035 107 | t643692019,Skin (prevalence),1.7536435 108 | t643692022,Stool (prevalence),0.035 109 | t643886006,Stool (prevalence),0.11314555 110 | t643886008,Cheek (prevalence),0.035 111 | t643886009,Plaque (prevalence),0.035 112 | t643886010,Skin (prevalence),0.0881097 113 | t643886015,Plaque (prevalence),0.035 114 | t643886019,Plaque (prevalence),0.035 115 | t643886024,Stool (prevalence),0.035 116 | t643886039,Skin (prevalence),0.035 117 | t643886040,Stool (prevalence),0.035 118 | t643886045,Stool (prevalence),0.035 119 | t643886050,Vagina (prevalence),0.035 120 | t643886055,Vagina (prevalence),0.035 121 | t643886057,Stool (prevalence),0.035 122 | t643886058,Nose (prevalence),2.1912912 123 | t643886063,Vagina (prevalence),0.035 124 | t643886070,Plaque (prevalence),0.035 125 | t643886074,Tongue (prevalence),0.33143285 126 | t643886084,Nose (prevalence),0.1159837 127 | t643886103,Stool (prevalence),0.035 128 | t643886104,Tongue (prevalence),0.1089571 129 | t643886107,Stool (prevalence),0.035 130 | t643886109,Stool (prevalence),0.035 131 | t643886110,Stool (prevalence),0.035 132 | t643886111,Stool (prevalence),0.31685255 133 | t643886112,Stool (prevalence),0.035 134 | t643886113,Plaque (prevalence),0.303856 135 | t643886116,Stool (prevalence),0.03798865 136 | t643886139,Stool (prevalence),0.035 137 | t643886142,Stool (prevalence),0.035 138 | t643886143,Stool (prevalence),0.035 139 | t643886145,Stool (prevalence),0.035 140 | t643886146,Stool (prevalence),0.035 141 | t643886148,Plaque (prevalence),0.0749924 142 | t643886150,Plaque (prevalence),0.7126903 143 | t643886151,Cheek (prevalence),0.035 144 | t643886181,Plaque (prevalence),0.035 145 | t643886188,Plaque (prevalence),0.0708568 146 | t643886193,Plaque (prevalence),0.1497888 147 | t643886194,Tongue (prevalence),0.2289952 148 | t643886197,Stool (prevalence),0.035 149 | t643886198,Tongue (prevalence),0.8942367 150 | t643886199,Stool (prevalence),0.035 151 | t643886200,Stool (prevalence),1.60445565 152 | t643886203,Stool (prevalence),0.035 153 | t643886206,Stool (prevalence),0.035 154 | t643886208,Plaque (prevalence),0.05481735 155 | t643886217,Vagina (prevalence),3.4955655 156 | t644736324,Plaque (prevalence),0.27294925 157 | t644736327,Tongue (prevalence),0.0719936 158 | t644736346,Plaque (prevalence),0.035 159 | t644736358,Stool (prevalence),0.035 160 | t644736366,Stool (prevalence),0.1200542 161 | t644736367,Stool (prevalence),0.59744125 162 | t644736381,Stool (prevalence),0.035 163 | t644736382,Stool (prevalence),0.035 164 | t644736384,Plaque (prevalence),0.1122373 165 | t644736390,Skin (prevalence),0.035 166 | t645058705,Cheek (prevalence),0.035 167 | t645058712,Vagina (prevalence),3.3628546 168 | t645058719,Nose (prevalence),0.07586565 169 | t645058720,Plaque (prevalence),0.0618765 170 | t645058738,Plaque (prevalence),0.035 171 | t645058748,Plaque (prevalence),0.33075665 172 | t645058761,Stool (prevalence),0.035 173 | t645058788,Stool (prevalence),0.035 174 | t645058800,Tongue (prevalence),0.6114507 175 | t645058825,Skin (prevalence),0.035 176 | t645058834,Cheek (prevalence),0.5328302 177 | t645058865,Stool (prevalence),0.035 178 | t645951802,Plaque (prevalence),0.035 179 | t645951804,Stool (prevalence),0.035 180 | t645951808,Plaque (prevalence),0.15132985 181 | t645951810,Skin (prevalence),0.035 182 | t645951817,Tongue (prevalence),0.0713286 183 | t645951819,Plaque (prevalence),0.13372415 184 | t645951825,Stool (prevalence),0.035 185 | t645951831,Stool (prevalence),0.4400445 186 | t645951833,Stool (prevalence),0.44330825 187 | t645951834,Stool (prevalence),0.0668115 188 | t645951835,Stool (prevalence),0.035 189 | t645951836,Tongue (prevalence),0.05664155 190 | t645951837,Plaque (prevalence),0.035 191 | t645951840,Plaque (prevalence),0.0402612 192 | t645951848,Tongue (prevalence),0.03630445 193 | t645951855,Stool (prevalence),0.035 194 | t645951857,Plaque (prevalence),0.11065775 195 | t645951859,Stool (prevalence),0.035 196 | t645951860,Plaque (prevalence),0.08560475 197 | t645951869,Plaque (prevalence),0.03768975 198 | t646206250,Stool (prevalence),0.035 199 | t646206251,Stool (prevalence),0.035 200 | t646206254,Stool (prevalence),0.035 201 | t646206268,Skin (prevalence),0.035 202 | t646206269,Stool (prevalence),0.035 203 | t646206270,Skin (prevalence),0.035 204 | t646206271,Stool (prevalence),0.035 205 | t646206275,Stool (prevalence),0.035 206 | t646206276,Vagina (prevalence),0.035 207 | t646311901,Stool (prevalence),0.035 208 | t646311928,Vagina (prevalence),0.6981674 209 | t646311937,Stool (prevalence),0.035 210 | t646311941,Stool (prevalence),0.035 211 | t646311946,Stool (prevalence),0.035 212 | t646311956,Stool (prevalence),0.035 213 | t646564552,Nose (prevalence),0.17719975 214 | t646564572,Stool (prevalence),0.035 215 | t646564575,Plaque (prevalence),0.035 216 | t646862322,Stool (prevalence),0.035 217 | t646862342,Nose (prevalence),0.9083788 218 | t647000207,Stool (prevalence),0.035 219 | t647000215,Stool (prevalence),0.3949099 220 | t647000218,Plaque (prevalence),0.035 221 | t647000231,Stool (prevalence),0.035 222 | t647000254,Plaque (prevalence),0.22168965 223 | t647000268,Plaque (prevalence),0.035 224 | t647000283,Plaque (prevalence),0.30211825 225 | t647000284,Plaque (prevalence),0.035 226 | t647000288,Stool (prevalence),0.035 227 | t647000289,Skin (prevalence),0.035 228 | t647000290,Stool (prevalence),0.035 229 | t647000292,Stool (prevalence),0.035 230 | t647000293,Nose (prevalence),0.035 231 | t647000295,Vagina (prevalence),0.035 232 | t647000302,Stool (prevalence),0.035 233 | t647000331,Plaque (prevalence),0.4522273 234 | t647533146,Stool (prevalence),0.035 235 | t647533156,Stool (prevalence),0.035 236 | t647533172,Cheek (prevalence),0.1436659 237 | t647533176,Vagina (prevalence),3.4997018 238 | t647533178,Stool (prevalence),0.035 239 | t647533181,Stool (prevalence),0.035 240 | t647533186,Plaque (prevalence),0.035 241 | t647533194,Stool (prevalence),0.035 242 | t647533210,Tongue (prevalence),0.035 243 | t648028005,Plaque (prevalence),0.035 244 | t648028010,Stool (prevalence),0.035 245 | t648028018,Stool (prevalence),0.035 246 | t648028033,Stool (prevalence),0.035 247 | t648028043,Stool (prevalence),0.035 248 | t648028047,Plaque (prevalence),0.035 249 | t648028051,Tongue (prevalence),0.7506632 250 | t648028055,Cheek (prevalence),0.035 251 | t648276633,Skin (prevalence),0.035 252 | t648276634,Plaque (prevalence),1.32123915 253 | t648276674,Skin (prevalence),0.31030615 254 | t648276682,Vagina (prevalence),3.3675978 255 | t648276684,Stool (prevalence),0.035 256 | t648276710,Stool (prevalence),0.035 257 | t648276712,Tongue (prevalence),0.035 258 | t648276713,Tongue (prevalence),0.035 259 | t648276715,Vagina (prevalence),0.035 260 | t648276716,Plaque (prevalence),0.035 261 | t648276732,Stool (prevalence),0.035 262 | t648276734,Cheek (prevalence),2.75962645 263 | t648276739,Cheek (prevalence),0.109263 264 | t648276747,Stool (prevalence),0.035 265 | t648276749,Stool (prevalence),0.035 266 | t648276753,Tongue (prevalence),0.50017695 267 | t648861012,Plaque (prevalence),0.0831061 268 | t649633012,Stool (prevalence),0.035 269 | t649633013,Stool (prevalence),0.035 270 | t649633041,Stool (prevalence),0.035 271 | t649633064,Stool (prevalence),0.035 272 | t649633075,Plaque (prevalence),0.035 273 | t649633078,Stool (prevalence),0.15575735 274 | t649633084,Stool (prevalence),0.035 275 | t649633093,Plaque (prevalence),1.4408919 276 | t649633094,Stool (prevalence),0.035 277 | t649989901,Plaque (prevalence),0.2938411 278 | t649989905,Plaque (prevalence),0.3467912 279 | t649989906,Plaque (prevalence),0.1525657 280 | t649989912,Stool (prevalence),0.30093665 281 | t649989917,Stool (prevalence),0.035 282 | t649989920,Plaque (prevalence),0.25156775 283 | t649989922,Stool (prevalence),0.035 284 | t649989928,Vagina (prevalence),0.035 285 | t649989950,Plaque (prevalence),0.05172825 286 | t649989952,Plaque (prevalence),0.04427815 287 | t649989956,Plaque (prevalence),0.035 288 | t649989969,Stool (prevalence),0.035 289 | t649989970,Plaque (prevalence),0.39373915 290 | t649989971,Tongue (prevalence),0.16614045 291 | t649989980,Stool (prevalence),0.035 292 | t649989982,Skin (prevalence),0.03697995 293 | t649989985,Stool (prevalence),0.035 294 | t649989986,Plaque (prevalence),0.035 295 | t649989987,Plaque (prevalence),0.035 296 | t649989988,Plaque (prevalence),0.035 297 | t649989989,Tongue (prevalence),0.1198344 298 | t649989993,Stool (prevalence),0.035 299 | t649989996,Plaque (prevalence),0.035 300 | t649989999,Tongue (prevalence),0.09095345 301 | t649990001,Plaque (prevalence),0.035 302 | t649990003,Tongue (prevalence),0.3424806 303 | t649990004,Plaque (prevalence),0.07084315 304 | t649990007,Tongue (prevalence),0.27167315 305 | t649990011,Tongue (prevalence),0.0372757 306 | t649990014,Plaque (prevalence),0.47115705 307 | t649990016,Cheek (prevalence),0.27710235 308 | t649990021,Stool (prevalence),0.1999088 309 | t649990026,Stool (prevalence),0.035 310 | t650377901,Skin (prevalence),0.035 311 | t650377904,Stool (prevalence),0.2573032 312 | t650377925,Stool (prevalence),0.035 313 | t650377929,Stool (prevalence),0.035 314 | t650377938,Stool (prevalence),0.2355206 315 | t650377943,Stool (prevalence),0.035 316 | t650377944,Cheek (prevalence),0.4919257 317 | t650377954,Stool (prevalence),0.035 318 | t650377958,Stool (prevalence),0.035 319 | t650377963,Stool (prevalence),0.035 320 | t650377966,Stool (prevalence),0.33431195 321 | t650377974,Stool (prevalence),0.035 322 | t650377975,Stool (prevalence),0.035 323 | t650633000,Stool (prevalence),0.035 324 | t650716045,Stool (prevalence),0.035 325 | t650716089,Tongue (prevalence),0.7958867 326 | t651053005,Stool (prevalence),0.035 327 | t651053029,Stool (prevalence),0.035 328 | t651053056,Stool (prevalence),0.035 329 | t651053058,Skin (prevalence),3.47356625 330 | t651053073,Tongue (prevalence),0.49160055 331 | t651324009,Skin (prevalence),0.035 332 | t651324012,Stool (prevalence),1.12855925 333 | t651324039,Tongue (prevalence),1.75505365 334 | -------------------------------------------------------------------------------- /data-backup/tree_example_april2015/info.csv: -------------------------------------------------------------------------------- 1 | id,location,name,country,year, CS14_Brazil_2001,other,CS14,Brazil,2001, CS2_Brazil_1997,other,CS2,Brazil,1997, CS20_Brazil_2002,other,CS20,Brazil,2002, CS6_Brazil_2000,other,CS6,Brazil,2000, CS7_Brazil_2000,other,CS7,Brazil,2000, 373_Cameroun_1973,other,373,Cameroun,1973, 32222_Cuba_2003,other,32222,Cuba,2003, 54185_Denmark_1945,other,54185,Denmark,1945, 20061758_Dominican,other,20061758,Dominican,, 20051272_Egypt_2005,other,20051272,Egypt,2005, 20060018_Egypt_2006,other,20060018,Egypt,2006, 20061309_Egypt_2006,other,20061309,Egypt,2006, 20062087_Egypt_Tunisia_2006,other,20062087,Egypt,Tunisia,2006 259_France_1959,other,259,France,1959, 476_France_1976,other,476,France,1976, 658_France_1958,other,658,France,1958, 1166_France_1966,other,1166,France,1966, 1167_France_1967,other,1167,France,1967, 1173_France_1973,other,1173,France,1973, 1263_France_1963,other,1263,France,1963, 1265_France_1965,other,1265,France,1965, 1267_France_1967,other,1267,France,1967, 1274_France_1974,other,1274,France,1974, 1460_France_1960,other,1460,France,1960, 1461_France_1961,other,1461,France,1961, 1761_France_1961,other,1761,France,1961, 2073_France_1973,other,2073,France,1973, 2574_France_1974,other,2574,France,1974, 4374_France_1974,other,4374,France,1974, 4474_France_1974,other,4474,France,1974, 8883_France_1983,other,8883,France,1983, 54213_France_1945,other,54213,France,1945, 998911_France_1999,other,998911,France,1999, IB48279_France_NA,other,IB48279,France,NA, pWR105_France_NA,other,pWR105,France,NA, 2225_French,other,2225,French,, 988743_French,other,988743,French,, 10014_HCMC_2009,HCMC,10014,HCMC,2009, 10021_HCMC_2009,HCMC,10021,HCMC,2009, 10031_HCMC_2009,HCMC,10031,HCMC,2009, 10035_HCMC_2009,HCMC,10035,HCMC,2009, 10060_HCMC_2009,HCMC,10060,HCMC,2009, 10063_HCMC_2009,HCMC,10063,HCMC,2009, 10071_HCMC_2009,HCMC,10071,HCMC,2009, 10073_HCMC_2009,HCMC,10073,HCMC,2009, 10083_HCMC_2009,HCMC,10083,HCMC,2009, 10093_HCMC_2009,HCMC,10093,HCMC,2009, 10102_HCMC_2009,HCMC,10102,HCMC,2009, 10111_HCMC_2009,HCMC,10111,HCMC,2009, 10115_HCMC_2009,HCMC,10115,HCMC,2009, 10134_HCMC_2009,HCMC,10134,HCMC,2009, 10135_HCMC_2009,HCMC,10135,HCMC,2009, 10152_HCMC_2009,HCMC,10152,HCMC,2009, 10159_HCMC_2009,HCMC,10159,HCMC,2009, 10188_HCMC_2009,HCMC,10188,HCMC,2009, 10263_HCMC_2009,HCMC,10263,HCMC,2009, 10320_HCMC_2010,HCMC,10320,HCMC,2010, 10365_HCMC_2010,HCMC,10365,HCMC,2010, 20006_HCMC_2009,HCMC,20006,HCMC,2009, 20021_HCMC_2009,HCMC,20021,HCMC,2009, 20023_HCMC_2009,HCMC,20023,HCMC,2009, 20037_HCMC_2009,HCMC,20037,HCMC,2009, 20070_HCMC_2009,HCMC,20070,HCMC,2009, 20094_HCMC_2009,HCMC,20094,HCMC,2009, 20228_HCMC_2009,HCMC,20228,HCMC,2009, 20261_HCMC_2009,HCMC,20261,HCMC,2009, 20263_HCMC_2009,HCMC,20263,HCMC,2009, 20343_HCMC_2009,HCMC,20343,HCMC,2009, 30003_HCMC_2009,HCMC,30003,HCMC,2009, 30008_HCMC_2009,HCMC,30008,HCMC,2009, 30010_HCMC_2009,HCMC,30010,HCMC,2009, 30037_HCMC_2009,HCMC,30037,HCMC,2009, 30054_HCMC_2009,HCMC,30054,HCMC,2009, 30059_HCMC_2009,HCMC,30059,HCMC,2009, 30071_HCMC_2009,HCMC,30071,HCMC,2009, 30073_HCMC_2009,HCMC,30073,HCMC,2009, 30100_HCMC_2009,HCMC,30100,HCMC,2009, 30112_HCMC_2009,HCMC,30112,HCMC,2009, 30124_HCMC_2009,HCMC,30124,HCMC,2009, 30162_HCMC_2009,HCMC,30162,HCMC,2009, 30164_HCMC_2009,HCMC,30164,HCMC,2009, 30169_HCMC_2009,HCMC,30169,HCMC,2009, 30172_HCMC_2009,HCMC,30172,HCMC,2009, 30174_HCMC_2009,HCMC,30174,HCMC,2009, 30233_HCMC_2009,HCMC,30233,HCMC,2009, 30293_HCMC_2009,HCMC,30293,HCMC,2009, 30366_HCMC_2009,HCMC,30366,HCMC,2009, 30371_HCMC_2009,HCMC,30371,HCMC,2009, 30387_HCMC_2010,HCMC,30387,HCMC,2010, 30450_HCMC_2010,HCMC,30450,HCMC,2010, 30451_HCMC_2010,HCMC,30451,HCMC,2010, DE0115_HCMC_2000,HCMC,DE0115,HCMC,2000, DE0127_HCMC_2000,HCMC,DE0127,HCMC,2000, DE0199_HCMC_2000,HCMC,DE0199,HCMC,2000, DE0248_HCMC_2000,HCMC,DE0248,HCMC,2000, DE0295_HCMC_2000,HCMC,DE0295,HCMC,2000, DE0303_HCMC_2000,HCMC,DE0303,HCMC,2000, DE0306_HCMC_2000,HCMC,DE0306,HCMC,2000, DE0330_HCMC_2000,HCMC,DE0330,HCMC,2000, DE0427_HCMC_2000,HCMC,DE0427,HCMC,2000, DE0477_HCMC_2000,HCMC,DE0477,HCMC,2000, DE0489_HCMC_2000,HCMC,DE0489,HCMC,2000, DE0490_HCMC_2000,HCMC,DE0490,HCMC,2000, DE0579_HCMC_2001,HCMC,DE0579,HCMC,2001, DE0611_HCMC_2001,HCMC,DE0611,HCMC,2001, DE0654_HCMC_2001,HCMC,DE0654,HCMC,2001, DE0655_HCMC_2001,HCMC,DE0655,HCMC,2001, DE0685_HCMC_2001,HCMC,DE0685,HCMC,2001, DE0816_HCMC_2001,HCMC,DE0816,HCMC,2001, DE0846_HCMC_2001,HCMC,DE0846,HCMC,2001, DE0885_HCMC_2001,HCMC,DE0885,HCMC,2001, DE0891_HCMC_2001,HCMC,DE0891,HCMC,2001, DE0900_HCMC_2001,HCMC,DE0900,HCMC,2001, DE0965_HCMC_2001,HCMC,DE0965,HCMC,2001, DE1063_HCMC_2002,HCMC,DE1063,HCMC,2002, DE1140_HCMC_2002,HCMC,DE1140,HCMC,2002, DE1150_HCMC_2002,HCMC,DE1150,HCMC,2002, DE1165_HCMC_2002,HCMC,DE1165,HCMC,2002, DE1191_HCMC_2002,HCMC,DE1191,HCMC,2002, DE1198_HCMC_2002,HCMC,DE1198,HCMC,2002, DE1208_HCMC_2002,HCMC,DE1208,HCMC,2002, DE1209_HCMC_2002,HCMC,DE1209,HCMC,2002, DE1256_HCMC_2002,HCMC,DE1256,HCMC,2002, DE1318_HCMC_2002,HCMC,DE1318,HCMC,2002, DE1336_HCMC_2002,HCMC,DE1336,HCMC,2002, DE1404_HCMC_2002,HCMC,DE1404,HCMC,2002, DE1486_HCMC_2002,HCMC,DE1486,HCMC,2002, EG0129_HCMC_2007,HCMC,EG0129,HCMC,2007, EG0159_HCMC_2007,HCMC,EG0159,HCMC,2007, EG0204_HCMC_2008,HCMC,EG0204,HCMC,2008, EG0255_HCMC_2008,HCMC,EG0255,HCMC,2008, EG0304_HCMC_2006,HCMC,EG0304,HCMC,2006, EG0309_HCMC_2006,HCMC,EG0309,HCMC,2006, EG0313_HCMC_2006,HCMC,EG0313,HCMC,2006, EG0315_HCMC_2006,HCMC,EG0315,HCMC,2006, EG0318_HCMC_2006,HCMC,EG0318,HCMC,2006, EG0352_HCMC_2007,HCMC,EG0352,HCMC,2007, EG0357_HCMC_2007,HCMC,EG0357,HCMC,2007, EG0362_HCMC_2007,HCMC,EG0362,HCMC,2007, EG0365_HCMC_2007,HCMC,EG0365,HCMC,2007, EG0369_HCMC_2007,HCMC,EG0369,HCMC,2007, EG0372_HCMC_2007,HCMC,EG0372,HCMC,2007, EG0373_HCMC_2007,HCMC,EG0373,HCMC,2007, EG0375_HCMC_2007,HCMC,EG0375,HCMC,2007, EG0379_HCMC_2007,HCMC,EG0379,HCMC,2007, EG0383_HCMC_2007,HCMC,EG0383,HCMC,2007, EG0385_HCMC_2007,HCMC,EG0385,HCMC,2007, EG0386_HCMC_2007,HCMC,EG0386,HCMC,2007, EG0388_HCMC_2007,HCMC,EG0388,HCMC,2007, EG0390_HCMC_2007,HCMC,EG0390,HCMC,2007, EG0392_HCMC_2007,HCMC,EG0392,HCMC,2007, EG0393_HCMC_2007,HCMC,EG0393,HCMC,2007, EG0394_HCMC_2007,HCMC,EG0394,HCMC,2007, EG0395_HCMC_2007,HCMC,EG0395,HCMC,2007, EG0401_HCMC_2007,HCMC,EG0401,HCMC,2007, EG0404_HCMC_2007,HCMC,EG0404,HCMC,2007, EG0410_HCMC_2007,HCMC,EG0410,HCMC,2007, EG0425_HCMC_2008,HCMC,EG0425,HCMC,2008, EG0430_HCMC_2008,HCMC,EG0430,HCMC,2008, EG0451_HCMC_2008,HCMC,EG0451,HCMC,2008, EG0467_HCMC_2008,HCMC,EG0467,HCMC,2008, EG0472_HCMC_2008,HCMC,EG0472,HCMC,2008, EG1001_HCMC_2008,HCMC,EG1001,HCMC,2008, EG1004_HCMC_2008,HCMC,EG1004,HCMC,2008, EG1008_HCMC_2008,HCMC,EG1008,HCMC,2008, EG1014_HCMC_2009,HCMC,EG1014,HCMC,2009, EG1015_HCMC_2009,HCMC,EG1015,HCMC,2009, EG1016_HCMC_2009,HCMC,EG1016,HCMC,2009, EG1017_HCMC_2009,HCMC,EG1017,HCMC,2009, EG1018_HCMC_2009,HCMC,EG1018,HCMC,2009, EG1019_HCMC_2009,HCMC,EG1019,HCMC,2009, EG1020_HCMC_2009,HCMC,EG1020,HCMC,2009, EG1021_HCMC_2009,HCMC,EG1021,HCMC,2009, EG1022_HCMC_2009,HCMC,EG1022,HCMC,2009, EG1023_HCMC_2009,HCMC,EG1023,HCMC,2009, EG1024_HCMC_2009,HCMC,EG1024,HCMC,2009, EG1025_HCMC_2009,HCMC,EG1025,HCMC,2009, EG1026_HCMC_0,HCMC,EG1026,HCMC,0, EG1027_HCMC_0,HCMC,EG1027,HCMC,0, EG1028_HCMC_0,HCMC,EG1028,HCMC,0, EG1029_HCMC_0,HCMC,EG1029,HCMC,0, HUE01_HCMC_2008,Hue,HUE01,HCMC,2008, HUE02_HCMC_2008,Hue,HUE02,HCMC,2008, HUE05_HCMC_2008,Hue,HUE05,HCMC,2008, HUE16_HCMC_2009,Hue,HUE16,HCMC,2009, HUE17_HCMC_2009,Hue,HUE17,HCMC,2009, HUE19_HCMC_2009,Hue,HUE19,HCMC,2009, HUE20_HCMC_2009,Hue,HUE20,HCMC,2009, HUE21_HCMC_2009,Hue,HUE21,HCMC,2009, HUE22_HCMC_2009,Hue,HUE22,HCMC,2009, HUE23_HCMC_2009,Hue,HUE23,HCMC,2009, HUE24_HCMC_2009,Hue,HUE24,HCMC,2009, HUE25_HCMC_2009,Hue,HUE25,HCMC,2009, HUE26_HCMC_2009,Hue,HUE26,HCMC,2009, HUE27_HCMC_2009,Hue,HUE27,HCMC,2009, HUE29_HCMC_2009,Hue,HUE29,HCMC,2009, HUE30_HCMC_2009,Hue,HUE30,HCMC,2009, HUE31_HCMC_2009,Hue,HUE31,HCMC,2009, HUE32_HCMC_2009,Hue,HUE32,HCMC,2009, HUE33_HCMC_2009,Hue,HUE33,HCMC,2009, HUE34_HCMC_2009,Hue,HUE34,HCMC,2009, HUE40_HCMC_2009,Hue,HUE40,HCMC,2009, HUE42_HCMC_2009,Hue,HUE42,HCMC,2009, HUE43_HCMC_2009,Hue,HUE43,HCMC,2009, HUE46_HCMC_2009,Hue,HUE46,HCMC,2009, HUE47_HCMC_2009,Hue,HUE47,HCMC,2009, HUE48_HCMC_2009,Hue,HUE48,HCMC,2009, HUE50_HCMC_2009,Hue,HUE50,HCMC,2009, HUE53_HCMC_2010,Hue,HUE53,HCMC,2010, HUE55_HCMC_2010,Hue,HUE55,HCMC,2010, HUE57_HCMC_2010,Hue,HUE57,HCMC,2010, HUE58_HCMC_2010,Hue,HUE58,HCMC,2010, HUE60_HCMC_2010,Hue,HUE60,HCMC,2010, HUE62_HCMC_2010,Hue,HUE62,HCMC,2010, HUE64_HCMC_2010,Hue,HUE64,HCMC,2010, HUE67_HCMC_2010,Hue,HUE67,HCMC,2010, HUE68_HCMC_2010,Hue,HUE68,HCMC,2010, KH02_HCMC_2009,KH,KH02,HCMC,2009, KH04_HCMC_2009,KH,KH04,HCMC,2009, KH05_HCMC_2009,KH,KH05,HCMC,2009, KH06_HCMC_2009,KH,KH06,HCMC,2009, KH07_HCMC_2009,KH,KH07,HCMC,2009, KH09_HCMC_2009,KH,KH09,HCMC,2009, KH10_HCMC_2009,KH,KH10,HCMC,2009, KH11_HCMC_2009,KH,KH11,HCMC,2009, KH12_HCMC_2009,KH,KH12,HCMC,2009, KH13_HCMC_2009,KH,KH13,HCMC,2009, KH14_HCMC_2009,KH,KH14,HCMC,2009, KH15_HCMC_2009,KH,KH15,HCMC,2009, KH16_HCMC_2009,KH,KH16,HCMC,2009, KH17_HCMC_2009,KH,KH17,HCMC,2009, KH18_HCMC_2009,KH,KH18,HCMC,2009, KH19_HCMC_2009,KH,KH19,HCMC,2009, KH20_HCMC_2009,KH,KH20,HCMC,2009, KH21_HCMC_2009,KH,KH21,HCMC,2009, KH23_HCMC_2009,KH,KH23,HCMC,2009, KH24_HCMC_2009,KH,KH24,HCMC,2009, KH25_HCMC_2009,KH,KH25,HCMC,2009, KH26_HCMC_2009,KH,KH26,HCMC,2009, KH27_HCMC_2009,KH,KH27,HCMC,2009, KH28_HCMC_2009,KH,KH28,HCMC,2009, KH29_HCMC_2009,KH,KH29,HCMC,2009, KH30_HCMC_2009,KH,KH30,HCMC,2009, KH32_HCMC_2009,KH,KH32,HCMC,2009, KH33_HCMC_2009,KH,KH33,HCMC,2009, KH34_HCMC_2009,KH,KH34,HCMC,2009, KH35_HCMC_2009,KH,KH35,HCMC,2009, KH37_HCMC_2009,KH,KH37,HCMC,2009, KH38_HCMC_2009,KH,KH38,HCMC,2009, KH40_HCMC_2009,KH,KH40,HCMC,2009, KH41_HCMC_2009,KH,KH41,HCMC,2009, KH42_HCMC_2010,KH,KH42,HCMC,2010, KH43_HCMC_2010,KH,KH43,HCMC,2010, KH45_HCMC_2010,KH,KH45,HCMC,2010, KH53_HCMC_2010,KH,KH53,HCMC,2010, KH54_HCMC_2010,KH,KH54,HCMC,2010, KH55_HCMC_2010,KH,KH55,HCMC,2010, KH57_HCMC_2010,KH,KH57,HCMC,2010, MS0004_HCMC_1995,HCMC,MS0004,HCMC,1995, MS0011_HCMC_1995,HCMC,MS0011,HCMC,1995, MS0032_HCMC_1995,HCMC,MS0032,HCMC,1995, MS0034_HCMC_1995,HCMC,MS0034,HCMC,1995, MS0035_HCMC_1995,HCMC,MS0035,HCMC,1995, MS0039_HCMC_1995,HCMC,MS0039,HCMC,1995, MS0042_HCMC_1995,HCMC,MS0042,HCMC,1995, MS0043_HCMC_1995,HCMC,MS0043,HCMC,1995, MS0048_HCMC_1995,HCMC,MS0048,HCMC,1995, MS0063_HCMC_1995,HCMC,MS0063,HCMC,1995, MS0065_HCMC_1995,HCMC,MS0065,HCMC,1995, MS0069_HCMC_1995,HCMC,MS0069,HCMC,1995, MS0070_HCMC_1995,HCMC,MS0070,HCMC,1995, MS0080_HCMC_1995,HCMC,MS0080,HCMC,1995, MS0083_HCMC_1996,HCMC,MS0083,HCMC,1996, MS0094_HCMC_1996,HCMC,MS0094,HCMC,1996, MS0102_HCMC_1996,HCMC,MS0102,HCMC,1996, MS0110_HCMC_1996,HCMC,MS0110,HCMC,1996, MS0111_HCMC_1996,HCMC,MS0111,HCMC,1996, MS0119_HCMC_1996,HCMC,MS0119,HCMC,1996, MS0122_HCMC_1996,HCMC,MS0122,HCMC,1996, MS0127_HCMC_1996,HCMC,MS0127,HCMC,1996, MS0128_HCMC_1996,HCMC,MS0128,HCMC,1996, 20031275_Iran_2003,other,20031275,Iran,2003, 31382_Israel_2003,other,31382,Israel,2003, 20040924_Kenya_Egypt_2004,other,20040924,Kenya,Egypt,2004 IB1_Korea_2003,other,IB1,Korea,2003, IB10_Korea_2003,other,IB10,Korea,2003, IB2_Korea_2003,other,IB2,Korea,2003, IB2493_Korea_NA,other,IB2493,Korea,NA, IB3_Korea_2003,other,IB3,Korea,2003, IB681_Korea_1991,other,IB681,Korea,1991, IB683_Korea_1994,other,IB683,Korea,1994, IB687_Korea_1998,other,IB687,Korea,1998, IB690_Korea_2000,other,IB690,Korea,2000, IB691_Korea_1999,other,IB691,Korea,1999, IB694_Korea_1979,other,IB694,Korea,1979, IB695_Korea_1983,other,IB695,Korea,1983, IB696_Korea_1980,other,IB696,Korea,1980, IB697_Korea_1982,other,IB697,Korea,1982, IB698_Korea_1983,other,IB698,Korea,1983, IB713_Korea_1981,other,IB713,Korea,1981, IB716_Korea_1981,other,IB716,Korea,1981, IB717_Korea_1982,other,IB717,Korea,1982, IB739_Korea_1985,other,IB739,Korea,1985, IB748_Korea_1987,other,IB748,Korea,1987, 53G_Korea_2000,other,53G,Korea,2000, 5827_Madagascar_2000,other,5827,Madagascar,2000, 989560_Madagascar_1998,other,989560,Madagascar,1998, 9810267_Madagascar_1998,other,9810267,Madagascar,1998, 19984123_Mexico_1998,other,19984123,Mexico,1998, 20062313_Nepal_2006,other,20062313,Nepal,2006, 970044_New,other,970044,New,, IB3277_Pakistan_2002,other,IB3277,Pakistan,2002, IB3300_Pakistan_2002,other,IB3300,Pakistan,2002, IB3374_Pakistan_2002,other,IB3374,Pakistan,2002, IB3488_Pakistan_2003,other,IB3488,Pakistan,2003, IB3507_Pakistan_2003,other,IB3507,Pakistan,2003, IB3580_Pakistan_2003,other,IB3580,Pakistan,2003, IB3599_Pakistan_2003,other,IB3599,Pakistan,2003, 20052631_Peru_2005,other,20052631,Peru,2005, 273_Senegal_1973,other,273,Senegal,1973, 1567_Senegal_1967,other,1567,Senegal,1967, 36224_Senegal_2003,other,36224,Senegal,2003, 20040880_SriLanka_2004,other,20040880,SriLanka,2004, Ss046_Ref_1950,other,Ss046,Ref,1950, 54178_Sweden_1945,other,54178,Sweden,1945, 54179_Sweden_1944,other,54179,Sweden,1944, 54181_Sweden_1945,other,54181,Sweden,1945, 54184_Sweden_1945,other,54184,Sweden,1945, 54190_Sweden_1945,other,54190,Sweden,1945, 54210_Sweden_1943,other,54210,Sweden,1943, 54216_Sweden_1946,other,54216,Sweden,1946, 54228_Sweden_1947,other,54228,Sweden,1947, 19904011_unk_1990,other,19904011,unk,1990, 19910761_unk_1991,other,19910761,unk,1991, 19911483_unk_1991,other,19911483,unk,1991, 19920319_unk_1992,other,19920319,unk,1992, 20003593_unk_2000,other,20003593,unk,2000, 20010007_unk_2001,other,20010007,unk,2001, 20011685_unk_2001,other,20011685,unk,2001, 20021122_unk_2002,other,20021122,unk,2002, 20040489_unk_2004,other,20040489,unk,2004, 20041367_unk_2004,other,20041367,unk,2004, 20071599_unk_2007,other,20071599,unk,2007, 20081885_unk_2008,other,20081885,unk,2008, 20051541_Uzbekistan_2005,other,20051541,Uzbekistan,2005, IB1970_Vietnam_2001,VN,IB1970,Vietnam,2001, IB1976_Vietnam_2002,VN,IB1976,Vietnam,2002, IB1980_Vietnam_2002,VN,IB1980,Vietnam,2002, IB1985_Vietnam_2002,VN,IB1985,Vietnam,2002, IB1987_Vietnam_2002,VN,IB1987,Vietnam,2002, IB1990_Vietnam_2003,VN,IB1990,Vietnam,2003, IB1993_Vietnam_2003,VN,IB1993,Vietnam,2003, IB1995_Vietnam_2003,VN,IB1995,Vietnam,2003, IB1997_Vietnam_2003,VN,IB1997,Vietnam,2003, IB2000_Vietnam_2003,VN,IB2000,Vietnam,2003, IB2004_Vietnam_2003,VN,IB2004,Vietnam,2003, IB2008_Vietnam_2003,VN,IB2008,Vietnam,2003, IB2009_Vietnam_2003,VN,IB2009,Vietnam,2003, IB2012_Vietnam_2001,VN,IB2012,Vietnam,2001, IB2013_Vietnam_2001,VN,IB2013,Vietnam,2001, IB2015_Vietnam_2002,VN,IB2015,Vietnam,2002, IB2018_Vietnam_2002,VN,IB2018,Vietnam,2002, IB2024_Vietnam_2002,VN,IB2024,Vietnam,2002, IB2026_Vietnam_2003,VN,IB2026,Vietnam,2003, #N/A,other,#N/A,,, 10083_HCMC_NA,other,10083,HCMC,NA, 10093_HCMC_NA,other,10093,HCMC,NA, 10102_HCMC_NA,other,10102,HCMC,NA, 10111_HCMC_NA,other,10111,HCMC,NA, 10115_HCMC_NA,other,10115,HCMC,NA, 10134_HCMC_NA,other,10134,HCMC,NA, 10135_HCMC_NA,other,10135,HCMC,NA, 10152_HCMC_NA,other,10152,HCMC,NA, 10159_HCMC_NA,other,10159,HCMC,NA, 10188_HCMC_NA,other,10188,HCMC,NA, 10014_HCMC_NA,other,10014,HCMC,NA, 10263_HCMC_NA,other,10263,HCMC,NA, 10320_HCMC_NA,other,10320,HCMC,NA, 10365_HCMC_NA,other,10365,HCMC,NA, 10021_HCMC_NA,other,10021,HCMC,NA, 10031_HCMC_NA,other,10031,HCMC,NA, 10035_HCMC_NA,other,10035,HCMC,NA, 10060_HCMC_NA,other,10060,HCMC,NA, 10063_HCMC_NA,other,10063,HCMC,NA, 10071_HCMC_NA,other,10071,HCMC,NA, 10073_HCMC_NA,other,10073,HCMC,NA, -------------------------------------------------------------------------------- /data-backup/sequence.fasta: -------------------------------------------------------------------------------- 1 | >Phy000B0HV_NEUCR 2 | M-----GIGSATLG-----------------------------------SRIPTPVLVARAVVSSSDGK-----DC--VA 3 | NPNLCEKP-VGGSQLTVPIVLGLW----------------RNMKKLAAEEAHDPHKSLDFGLDENM-----------GKA 4 | KGRNMAG------EKDGNGSRFHAHQMSMDMNLSSPYLLPPDAH-GSQSSLNSLARTL-NPQDDPFRPVTQYTASDAASV 5 | KSMP-R-----GTD-----------R-------GPGG------PFRGPPPRQGSMP-RSPEPTHA---RPGNG----PRP 6 | PRI-SVQD------------P---SSNA-TS-D--NE-TS----------------------D----------------S 7 | ERTLT-GSPRELHAATHK-------------------DGVKPPA-SPSQPISPANP-AV--------------------- 8 | >Phy000FCLK_ASPCL 9 | -------------------------------------------------------------------------------- 10 | -------------------------------------------------------------------------------M 11 | -------------REAEKGNPMHAKGMSLDIV-PSPYLLPPGLH-GSRESLHSLSRSV-IGDDDKYRHATSFL-GDNASV 12 | RSQP-R---G-YHDDAMTYSR-SQ-S------K-VS------M--R-DDMNQGLLQ------------NAQRMSR--SSP 13 | PL-YNTPPDGGSVHSPVGQD------------------------------------------R----------------- 14 | GQDSG-LQLNLPRSLSPVHI-----------------PGFNGSR-GPSPV-----P-TS-PE------GNDDKLPS---- 15 | >Phy000FJDH_ASPFL 16 | MH---YHHRHQT--HQDIHMV-VRSPP-RRPDI-VPRHRLP------YLV-PEPPTFVKRDSDPS--------QTCSAGD 17 | TSSKCEKPTSTTTTTTLPVVLGAVVPILCAV-IVLIYLHRRNVRKLRSEDANDKHRSLDFGLDLEP-TG----GGNA--M 18 | R-------Q----TEKSNGSYNHNKGISLDIG-PSPYLLPPGLH-GSRDSLHSLSRSI--GGDDKYRHATSFL-GDNASV 19 | RSQS-R---G-AQDDAPSFTG-SA-R------K-AA------L---GDDMKQGLLG------------NAQRMSR--SSP 20 | PL-YISPGEDGA-HVQVDPI------------------------------------------A----------------- 21 | QPDHG-FQFELPRSPSPVLI-----------------PGAPSTK-ESITP-----TNNV-DK------------------ 22 | >Phy000FQ5O_ASPFU 23 | MH---HHHQHLHFPRHGIHLA-VRSPP-RRPDI-VPRDRVP------LLVGTEDPTLVKRVPSTSTTSTA--STRCPEGD 24 | TSSACEKYTNSSSTTTLPIVLGAVIPIVCAI-IVLFYLHRRNVKKLRQEDANDKHKSLDFGLDLEP-RA----GSKP--M 25 | -------------TQAEKGSNMHSKGMSLDIG-QSPYLLPPGLH-GSRESLHSLSRSI-IGDDDKYRHASSFL-GDNASV 26 | RSQP-R---G-FHDETSAFSR-SQ-S------K-AS------L--RGDDMNQGLLQ------------NAQRMSR--SSP 27 | PL-YNAPSDGGSSHSPRGQG------------------------------------------N----------------- 28 | GQDMG-LQLNLPRSLSPVHI-----------------PGVNGSR-GTSPA-----P-GGHAD------GSEDISSS---- 29 | >Phy000G05U_EMENI 30 | MH---RHQQHQH--RHGKYLG-ARFAP-VEPAL-MPRNRPP------YLLMPEAPTLVKREPMPTTDSGR--VETCSPGD 31 | NSARCEKNTSTASNTTLPVVLGAVIPIVCAI-IVLIFLHRRNVKKLRNEDANDKHKSLDFGMDLAP-SG----GRSG--M 32 | Q-------E---------KGSHHMKGISLDIG-PSPYMLPPSIR-GSKDSLNSLPRTI-LADDDKYRHAHTYFSTDAQSI 33 | RSQR-R-----VHDDAASVAG-ST-R------R-GA------F---GDEMNQGLLG------------NAQRISR--SSP 34 | PL-YNPPEPTAGRAQ----P------------------------------------------Q----------------- 35 | VQDAG-FELSLPRSPSPVHV-----------------SGLTSIN-ESTTE-----TGRE-AN------------------ 36 | >Phy000GDP6_ASPNG 37 | M--------------------------------------------------RETPTLARREPLPSTDSSS------ASSS 38 | TASSGTKPTSTLTTTTLPVVLGAVVPIVIAI-GILLYLHRRNVKKLRNEDANDKHKSLDFGLDLAP-TN----GAVP--M 39 | Q-------Q----AEKTDRNAAHNKGISLDIG-PSPYLLPPGLH-NSRESLASMSRSIGDGDDDKYRHVGSFL-GDNSSL 40 | RSHS-R---G-PHDDAASFTG-ST-R------R-AA------L---GDDMNQGLLR------------NAQRMSR--SSP 41 | PL-YKTSSGDRNVQSPASSD------------------------------------------H----------------- 42 | EHDHG-FQLDLPRSPSPVHV-----------------PGMAISE-PHT-------TSNE-VG------FAGDHAVTETSA 43 | >Phy000HD5X_BOTFU 44 | MADHQRLANIVRLARRV----P--LAE-AAAED-IGNIASIL------KMSLPDPVLMVRSATTSAAASS---STCAADD 45 | TSAACEKP-VGPSAYTLPVILGIVIPVGGAI-ILFTILQRRYMKKAREEDLNDPTKNMDFGMGRIS-R--T------AGG 46 | ESG-I--S---N-FDDEKGGAVRTRQMSLDLGGKSPYLLPPELH-NSRESLHSLSRTI-HSNEDPYRPVHEAV---GGSI 47 | RSKQ-------GRNGSSIMTESSA-A--------PSK-----MYDAGSPDGQGLLS------------NAAAMSR--TTP 48 | PSTGSSPP------------P---KSNS--I-----P-P----------------------------------------- 49 | -ANMP-AEPKQAESPQNVARKGL--------------PGNFRPQ-DRFPTAMPVPM-PYP-------------DRESYAG 50 | >Phy000IAZP_COCIM 51 | MA------------RHTYRDP--SRLV-SRALA-IPVERSI------ILTALEPPSLVKRNPADAASSSSVPTKTCGPDD 52 | TTGVCTRPVNSTTTLTLPIVLGAVIPLTCAF-IAFFFLHRRHVKKLRLEDANDKHKSLDFGLDFVP-SG----SNNNRRG 53 | NGGNG-P------SMAEKSTRRGGHGVSMDLTLNSPYLLPPGLH-GSHESIHSLSRSL-HGEDDKYRHASAFPTGDSGSI 54 | RSCS-PSFKRGGDD-ASSHNSPSS-K------Y-PY----------GDDMNQHLLK------------NAQRMSR--SPP 55 | AI-ELDPIESDLGHPPHHA--------------------T----------------------A-----VSASE------S 56 | GNTTF-HGRSELTVPTAVSS-----------------HGDRSSS-SSSER-----DDSV-LR---------KS------- 57 | >Phy000KG2Q_MAGGR 58 | MVGVTVHEGEYHLGSRM----P--VMA-RDAST-PAL-QIAA------DGPGFFKRLVARQSSDD----------CVNGE 59 | PSNLCEKP-VTSQTLALPIALGVTIPLVALV-VMLIWLHRKNVRRQRQEDANDPHKSLDFGLDMGP------------GK 60 | RKS-K--L---F-GGEKLGGGPHNRQISMDMNLSSPYLLPPNMQ-NSRESIHSLAKTL--HNEDPYRHITQYNASDAGSL 61 | RSYK-A---G-GMD-------------------RPIG-----PKITVPTSRKGSLQATSPTSTIGSVPPRYEASQ---DD 62 | YV-KPPPP------------A---ALK---S-P--TQ-DS----------------------TPYPDDKSGP-------L 63 | ATVMP-SVP-EIQEPKPASLSK----E-SS---QAPS---LAAV-PPSSPLTISAP-EI--------------------- 64 | >Phy000ODBJ_SCLSC 65 | MEDHQRLANIVRLARRV----P--LAE-AAAED-IDNIASIL------KMAVPDRVIMGRSSTTTSSTSS---STCAADD 66 | TSAACEKP-IGPSAYTLPVILGIVIPVAGAI-ILFTILQRRYTKRAREEDANDPTKNMDFGMGRIS-R--T------AGG 67 | ESS-I--S---N-FDDEKGDSGRPRQMSLDLGGKSPYLLPPELQ-DSRESLHSLSKTI-HQNEDPYRPVHEAV--GAASI 68 | RSKQ-------GRNGSSILSASTV-A--------PSG-----MNDTGSPDGQGLLS------------NAAAMSR--TTP 69 | PTAGFNPP------------P---RSNS--I-----P-P----------------------------------------- 70 | -AKMP-EEPRQSP-EQNVDKKGP--------------PGNFRPQ-NGFSSTRSIPM-PFL-------------DWESYAG 71 | >Phy000PFY6_UNCRE 72 | MA------------RHAFQPA--SGLV-PRALA-IPLDRSI------LLTSLDHPSHVKRSPAATASSSAAATTSCGPND 73 | TTGICTRPVSSTTTMTLPIVLGAAIPITCAI-IAFFFLHRRHVKKLRLEDANDKHKSLDFGLDFVP-SG----SNNNKRG 74 | NGGNG-G------LMGEKSTRQRAHGVSLDLTMGNPYLLPPVSM-GSHESIHSLSKSL-HGGDDKYRHAAAFPSSENRF- 75 | --------------------------------------------------RHSVLQ------------PTNPLA---SEP 76 | RS-PLSPPGRNELTKLKQQ--------------------L---------------------------------------- 77 | ------------------------------------------------DK-----EQSV-LR---------KS------- 78 | >Phy00201Y5_COCHE 79 | M------------------------------------------------------------------------------- 80 | --------------------CATTVPVVGIA-VVLAFLHRRNKQKLREEDQRDKYKSNDWGMEGVIPK---------TSK 81 | KGG-P-EM---S-ISEKEISGGHDRGLSIETG--SPYILPPGLH-GSRESFHSLSRST-HDPHDPYGPVAFLR--DDQSL 82 | RSH----GPY-KGETNSVYT--A-SS-------SGT---------KKEGLQAGLLQ------------NAQRMST--SAP 83 | VR-GESLS------------P---DSTR--SPD--SK-FAEAGIPLSPLNPRYEPEAPA-----AAPAPAPA-------P 84 | AHAAP-VASKPTDVP-TI----------------------SIPE-PQVTEKQV--------------------------- 85 | >Phy00208KX_MYCGR 86 | MY---IPRA------------EDS-----------R-VQRMV------DGAAAGLRIVARSL------A-------ERAE 87 | SNSKEDTPNDRMKVQNIGIALGVIIPIGGAI-IVLTYLHRRHVKRQRVEDMNDPHKSLDFGLEGLG-SMPPQAPKKSRRG 88 | KKGPE-MIV-TDFGGPTAHPSKRGHGMSLDLGVPSPYLLPAGLQ-GSKESIHSMSRN--YDEHDPYRSVAMM--RPSGET 89 | DRF---R----GDDKGSVYSMSTG-N------R-SA------L--PQD--RASLIA------------NARPMS---ITP 90 | SK-RSDPATSHPSTPADVSP------------------------------------------R----------------- 91 | DSHSPISRTRSPLAKLSVDE-----------------TAIAEKQLEPLPS-----P-PTVPE------VALMMPPP-RKS 92 | >Phy0020GNV_PYRTR 93 | MP---HSHHLHHMRHQL----R--HDN-QLGSP-ITGSKTMH------VFERATRVLVARAESS-----------C-TND 94 | SDPGCTKP---TQVPTMAIALAVIVPIVGVS-IVLCFLHRRNKRKLAEEDSKDQYKSNDWGMEGVA-K---------TNK 95 | KKR-P-EM---S-LSEKDAGGGHDRGLSIEAG--SPYILPVGLH-GSRESFHSLSRSQ-HDPHDPYGPVAFLK--DDQST 96 | RGSSVRGGPY-RNETGSVYT--T-SS-------SGT---------RKEGLQAGLLQ------------NAQRMST--SNP 97 | VR-GDSLS------------P---VSTS--SPD--TK-FPDPGIPLSPLNPRFENQSPI-----SPPAASPS-------P 98 | S-------IKPNSVP-TI----------------------SIPE-PGVTEKQV--------------------------- 99 | >Phy0022J75_CRYPA 100 | MDEMLARRNGHLMGPRI----P--IGR-RVAAV--AE-DTSV------EASTPPSHVVGRSSSSTSDASSST-ATCSSSS 101 | ASNTCEKP--TSTSIAGEISIGIAVPMAIIFICVLIYFHRRNLKRQAAEDRDPHHRSLDFGLGDTS-S----------GK 102 | SKR-K-SM-----LGLGGEKSKHPRGLSIDMNLSSPYLLPEHVQ-GSRESMNSLAKTL-HQADDPYRPITKYM-SETGSV 103 | GSLE-K---N-GRYTPSVMTASTK-RVSRQSYANPM------SPALQQPLRQNSYP-KSPLTPSAA-------------- 104 | ----SSVT------------A---VETDIST-P--TAAKE----------------------PTVPEDGPMPPPQC---D 105 | LPPLP-VVP-EIRQPAPVAQRGAA----REPVMQEHEEELDLPD-FSNNSKRESAD-EL--------------------- 106 | >Phy0022OIS_VERA1 107 | MAATAFNGNGYRMGSRI----H--VRT-AEPTHEDAA-L----------LRSPGPVIAARKEC---------------DP 108 | DHPDCEAPAVKPQTLI--IALSVVIPIVAIM-SILYYLHRRGIKKQRMEEASDPTMSLDFGINDDK-M---------GRG 109 | GKRKS-VF---R-EKMLNLDPKHRAQVSMDMNLSSPYLLPPALQ-GSKQSLHSLARNL-HDDDDPYRPVNQYG-SEVGSI 110 | RSFRPEK--E-GRAGSSVYTGSTE-R-------GSSL------HSRTHPPRQNSLP-KPPPLT-A---DPFATPTGARTP 111 | QLETSPIS------------P---TGGS--------L-PH----------------------AIIPEIGTVSYAEDFDDS 112 | NRNLP-HVP-DVTQPAPVAQRDARRVSSGASQSSWNEPAAQFPD-PAAHQVHNAAP-TL--------------------- 113 | >Phy003AMS0_602072 114 | M--------------------------------------------------AETPTLARREPLPSTESSS-------SSS 115 | SSSSETKPTSTLTTTTLPVVLGAVIPVVIAI-AILLYLHRRNVKKLRNEDANDKHKSLDFGLDLAP-T-----GAKP--M 116 | Q-------Q----AEKLDRNAAHNKGVSLDIG-PSPYLLPPGLH-NSRESLSSLSRSIGDGDDDKYRHVGSFL-GDNASL 117 | RSHS-R---G-PQDDASSFTG-ST-R------R-GA------L---GDDMNQGLLR------------NAQRMSR--SSP 118 | PL-YTIPSGDRNVQSPASSD------------------------------------------H----------------- 119 | ERDPG-FQLDLPRSPSPVHV-----------------PGMTISE-PTNSM-----TSNE-PE------FSGVHANTENSA 120 | >Phy003BKXA_GIBZE 121 | MGLTHYH--DQ----------R--ADIGQGASS-ISQ-KMAS------SSSHIFRRLARRENC----------------K 122 | DDNSCAQS-SVSNS--------LVLPIVVAI-I--------NMKKQMLEDAHDPHKSLDFGLGDEG-G---------AKK 123 | SAR-R-SI---FMGGGEKTLAHKPSQLSMDMNLSSPYLLPPGLQ-ESRESLNSLAKSLGNDNQDPYQYVAAITQSETGSL 124 | RSFNPK---D-SHSRNTKFNSPRN---------SGKP-----GSLKMPPSRMNSLP-ETPVSATESRVDPFGTPKM--PA 125 | PA-HPAKS------------P---FDS---E-KDAFH-PA----------------------PIVPEIGVVSD------- 126 | FDEKN-AVP-SVQQPPIARSKT---------------------------------------------------------- 127 | >Phy003BOHC_AJECA 128 | -----------------------------------------------MQIPPPPPTLARRHVVPK--------------- 129 | TPPEDARD----LLVMLPLPLYPYIPLTIAI-LVLVFLHRRHIRKLRSEDANDKHKSLDFGLDVVP-SG------NKKRG 130 | RGRKG-G-MEMTTADAEKSVRRNDRGLSMDITMTSPYLLPPALN-GSHDSLHSLSRSV-HADDDRYRTATAFSAGDNSSM 131 | RSFT-SNLKP-FPDDSVSFTGMSS-R------H-AP------P---GDEMHANLLR------------NAQRMSR--ASP 132 | PP-GTATHSIGSSQSHRSPPR---KLTT--PT------PN----------------------I-----VS---------- 133 | DRSGI-HSPD---------------------------------------R-----SLAP-KSISTPGSELRKS------- 134 | >Phy003DGO9_PENCH 135 | MP---HAHH-------AGLVMRNH----VRRDV-IPPHRLPFLVPSTSSIATELPSLVARAE-----------AS----- 136 | TTVTGEKPTSNLTTTVLPVVLGAGVPILCAI-VVLIVLHRRHVKKLLREDAMDKHKSLDFGMDTVG-PA----TRRK--G 137 | P------------GMPPMSEPTHTKGLSLDVG---PYLMPPGLK-NSPESLRSMSI-----DDDKYRPATA-------SI 138 | RSYP-R---------GSRFEG-------------------------ADDGNSGLLQ------------NAQRMSR--SSP 139 | PL-YSSPIESHGRSLDQHND------------------------------------------Y----------------- 140 | L-----GEVPGVTHPPAAQQ-----------------PGMAIGS-PNANRIPSPEP-LP--------------HLDSSLG 141 | >Phy003PHXT_PENMQ 142 | MS--HRHGMHHHVRRHI------PEDP-VQLES-VPLEPAP--------TISEAPSVIRRTSSATST--------C---- 143 | TGSSCETTSSSNLVNTLPVVLGVVIPVVLAI-AVLLFLHRRHVRKLRQEDANDKHKSLDFGMEVVR-AG----GGK---- 144 | -------------ANPEMGEKPHKHGMSLDI-ISSPYLLPPGLH-GSKESLRSLSKVI-SPDDDKYRLGLAAQ-SDTASL 145 | RSYR-SHPRM-GQDDASSFRG-ST-R------H-GP------L---PDDMNQGLLQ------------NASRMSR--SPP 146 | VD-ATSPLSVNHTIHEEQFD------------------------------------------H----------------- 147 | PRTVG-NQSPIRQAESPPMA--------------------KSPK-NHVSP-----DHSG-QG---------DE------- 148 | >Phy003PVXT_TALSN 149 | -M--PHRHGIHHVHRRN------AENL-IKLES-LPLKPAP--------TISEPPSVVRRASSETST--------C---- 150 | SGASCEKSSSSGLVNTLPVVLGVVIPVVAAI-IVLLILHRRHVRKLRQEDANDKHKSLDFGMEVVR-AG----GGN---- 151 | ---P---------KQPEMGEKPHKHGMSLDI-IGSPYLLPPGLH-NSKESLRSLTKVI-SVEDDKYRVAAQ---SDTASL 152 | RSHR-T---M-GNDDASSFGG-ST-R------H-GP------I---PDDMNQGLLQ------------NASRMSR--SPP 153 | VD-ASSPLSVSQTIHEEPFD------------------------------------------H----------------- 154 | SNAMR-NQSQNHQAVDS-HM-----------------PPEDLPK-NHSSP-----APSG-PG---------DE------- 155 | >Phy003PZPF_FUSOX 156 | MGIAHYE--GARLR-------P--RTNIEDVSS-ASQ-NGVA------LSSSIFRRLVTRENC----------------Q 157 | DTDSCAAA-SANTNLVVPIVVAIVVPIVLIA-IFLYYLHRKNMKRQMLEDANDPHKSLDFGLDGA--G---------GKK 158 | SAR-R-SL---FMGGGEKGLNHKPSQLSMDMNLSSPYLLPPGLQ-ESRESLNSLAKSLGNDNQDPYHP------------ 159 | ----------------------RN---------SGKP-----GSMKMPPSRMNSLP-ETPVSATDSKVDPFGTPKA--PA 160 | PT-HQPNS------------H---FDE-----KDGFQ-PT----------------------AIIPEIGVVSD------- 161 | FDEKR-DGA-SVQPPPAVRSKT---------------------------------------------------------- 162 | >Phy003QBJJ_PENDI 163 | MS---HAHH-------AGLVMRNH----VRRDV-IPANRVPIFVPS-LSVATQLPTLVARSE------------S----- 164 | EPTSGPKATSNLATTVFPIVFGAGIPIFCAL-IILVVLHRRQVKKLVREDAMDKHKSLDFGLDTVG-PA----TRRK--G 165 | A-------K----GMPPMSEHNHTKGLSLDVG---PYLLPPGLQ-HSTDSLRSMSI-----DDGKYRPATA-------SI 166 | RSNS-R---------NSKYGG-------------------------TDDGNSGLLQ------------NAQRIPR--SSP 167 | PL-CSPIEPRARSPLNQHDD------------------------------------------Y----------------- 168 | I-----GQVPEVTHPPAVHQ-----------------PGMAIGS-PNTNRIPSPEP-LP--------------HVDSSSG 169 | >Phy0043OCA_COLGM 170 | MASASFSANGYVMGSRI----P--IRD-VNPINMTPT-PASP-------IRIASRIIGARDE------------QC--TG 171 | SATLCEKP-VDPASLTLPITLGVTIPIVGAL-FLLYYFHRRNMRRQAQEDATDPNRGLDFGLGDAP-I--D------KGG 172 | KKRKS-LM---FREKGMGIETNKQRQLSMDMNLSSPYLLPPGLQ-SSRESLNSLARTL-HNEADPYRPVYASS--DAGSI 173 | YTKT-------TSR-----------R-------GSSMTGRTTMTQNTLPPRQTSLP-RPPPAT-A---DPLGASR--SGS 174 | PSL-PPTS------------P---AIR---S-P--LV-AE----------------------PVIPQIETVP-------S 175 | GSSLP-QIP-DVPEPEPVAQRGL--------------PGNSRPS-PGHPTILEARE-PE--------------------- 176 | >Phy0043W64_36779 177 | M-AGVAEAGSYRMSGRI----P--IVR-RNASG-VEA-LDVP-------QPDQTRPLVARESID-----------C-TGE 178 | NANLCEKP-YGANSLGVPIALGVAIPIVALL-GVVFWLHRRNIKKQRSEEANDPHKSLDFGLGDGS-R--G------SKG 179 | GKRKS-AF---FGGGGAEKASHRNNQLSMDMNLSSPYLLPPSAQAGSRESLHSLARTL-HGNEDPYSPVYQ--QSDARSM 180 | RSTK-K---G-SRDD-------YN---------GPSG-----PGLSVPPSRKSSFP-TSPTSPVTSIPPRYEASK---DE 181 | VT-PPPPA------------HSPGQAN---F-P--LN-DT----------------------SPYPNDHQLDA------H 182 | GVSMP-AVP-ELQEPAQAKMPS-------------SP---RFPL-P---------------------------------- 183 | >Phy00443NV_MAGO7 184 | MVGVTVHEGEYHLGSRM----P--VMA-RDAST-PAL-QIAA------DGPGFFKRLVARQSSDD----------CVNGE 185 | PSNLCEKP-VTSQTLALPIALGVTIPLVALV-VMLIWLHRKNVRRQRQEDANDPHKSLDFGLDMGP------------GK 186 | RKS-K--L---F-GGEKLGGGPHNRQISMDMNLSSPYLLPPNMQ-NSRESIHSLAKTL--HNEDPYRHITQYNASDAGSL 187 | RSYK-A---G-GMD-------------------RPIG-----PKITVPTSRKGSLQATSPTSTIGSVPPRYEASQ---DD 188 | YV-KPPPP------------A---ALK---S-P--TQ-DS----------------------TPYPDDKSGP-------L 189 | ATVMP-SVP-EIQEPKPASLSK----E-SS---QAPS---LAAV-PPSSPLTISAP-EI--------------------A 190 | >Phy0044G80_PHANO 191 | M-------------HHL----R--RDA-QMAAS-TSATHTL--------VDRASRVLVARTT-------------C-TND 192 | SDPGCTKP---TQVPTIAIALAAIVPVVGLL-IVLVFLHRRNQKKLAAEDAKDKYKSMDFGMGGAG-K---------KNK 193 | -GG-P-EM---SITEKDIRGGAHSRGISLEGG--NPYILPVGLH-GSRESFHSLSRSQ-NDPHDPYRPVTFLR-NDNQSI 194 | RSQS-RG--Y-GHDNGSLYTTRTMSS-------GGT---------QRNRMGDGLLN------------NAQRMST--SRP 195 | MR-SESLS------------P---DSTT--SPD--VK-FPEQNIALSPLNPRFEGEPLAMPATELPHSRTPP-------S 196 | A-------SSPPNVP-II----------------------AVPA-PAAAKPEI--------------------------- 197 | -------------------------------------------------------------------------------- /13_ggtree_gallery.Rmd: -------------------------------------------------------------------------------- 1 | \newpage 2 | 3 | # Gallery of Reproducible Examples {#chapter13} 4 | 5 | 6 | 7 | 8 | ## Visualizing pairwise nucleotide sequence distance with a phylogenetic tree {#hpv58} 9 | 10 | 11 | This example reproduces figure 1 of [@chen_ancient_2017]. It extracts accession numbers from tip labels of the HPV58 tree and calculates pairwise nucleotide sequence distances. The distance matrix is visualized as dot and line plots. This example demonstrates the ability to add multiple layers to a specific panel. As illustrated in Figure \@ref(fig:jv2017), the `geom_facet()` function displays sequence distances as a dot plot and then adds a layer of line plot to the same panel, *i.e.*, sequence distance. In addition, the tree in `geom_facet()` can be fully annotated with multiple layers (clade labels, bootstrap support values, *etc.*). The source code is modified from the supplemental file of [@yu_two_2018]. 12 | 13 | ```{r message=FALSE} 14 | library(TDbook) 15 | library(tibble) 16 | library(tidyr) 17 | library(Biostrings) 18 | library(treeio) 19 | library(ggplot2) 20 | library(ggtree) 21 | 22 | # loaded from TDbook package 23 | tree <- tree_HPV58 24 | 25 | clade <- c(A3 = 92, A1 = 94, A2 = 108, B1 = 156, 26 | B2 = 159, C = 163, D1 = 173, D2 = 176) 27 | tree <- groupClade(tree, clade) 28 | cols <- c(A1 = "#EC762F", A2 = "#CA6629", A3 = "#894418", B1 = "#0923FA", 29 | B2 = "#020D87", C = "#000000", D1 = "#9ACD32",D2 = "#08630A") 30 | 31 | ## visualize the tree with tip labels and tree scale 32 | p <- ggtree(tree, aes(color = group), ladderize = FALSE) %>% 33 | rotate(rootnode(tree)) + 34 | geom_tiplab(aes(label = paste0("italic('", label, "')")), 35 | parse = TRUE, size = 2.5) + 36 | geom_treescale(x = 0, y = 1, width = 0.002) + 37 | scale_color_manual(values = c(cols, "black"), 38 | na.value = "black", name = "Lineage", 39 | breaks = c("A1", "A2", "A3", "B1", "B2", "C", "D1", "D2")) + 40 | guides(color = guide_legend(override.aes = list(size = 5, shape = 15))) + 41 | theme_tree2(legend.position = c(.1, .88)) 42 | ## Optional 43 | ## add labels for monophyletic (A, C and D) and paraphyletic (B) groups 44 | dat <- tibble(node = c(94, 108, 131, 92, 156, 159, 163, 173, 176,172), 45 | name = c("A1", "A2", "A3", "A", "B1", 46 | "B2", "C", "D1", "D2", "D"), 47 | offset = c(0.003, 0.003, 0.003, 0.00315, 0.003, 48 | 0.003, 0.0031, 0.003, 0.003, 0.00315), 49 | offset.text = c(-.001, -.001, -.001, 0.0002, -.001, 50 | -.001, 0.0002, -.001, -.001, 0.0002), 51 | barsize = c(1.2, 1.2, 1.2, 2, 1.2, 1.2, 3.2, 1.2, 1.2, 2), 52 | extend = list(c(0, 0.5), 0.5, c(0.5, 0), 0, c(0, 0.5), 53 | c(0.5, 0), 0, c(0, 0.5), c(0.5, 0), 0) 54 | ) %>% 55 | dplyr::group_split(barsize) 56 | 57 | p <- p + 58 | geom_cladelab( 59 | data = dat[[1]], 60 | mapping = aes( 61 | node = node, 62 | label = name, 63 | color = group, 64 | offset = offset, 65 | offset.text = offset.text, 66 | extend = extend 67 | ), 68 | barsize = 1.2, 69 | fontface = 3, 70 | align = TRUE 71 | ) + 72 | geom_cladelab( 73 | data = dat[[2]], 74 | mapping = aes( 75 | node = node, 76 | label = name, 77 | offset = offset, 78 | offset.text =offset.text, 79 | extend = extend 80 | ), 81 | barcolor = "darkgrey", 82 | textcolor = "darkgrey", 83 | barsize = 2, 84 | fontsize = 5, 85 | fontface = 3, 86 | align = TRUE 87 | ) + 88 | geom_cladelab( 89 | data = dat[[3]], 90 | mapping = aes( 91 | node = node, 92 | label = name, 93 | offset = offset, 94 | offset.text = offset.text, 95 | extend = extend 96 | ), 97 | barcolor = "darkgrey", 98 | textcolor = "darkgrey", 99 | barsize = 3.2, 100 | fontsize = 5, 101 | fontface = 3, 102 | align = TRUE 103 | ) + 104 | geom_strip(65, 71, "italic(B)", color = "darkgrey", 105 | offset = 0.00315, align = TRUE, offset.text = 0.0002, 106 | barsize = 2, fontsize = 5, parse = TRUE) 107 | 108 | ## Optional 109 | ## display support values 110 | p <- p + geom_nodelab(aes(subset = (node == 92), label = "*"), 111 | color = "black", nudge_x = -.001, nudge_y = 1) + 112 | geom_nodelab(aes(subset = (node == 155), label = "*"), 113 | color = "black", nudge_x = -.0003, nudge_y = -1) + 114 | geom_nodelab(aes(subset = (node == 158), label = "95/92/1.00"), 115 | color = "black", nudge_x = -0.0001, 116 | nudge_y = -1, hjust = 1) + 117 | geom_nodelab(aes(subset = (node == 162), label = "98/97/1.00"), 118 | color = "black", nudge_x = -0.0001, 119 | nudge_y = -1, hjust = 1) + 120 | geom_nodelab(aes(subset = (node == 172), label = "*"), 121 | color = "black", nudge_x = -.0003, nudge_y = -1) 122 | ``` 123 | 124 | ```{r eval=F} 125 | ## extract accession numbers from tip labels 126 | tl <- tree$tip.label 127 | acc <- sub("\\w+\\|", "", tl) 128 | names(tl) <- acc 129 | 130 | ## read sequences from GenBank directly into R 131 | ## and convert the object to DNAStringSet 132 | tipseq <- ape::read.GenBank(acc) %>% as.character %>% 133 | lapply(., paste0, collapse = "") %>% unlist %>% 134 | DNAStringSet 135 | ## align the sequences using muscle 136 | tipseq_aln <- muscle::muscle(tipseq) 137 | tipseq_aln <- DNAStringSet(tipseq_aln) 138 | ``` 139 | 140 | ```{r echo=F} 141 | ## extract accession numbers from tip labels 142 | tl <- tree$tip.label 143 | acc <- sub("\\w+\\|", "", tl) 144 | names(tl) <- acc 145 | 146 | ## writeXStringSet(tipseq_aln, file = "data/HPV58_aln.fas") 147 | #tipseq_aln <- readDNAStringSet("data/HPV58_aln.fas") 148 | tipseq_aln <- TDbook::dna_HPV58_aln %>% 149 | as.character %>% 150 | lapply(., paste0, collapse = "") %>% 151 | unlist() %>% 152 | Biostrings::DNAStringSet() 153 | ``` 154 | 155 | 156 | (ref:jv2017scap) Phylogeny of HPV58 complete genomes with dot and line plots of pairwise nucleotide sequence distances. 157 | 158 | (ref:jv2017cap) **Phylogeny of HPV58 complete genomes with dot and line plots of pairwise nucleotide sequence distances**. 159 | 160 | 161 | ```{r jv2017, fig.width=12, fig.height=12, fig.cap="(ref:jv2017cap)", fig.scap="(ref:jv2017scap)", warning=FALSE, out.width='100%'} 162 | ## calculate pairwise hamming distances among sequences 163 | tipseq_dist <- stringDist(tipseq_aln, method = "hamming") 164 | 165 | ## calculate the percentage of differences 166 | tipseq_d <- as.matrix(tipseq_dist) / width(tipseq_aln[1]) * 100 167 | 168 | ## convert the matrix to a tidy data frame for facet_plot 169 | dd <- as_tibble(tipseq_d) 170 | dd$seq1 <- rownames(tipseq_d) 171 | td <- gather(dd,seq2, dist, -seq1) 172 | td$seq1 <- tl[td$seq1] 173 | td$seq2 <- tl[td$seq2] 174 | 175 | g <- p$data$group 176 | names(g) <- p$data$label 177 | td$clade <- g[td$seq2] 178 | 179 | ## visualize the sequence differences using dot plot and line plot 180 | ## and align the sequence difference plot to the tree using facet_plot 181 | p2 <- p + geom_facet(panel = "Sequence Distance", 182 | data = td, geom = geom_point, alpha = .6, 183 | mapping = aes(x = dist, color = clade, shape = clade)) + 184 | geom_facet(panel = "Sequence Distance", 185 | data = td, geom = geom_path, alpha = .6, 186 | mapping=aes(x = dist, group = seq2, color = clade)) + 187 | scale_shape_manual(values = 1:8, guide = FALSE) 188 | 189 | print(p2) 190 | ``` 191 | 192 | ## Displaying Different Symbolic Points for Bootstrap Values. {#symbolic-bootstrap} 193 | 194 | We can cut the bootstrap values into several intervals, *e.g.*, to indicate whether the clade is of high, moderate, or low support. Then we can use these intervals as categorical variables to set different colors or shapes of symbolic points to indicate the bootstrap values belong to which category (Figure \@ref(fig:bpinterval)). 195 | 196 | (ref:bpintervalscap) Partitioning bootstrap values. 197 | 198 | (ref:bpintervalcap) **Partitioning bootstrap values**. Bootstrap values were divided into three categories and this information was used to color circle points. 199 | 200 | ```{r include = FALSE} 201 | ## phytools also have a read.newick function 202 | read.newick <- treeio::read.newick 203 | ``` 204 | 205 | ```{r bpinterval, fig.width=7.5, fig.height=8.6, fig.cap="(ref:bpintervalcap)", fig.scap="(ref:bpintervalscap)", out.width='100%'} 206 | library(treeio) 207 | library(ggplot2) 208 | library(ggtree) 209 | library(TDbook) 210 | 211 | tree <- read.newick(text=text_RMI_tree, node.label = "support") 212 | root <- rootnode(tree) 213 | ggtree(tree, color="black", size=1.5, linetype=1, right=TRUE) + 214 | geom_tiplab(size=4.5, hjust = -0.060, fontface="bold") + xlim(0, 0.09) + 215 | geom_point2(aes(subset=!isTip & node != root, 216 | fill=cut(support, c(0, 700, 900, 1000))), 217 | shape=21, size=4) + 218 | theme_tree(legend.position=c(0.2, 0.2)) + 219 | scale_fill_manual(values=c("white", "grey", "black"), guide='legend', 220 | name='Bootstrap Percentage(BP)', 221 | breaks=c('(900,1e+03]', '(700,900]', '(0,700]'), 222 | labels=expression(BP>=90,70 <= BP * " < 90", BP < 70)) 223 | ``` 224 | 225 | 226 | ## Highlighting Different Groups {#phylo-grouping} 227 | 228 | 229 | This example reproduces Figure 1 of [@larsen_identification_2019]. It used `groupOTU()` to add grouping information of chicken CTLDcps. The branch line type and color are defined based on this grouping information. Two groups of CTLDcps are highlighted in different background colors using `geom_hilight` (red for Group II and green for Group V). The avian-specific expansion of Group V with the subgroups of A and B- are labeled using `geom_cladelab` (Figure \@ref(fig:treeLarsen)). 230 | 231 | 232 | 233 | (ref:treeLarsenscap) Phylogenetic tree of CTLDcps. 234 | 235 | (ref:treeLarsencap) **Phylogenetic tree of CTLDcps**. Using different background colors, line types and colors, and clade labels to distinguish groups. 236 | 237 | 238 | 239 | 240 | ```{r treeLarsen, fig.cap="(ref:treeLarsencap)", fig.scap="(ref:treeLarsenscap)", fig.width=7.5, fig.height=6.3, out.width='100%'} 241 | library(TDbook) 242 | mytree <- tree_treenwk_30.4.19 243 | 244 | # Define nodes for coloring later on 245 | tiplab <- mytree$tip.label 246 | cls <- tiplab[grep("^ch", tiplab)] 247 | labeltree <- groupOTU(mytree, cls) 248 | 249 | p <- ggtree(labeltree, aes(color=group, linetype=group), layout="circular") + 250 | scale_color_manual(values = c("#efad29", "#63bbd4")) + 251 | geom_nodepoint(color="black", size=0.1) + 252 | geom_tiplab(size=2, color="black") 253 | 254 | p2 <- flip(p, 136, 110) %>% 255 | flip(141, 145) %>% 256 | rotate(141) %>% 257 | rotate(142) %>% 258 | rotate(160) %>% 259 | rotate(164) %>% 260 | rotate(131) 261 | 262 | ### Group V and II coloring 263 | dat <- data.frame( 264 | node = c(110, 88, 156,136), 265 | fill = c("#229f8a", "#229f8a", "#229f8a", "#f9311f") 266 | ) 267 | p3 <- p2 + 268 | geom_hilight( 269 | data = dat, 270 | mapping = aes( 271 | node = node, 272 | fill = I(fill) 273 | ), 274 | alpha = 0.2, 275 | extendto = 1.4 276 | ) 277 | 278 | ### Putting on a label on the avian specific expansion 279 | p4 <- p3 + 280 | geom_cladelab( 281 | node = 113, 282 | label = "Avian-specific expansion", 283 | align = TRUE, 284 | angle = -35, 285 | offset.text = 0.05, 286 | hjust = "center", 287 | fontsize = 2, 288 | offset = .2, 289 | barsize = .2 290 | ) 291 | 292 | ### Adding the bootstrap values with subset used to remove all bootstraps < 50 293 | p5 <- p4 + 294 | geom_nodelab( 295 | mapping = aes( 296 | x = branch, 297 | label = label, 298 | subset = !is.na(as.numeric(label)) & as.numeric(label) > 50 299 | ), 300 | size = 2, 301 | color = "black", 302 | nudge_y = 0.6 303 | ) 304 | 305 | ### Putting labels on the subgroups 306 | p6 <- p5 + 307 | geom_cladelab( 308 | data = data.frame( 309 | node = c(114, 121), 310 | name = c("Subgroup A", "Subgroup B") 311 | ), 312 | mapping = aes( 313 | node = node, 314 | label = name 315 | ), 316 | align = TRUE, 317 | offset = .05, 318 | offset.text = .03, 319 | hjust = "center", 320 | barsize = .2, 321 | fontsize = 2, 322 | angle = "auto", 323 | horizontal = FALSE 324 | ) + 325 | theme( 326 | legend.position = "none", 327 | plot.margin = grid::unit(c(-15, -15, -15, -15), "mm") 328 | ) 329 | print(p6) 330 | ``` 331 | 332 | ## Phylogenetic Tree with Genome Locus Structure {#genome-locus} 333 | 334 | The `geom_motif()` is defined in `r Biocpkg("ggtree")` and it is a wrapper layer of the `gggenes::geom_gene_arrow()`. The `geom_motif()` can automatically adjust genomic alignment by selective gene (via the `on` parameter) and can label genes via the `label` parameter. In the following example, we use `example_genes` dataset provided by `r CRANpkg("gggenes")`. As the dataset only provides genomic coordination of a set of genes, a phylogeny for the genomes needs to be constructed first. We calculate Jaccard similarity based on the ratio of overlapping genes among genomes and correspondingly determine genome distance. The BioNJ algorithm was applied to construct the tree. Then we can use `geom_facet()` to visualize the tree with the genomic structures (Figure \@ref(fig:gggenes)). 335 | 336 | 337 | (ref:gggenesscap) Genomic features with a phylogenetic tree. 338 | 339 | (ref:gggenescap) **Genomic features with a phylogenetic tree.** 340 | 341 | 342 | ```{r gggenes, fig.width=9, fig.height=4, fig.cap="(ref:gggenescap)", fig.scap="(ref:gggenesscap)", out.width='100%'} 343 | library(dplyr) 344 | library(ggplot2) 345 | library(gggenes) 346 | library(ggtree) 347 | 348 | get_genes <- function(data, genome) { 349 | filter(data, molecule == genome) %>% pull(gene) 350 | } 351 | 352 | g <- unique(example_genes[,1]) 353 | n <- length(g) 354 | d <- matrix(nrow = n, ncol = n) 355 | rownames(d) <- colnames(d) <- g 356 | genes <- lapply(g, get_genes, data = example_genes) 357 | 358 | for (i in 1:n) { 359 | for (j in 1:i) { 360 | jaccard_sim <- length(intersect(genes[[i]], genes[[j]])) / 361 | length(union(genes[[i]], genes[[j]])) 362 | d[j, i] <- d[i, j] <- 1 - jaccard_sim 363 | } 364 | } 365 | 366 | tree <- ape::bionj(d) 367 | 368 | p <- ggtree(tree, branch.length='none') + 369 | geom_tiplab() + xlim_tree(5.5) + 370 | geom_facet(mapping = aes(xmin = start, xmax = end, fill = gene), 371 | data = example_genes, geom = geom_motif, panel = 'Alignment', 372 | on = 'genE', label = 'gene', align = 'left') + 373 | scale_fill_brewer(palette = "Set3") + 374 | scale_x_continuous(expand=c(0,0)) + 375 | theme(strip.text=element_blank(), 376 | panel.spacing=unit(0, 'cm')) 377 | 378 | facet_widths(p, widths=c(1,2)) 379 | ``` 380 | --------------------------------------------------------------------------------