Introduction

Write a brief introduction about the data being plotted, including the information

The pie charts in this workflow are recreations of the pie charts in Popejoy and Fullerton’s paper “Genomics is Failing on Diversity”. The paper outlines the lack of representation within genome-wide association studies (GWAS). The paper showed how the majority of representation in GWAS studies are of European descent. The study was conducted in 2009 and again in 2016 showcasing the lack of representation in GWAS studies. In the 2016 study, it was shown that the percentage of Asian representation as well as non-European representation in general had risen since 2009. ## Create data

This code chunk creates the vectors containing data from the 2008 and 2016 GWAS studies. The data is inputted as percentages of representation for European, Asian, and other Non-European demographics in both the 2009 and 2016 GWAS.

GWAS2009 <- c(96,3,1)
GWAS2016 <- c(81,14,5)
labels_representation <- c("European","Asian","Other")

Pie graphs

The first part of the code chunk sets up the parameters and data to be presented in pie charts. The second part of the code chunk actually creates the pie charts with the inputted data and with arguments given to determine pie chart radius, starting angle location, and chart titles.

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

#pie graphs 1
pie(GWAS2009, labels = labels_representation, main = "2009 GWAS", init.angle = -82, radius = 1, col = c(1,2,3))

# pie graph 2
# add main, init.angle, radius, and col
pie(GWAS2016, labels = labels_representation, main = "2016 GWAS", init.angle = -82, radius = 1, col = c(1,2,3))

Bar graphs

This code chunk portion showcases how to make stacked bar graphs with the GWAS study data for 2008 and 2016

# 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)