Advertisement
GenomicsBootCamp

updatePhenotypes

Nov 23rd, 2021
899
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
R 1.55 KB | None | 0 0
  1. # change/update phenotypes in PLINK files
  2. # See the video tutorial on the Genomics Boot Camp YouTube channel
  3.  
  4. # Clear workspace
  5. rm(list = ls())
  6. # Set working directory
  7. setwd("XXXXXXXXXXXXXXXXXXXXXXXXXX")
  8.  
  9. # update phenotype column - single phenotype in file
  10. system("plink --file testData --pheno heightData.txt --recode --out phenoUpdated")
  11.  
  12. # update phenotype column - select a specific one from a list
  13. system("plink --file testData --pheno PhenotypeMeasures.txt --mpheno 2 --recode --out phenoUpdated_weight_v1")
  14.  
  15. system("plink --file testData --pheno PhenotypeMeasures.txt --pheno-name weight --recode --out phenoUpdated_weight_v2")
  16.  
  17.  
  18. # separate PLINK files for all phenotypes
  19. # ATTENTION!!! Might take a lot of HDD space - ped+map file for each phenotype
  20.  
  21. nrMeasures <- 3 # this is how many phenotype measurements you have in the PhenotypeMeasures.txt file
  22. for (i in 1:nrMeasures) {
  23.   system(
  24.     paste0("plink --file testData --pheno PhenotypeMeasures.txt --mpheno ", i,
  25.            " --recode --out phenoUpdated_trait",i))
  26. }
  27.  
  28.  
  29. # separate PLINK files for all phenotypes - named pheotypes
  30. # ATTENTION!!! Might take a lot of HDD space - ped+map file for each phenotype
  31. nrMeasures <- c("height", "weight", "shoeSize") # this is how many phenotype measurements you have in the PhenotypeMeasures.txt file
  32.  
  33. for (i in 1:length(nrMeasures)) {
  34.   system(
  35.     paste0("plink --file testData --pheno PhenotypeMeasures.txt --pheno-name ", nrMeasures[i],
  36.            " --recode --out phenoUpdated_trait_",nrMeasures[i]))
  37.  
  38.   #GWAS
  39.  
  40.   #visualization
  41.  
  42. }
  43.  
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement