工具 | R包mapmixture绘制群体结构与地图分布

mapmixture简介

群体结构(admixture)绘图,R包pophelper是神器(https://github.com/royfrancis/pophelper),立个flag,下次投稿。今天给大家介绍的是另一个R包mapmixture,同样可绘制群体结构图,并与地图分布相结合。小小R包竟然能够发到MER,也是很神奇。想想几年前小野为了画个漂亮的地图,费了老大劲,如今这个工具让完全没基础的小白也能上手了(shiny:https://tomjenkins.shinyapps.io/mapmixture/)。

Mapmixture可接受由admixture分析生成的格式数据,并在投影(可选)地图上以饼图的形式直观显示每个地点、每个遗传簇(genetic cluster)的比例。将这种基于地点的地图展示方法与基于个体的群体结构柱状图的常规展示方法相结合,以增强对遗传地理模式的解读。

温馨提示:为避免不必要的麻烦,请留意下中国地图的九段线,这里我没测试。

GitHub上详细介绍了安装说明以及如何使用软件包和交互式网络应用程序的示例:

https://github.com/tom-jenkins/mapmixture

示例

数据输入格式

示例结果

示例代码

file <- system.file("extdata", "admixture1.csv", package = "mapmixture")
admixture1 <- read.csv(file)
file <- system.file("extdata", "coordinates.csv", package = "mapmixture")
coordinates <- read.csv(file)

map4 <- mapmixture(admixture1, coordinates,
                   cluster_cols = c("#f1a340","#998ec3"),
                   cluster_names = c("Ancestry 1","Ancestry 2"),
                   crs = 4326,
                   boundary = c(xmin=-20, xmax=20, ymin=40, ymax=62),
                   pie_size = 2.5,
)+ theme(legend.position = "top",plot.margin = margin(l = 10, r = 10))+
  guides(fill = guide_legend(override.aes = list(size = 5, alpha = 1)))

structure_barplot <- structure_plot(admixture1,
                                    type = "structure",
                                    cluster_cols = c("#f1a340","#998ec3"),
                                    site_dividers = TRUE,
                                    divider_width = 0.4,
                                    site_order = c(
                                      "Vigo","Ile de Re","Isles of Scilly","Mullet Peninsula",
                                      "Shetland","Cromer","Helgoland","Flodevigen","Lysekil","Bergen"
                                    ),
                                    labels = "site",
                                    flip_axis = FALSE,
                                    site_ticks_size = -0.05,
                                    site_labels_y = -0.35,
                                    site_labels_size = 2.2)+
  theme(
    axis.title.y = element_text(size = 8, hjust = 1),
    axis.text.y = element_text(size = 5),
  )
grid.arrange(map4, structure_barplot, nrow = 2, heights = c(4,1))

posted @ 2024-06-16 10:28  生物信息与育种  阅读(47)  评论(0编辑  收藏  举报