Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the R language ggtree to show the evolutionary tree

2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Today, I will talk to you about how to use R language ggtree to display evolutionary trees. Many people may not know much about it. In order to let everyone know more, Xiaobian summarizes the following contents for everyone. I hope you can gain something according to this article.

Core gut microbial communities are maintained by beneficial interactions and strain variability in fish. Journal Nature Microbiology

image.png

Today's duplicate image is the cluster tree in Figure1

image.png The article reads

Hierarchical clustering dendrogram with jackknife support (numbers on the branches; only values above 50 are shown in the tree).

So the actual data in the paper is cluster analysis, not evolutionary tree. He can also obtain the support rate corresponding to each node by doing cluster analysis here. I don't know how this is going to happen yet. To mimic this diagram, I used the phylogenetic tree file directly for the input data below, because it is easy to get support information for nodes when constructing the evolutionary tree.

First, prepare the fasta format sequence file needed to construct the evolutionary tree.

The dataset used here comes from https://www.kuleuven.be/aidslab/phylogenybook/Data_sets.html

image.png

The second edition of The Phylogenetic Handbook is available online.

The first step is to do multiple sequence alignment, where I use mafftmafft --auto ggtree_practice.fasta > ggtree_practice_aligned.fasta

iqtreeiiqtree-s ggtree_practice_aligned. fasta-bb1000

Get the tree file ggtree_practice_aligned.fasta.treefile

The next step in R is to prepare a grouped data file.

Three columns of data

The first column is the sequence name of the fasta file used to build the evolutionary tree. Note that label is used instead of other columns. The second column is grouping information, which is used to fill different colors. The third column is also grouping information, which is used to map shapes.

The column names in the second and third columns are what you want to show on the legend.

image.png Loading required package library(ggtree)

library(treeio)

library(tidytree)

treeio is used to read the evolutionary tree tidytree is used to integrate grouping information into the evolutionary tree ggtree is used to visualize the evolutionary tree and read the evolutionary tree and grouping information data

tree

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report