Answer: Rscript match

There are many ways to go about this. Here’s something I wrote up quick and dirty. I separated out mashr into two new data-frames based upon their columns.

#install.packages(“tidyverse”)
library(tidyverse)

mashr_one <- tibble(CHROM_POS = mashr$RSID1,
Group = "RSID1")

mashr_two <- tibble(CHROM_POS = mashr$RSID2_,
Group = "RSID2")

result <- full_join(vcf, mashr_one)
result2 <- full_join(vcf, mashr_two)
bind_rows(result, result2)

Read more here: Source link