Plotting F3 statistics values on world map
0
0
Entering edit mode
5.3 years ago
SOHAIL ▴ 400

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 • 2.0k views
ADD COMMENT
0
Entering edit mode

Please edit your page and just post the actual link, not the Google redirect URL.

This is the actual link: https://twitter.com/craigandersn/status/747383480720424960

Or if you want just the image: https://pbs.twimg.com/media/Cl89J3rUoAA4P8o.jpg:large

ADD REPLY
0
Entering edit mode

Provide example data.

ADD REPLY
0
Entering edit mode

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!

ADD REPLY
0
Entering edit mode

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.

ADD REPLY
0
Entering edit mode

@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...

ADD REPLY
0
Entering edit mode

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)
ADD REPLY

Login before adding your answer.

Traffic: 2108 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6