Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Clear and set up workspace
- rm(list = ls())
- library(tidyverse)
- # set your working directory as appropriate for your computer
- #setwd("XXXXXXXXXXXXXXXXXXXXXX")
- # ###
- # # generate an example list of SNPs for the demonstration
- # ###
- # # read in the tutorial data
- # fullMap <- read_tsv("mdp_genotype.plk.map", col_names = F)
- # # generate list of SNPs
- # nExample <- 50
- # fullMap[sample(1:nrow(fullMap), nExample),2] %>%
- # write_tsv("exampleSnpList.txt", col_names = F)
- ###
- # prepare a bed file from a SNP name list
- ###
- # read in the file with SNP names
- snpList <- read_table("exampleSnpList.txt", col_names = F) %>%
- rename(snpName = X1)
- # read in the map file with SNP positions (full info)
- fullMap <- read_tsv("mdp_genotype.plk.map", col_names = F) %>%
- rename(chromosome = X1, snpName = X2, morgan = X3, position = X4)
- # write out a chromosome + position file to be loaded in TASSEL
- tmp <- inner_join(snpList, fullMap) %>%
- select(chromosome, position) %>%
- write_tsv(., "SnpName2ChrPosition_TASSEL.txt", col_names = F)
Advertisement
RAW Paste Data
Copied
Advertisement