Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##########################
- #update SNP chip map data
- ##########################
- # Clear workspace
- rm(list = ls())
- # Set working directory
- setwd("d:/analysis/2020_GenomicsBootCamp_Demo/")
- #load packages
- library(tidyverse)
- # #prepare ped+map
- # system("plink --bfile ADAPTmap_genotypeTOP_20160222_full --chr-set 29 --keep-fam breed1.txt --recode --out testData_full")
- #
- # # prepare the "faulty" map file
- # read_delim("testData_full.map",delim = "\t", col_names = F) %>%
- # mutate(X1=1, X4=row_number()) %>%
- # write_delim("testData_faulty.map", quote=F, col_names = F)
- #
- # # the ped file testData_faulty.ped for this example is just a renamed copy of testData_full.ped
- ##################################################################
- # MAP file update - method 1 - from pre-prepared conversion file
- ##################################################################
- # prepare file for update from a map file
- read_delim("testData_full.map",delim = "\t", col_names = F) %>%
- dplyr::select(X2, X1) %>%
- write_delim("chrUpdate.txt", quote=F, col_names = F)
- # run PLINK update
- system("plink --file testData_faulty --chr-set 29 --update-chr chrUpdate.txt --make-bed --out testData_chrUpdated")
- ##################################################################
- # MAP file update - method 2 - update from an existing map file
- ##################################################################
- # run PLINK update - chromosomes
- system("plink --file testData_faulty --chr-set 29 --update-chr testData_full.map 1 2 --make-bed --out testData_chrUpdatedV2")
- # run PLINK update - chromosomes + positions together
- system("plink --file testData_faulty --chr-set 29 --update-chr testData_full.map 1 2 --update-map testData_full.map 4 2 --make-bed --out testData_chrUpdatedV3")
Advertisement
Add Comment
Please, Sign In to add comment