This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Plotting F3 statistics values on world map

Hi Everybody, I calculated f3-statistics values with admixtools using combination (TARGETPOP, WORLD_WIDEPOPS, OUTGROUP), now i want to draw the data values for given population in terms of color circle points on world map. I started from here http://eriqande.github.io/rep-res-web/lectures/making-maps-with-R.html] and I figured out few initial commands:

library(ggplot2)
library(ggmap)
library(maps)
library(mapdata)
w <- map_data("world")
ggplot() + geom_polygon(data = w, aes(x=long, y = lat, group = group), fill = "gray", color = "gray") + coord_fixed(1.3)

But I don't know how to plot data values for hundred of populations, how to get long and lat values or work in layers in R, plotting country boundaries, etc..

Can anyone please guide me how to plot such data points on a world map. For example the image:

https://pbs.twimg.com/media/Cl89J3rUoAA4P8o.jpg:large

kind regards

sohail

r ngs

Provide example data.

Hi @zx8754,

The example dataset includes many populations with F3-statistics values. For instance, F3(TARGET, X, OUTGROUPPOP), where the X pop with their corresponding output values are e.g.:

X   f3
Altaian 0.184
Dolgan  0.189
Ket 0.176
Karitiana   0.185
Hezhen  0.204
Daur    0.203
Cambodian   0.193
Dakpa   0.203
Han 0.208
Dai 0.204
Atayal  0.203
Bantawa 0.206
Damai   0.163
Baram   0.196
Brahui  0.134
Balochi 0.135
Hazara  0.170
Kalash  0.140
Kharia  0.163
Armenian    0.130
Basque  0.133
French  0.133
German  0.134
Dinka   0.017

thanks!

To put these on a world map you need to know where in the world they come from, i.e. your data should also contain this information either as countries or as geographic coordinates. The example data you showed is incomplete.

@Jean-Karim, Thanks for your reply. is there any way to get the approximate Lat. and long. information, if the exact info. is unknown and haven't collected during sample collection, but the city/province/area names are known...

If country level resolution is sufficient, you can get country coordinates in R from the rworldmap package:

world.map <- getMap()
country.coords <- world.map@data[,c("NAME", "LAT", "LON")]

For a wider range of names, you can try the package geonames which gets names from the geonames database. To use the package, you need to create an account and enable webservices for your account. Then use the GNsearch() function. Try something like:

search.results <- GNsearch(name_equals = some.name)
coords <- data.frame(name = search.results$toponymName, lat = search.results$lat, lon = search.results$lng)

0 answers

No answers yet.

Log in to answer this question.