Introduction

The data for the following pie graphs was collected by Alice Popejoy and Stephanie Fullerton from the University of Washington, Seattle. Their method for collecting the data including analyzing the GWAS Catalog in order to determine the ancestry of individuals whose sequences were inputted into the database. The process was repeated in 2016 to exemplify the increase in novel sequences present in the human genome that are more common in populations under-represented in GWAS. Since 2009, the increase in representation has been most pronounced for Asian populations and is still very lacking most non-European populations.

Create data

The vectors euro_noneuro and euro_asian_other contain elements representing the percentage values of the different demographics within the GWAS data from Popejoy and Fullerton’s research. The newline function comes in handy to adjust the labels on the pie graph to fit alongside each other and within the window.

euro_noneuro <- c(81, 19)
labels1 <- c("European \nancestry", "Non-european \nancestry")

sum(euro_noneuro)
## [1] 100
pie(x = euro_noneuro,
    labels = labels1,
    main = "2009")

euro_asian_other <- c(81, 14, 5)
labels2 <- c("European \nancestry", "Asian ancestry", "Other non-\nEuropean ancestry")

sum(euro_asian_other)
## [1] 100
pie(x = euro_asian_other,
    labels = labels2,
    main = "2016")

Pie graphs

The init.angle argument adjusts the orientation of the pie graph so that the first minority section has its line placed at the angle specified. The radius argument changes the size of each pie graph and the col argument changes the colors of the corresponding sections. Par (graph parameter) is used to create a matrix of pie graphs and the mar function adjusts the margins.

# set up par()
par(mfrow = c(1,2), 
    mar = c(2,3,1,5))

#pie graphs 1
# add main, init.angle, radius, and col
pie(x = euro_noneuro,
    labels = labels1,
    main = "2009",
    init.angle = 180,
    radius = 1,
    col = c(9,5,7))

# pie graph 2
# add main, init.angle, radius, and col
pie(x = euro_asian_other,
    labels = labels2,
    main = "2016",
    init.angle = 180,
    radius = 1,
    col = c(4,6,8))

Bar graphs

# data
dat2016 <- c(14, 3,1,0.54,0.28,0.08,0.05)
dat2016_rev <- rev(dat2016)
barplotdata2016 <- matrix(c(dat2016_rev))

# labels
labels_x <- rev(c("Asian","African","Mixed", "Hispanic &\nLatin American",
                        "Pacific Islander","Arab & Middle East","Native peoples"))

par(mfrow = c(1,1))

barplot(barplotdata2016,
        width = 0.01, 
        xlim = c(0,0.1),
         axes = F,
        col = c(1,2,3,4,5,6,7),
        legend.text = labels_x)