Advertisement
GenomicsBootCamp

Allele frequency - compare groups --within

Jun 22nd, 2021
389
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Allele frequency comparisons with PLINK
  2. # Comparisons between multiple groups using --within
  3.  
  4. # Clear workspace
  5. rm(list = ls())
  6. # Set working directory
  7. setwd("d:/analysis/2020_GenomicsBootCamp_Demo/")
  8. library(tidyverse)
  9.  
  10. # Read in the data - ADAPTmap
  11. goats <- read_tsv("ADAPTmap_genotypeTOP_20160222_full.fam", col_names = F)
  12.  
  13. # select goats from target countries and apply country label
  14. countryLabels <- goats %>%
  15.   mutate(country = case_when(
  16.     substr(X2,1,2) == "ET" ~ "Ethiopia",
  17.     substr(X2,1,2) == "IT" ~ "Italy",
  18.     substr(X2,1,2) == "PK" ~ "Pakistan"
  19.   )) %>%
  20.   drop_na() %>%
  21.   select(X1, X2, country) %>%
  22.   write_delim("countryComparisonSnpFreq.txt")
  23.  
  24.  
  25. # Keep only these animals for a PLINK run and perform alle frequency analysis
  26. system(str_c("plink --bfile ADAPTmap_genotypeTOP_20160222_full --chr-set 29 --autosome ",
  27.               "--keep countryComparisonSnpFreq.txt --nonfounders ",
  28.               "--freq --within countryComparisonSnpFreq.txt ",
  29.               "--out countrySnpFrequencies"))
  30.  
Advertisement
RAW Paste Data Copied
Advertisement