我正在使用gheatmap教程来绘制系统发育树及其相关的基因型信息。我创建了下面的代码来执行此任务,但是,我无法理解为什么代码仅生成没有基因型热图的系统进化树。恳请您提供任何帮助以解决代码问题。
请参阅下面的代码,newick和基因型文件,以及我要生成的绘图类型(从教程中提取)。
感谢您的帮助
library(ggtree)
tree <- read.tree("Sequence_data.fasta.tree")
genotype = read.table("Genotypes.txt", sep = "\t", stringsAsFactors = F, header=T,strip.white=TRUE)
genotype <- as.data.frame(genotype)
p <- ggtree(tree) + geom_treescale(x=2, y=4, offset=5) + geom_tiplab(size=2)
gheatmap(p, genotype, offset =0.5, width = 1, font.size = 3, colnames_angle = 90, hjust = 1) +
这是新树
(28R2/G2:0.00055,(12R2/G2:0.00055,(((11R1/G1:0.0,18R1/G1:0.0,39R1/G1:0.0):0.04002,(37R1/G1:0.00164,28R1/G1:0.00055)1.000:0.03588)1.000:0.26162,((30R2/G8:0.00333,(77R2/G8:0.00337,(54R2/G8:0.00263,(83R2/G8:0.00083,68R2/G8:0.00726)0.986:0.00594)0.841:0.00055)0.285:0.00054)1.000:0.01154,(73R2/G3:0.00980,(34R2/G3:0.00055,35R2/G3:0.00055)0.992:0.00550)0.995:0.00838)1.000:0.02954)0.996:0.02560)0.788:0.00055,(34R2/G2:0.00055,(48R2/G2:0.00055,(27R2/G2:0.00055,(70R2/G2:0.00076,44R2/G8:0.00054)0.605:0.00055)0.580:0.00055)0.491:0.00055)0.752:0.00055);
最后是基因型数据,
taxa P6 P1 P2
37R1/G1 I1 A1 N1
28R1/G1 I1 A1 N1
11R1/G1 I1 A1 N1
18R1/G1 I1 A1 N1
39R1/G1 I1 A1 N1
83R2/G8 I2 A2 N2
54R2/G8 I2 A2 N2
77R2/G8 I2 A2 N2
68R2/G8 I2 A2 N2
30R2/G8 I2 A2 N2
73R2/G3 I2 A2 N2
34R2/G3 I2 A2 N2
35R2/G3 I2 A2 N2
44R2/G8 I2 A2 N2
70R2/G2 I2 A2 N2
48R2/G2 I2 A2 N2
27R2/G2 I2 A2 N2
12R2/G2 I2 A2 N2
28R2/G2 I2 A2 N2
34R2/G2 I2 A2 N2