小编Arn*_*uwe的帖子

R- 如何在 haploNet haplotyp Networks {pegas} {ape} {adegenet} 中绘制正确的饼图

当使用 haploNet 包在单倍型网络上绘制一些图时,我使用了 Internet 上可用的脚本来执行此操作。不过我觉得有什么地方不对。该脚本以 woodmouse 示例的形式提供。我使用的代码是:

x <- read.dna(file="Masto.fasta",format="fasta")
h <- haplotype(x)
net <- haploNet(h)
plot(net)

plot(net, size = attr(net, "freq"), fast = TRUE)
plot(net, size = attr(net, "freq"))
plot(net, size=attr(net, "freq"), scale.ratio = 2, cex = 0.8

table(rownames(x))

ind.hap<-with(
    stack(setNames(attr(h, "index"), rownames(h))), 
    table(hap=ind, pop=rownames(x)[values])
)
ind.hap 

plot(net, size=attr(net, "freq"), scale.ratio = 2, cex = 0.8, pie=ind.hap)
legend(50,50, colnames(ind.hap), col=rainbow(ncol(ind.hap)), pch=20)

legend(x=7,y=10,c("Baeti ero","Felege weyni","Golgole naele","Hagare selam","Ruba feleg","Ziway"),c("red","yellow","green","turquoise","blue","magenta"))
Run Code Online (Sandbox Code Playgroud)

但是,在绘制 ind.hap 时,您会注意到某些行不在正确的位置。你可以在这里看到这个:

      pop
hap    Baetiero ETH022 ETH742 Felegeweyni Golgolenaele Rubafeleg
  I …
Run Code Online (Sandbox Code Playgroud)

r genetics dna-sequence phylogeny

3
推荐指数
1
解决办法
1961
查看次数

标签 统计

dna-sequence ×1

genetics ×1

phylogeny ×1

r ×1