work.dir = "~/Downloads/tempo/"
knitr::opts_knit$set(root.dir = normalizePath(work.dir))
library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.1 ──
## ✓ ggplot2 3.3.5 ✓ purrr 0.3.4
## ✓ tibble 3.1.6 ✓ dplyr 1.0.7
## ✓ tidyr 1.1.4 ✓ stringr 1.4.0
## ✓ readr 2.1.0 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
## qqunif function
source("https://gist.githubusercontent.com/hakyim/38431b74c6c0bf90c12f/raw/21fbae9a48dc475f42fa60f0ef5509d071dea873/qqunif")
Download plink for mac
## Download plink from https://www.cog-genomics.org
curl -O https://s3.amazonaws.com/plink1-assets/plink_mac_20210606.zip
mkdir plink_folder
cd plink_folder
unzip plink_mac_20210606.zip
cd ..
Download HapMap data
## Download plink format hapmap 3 genotype data
## consider using the automated pipeline by Yanyu https://github.com/liangyy/misc-tools/tree/master/hapmap3_snps
## which links to https://ftp.ncbi.nlm.nih.gov/hapmap/genotypes/hapmap3_r3/plink_format/
wget https://ftp.ncbi.nlm.nih.gov/hapmap/genotypes/hapmap3_r3/plink_format/hapmap3_r3_b36_fwd.consensus.qc.poly.map.gz
wget https://ftp.ncbi.nlm.nih.gov/hapmap/genotypes/hapmap3_r3/plink_format/hapmap3_r3_b36_fwd.consensus.qc.poly.ped.gz
## get reported population data
wget ftp://ftp.ncbi.nlm.nih.gov/hapmap/phase_3/relationships_w_pops_051208.txt\n
gunzip *.gz
## convert to plink bed files
plink_folder/plink --file hapmap3_r3_b36_fwd.consensus.qc.poly --make-bed --out hapmap
## subset chromosome 22
plink_folder/plink --bfile hapmap3 --make-bed --chr 22 --out hapmap3_ch22
Info
Plink files now in this link