View source: R/genotypeInfoUpdate.R
updateGroupIdAndSex | R Documentation |
Replace group and gender information in the PLINK binary files by using the information from the metadata file.
updateGroupIdAndSex(plink, inputPrefix, metaDataFile, outputPrefix)
plink |
an executable program in either the current working directory or somewhere in the command path. |
inputPrefix |
the prefix of the input PLINK binary files. |
metaDataFile |
a pure text file that stores the meta information of the samples. This file must contain at least the following content (column names are in parentheses): family ID in the PLINK files (FID), individual ID in the PLINK files (IID), ID in the description files (descID), self identified ancestry (ance; e.g. AFR: African, AMR: Ad Mixed American, EAS: East Asian, EUR: European, SAS: South Asian), sex (sex; 1 = male, 2 = female), age (age), group (group; 0 = control/unaffected, 1 = case/affected). All unknown and missing values are represented by the value NA. Lines with a missing value for FID or IID are not contained. |
outputPrefix |
the prefix of the output PLINK binary files. |
Find the shared sample IDs between PLINK input files and metadata file. Use the information from the metadata file as the reference and update the group information/the outcome in the PLINK file. Group label should be 1 and 2. (1=unaff, 2=aff, 0=miss); missing phenotype will be indicated as -9.
The output PLINK binary files after updating the gender and grouping information.
Junfang Chen
## In the current working directory bedFile <- system.file("extdata", "controlData.bed", package="Gimpute") bimFile <- system.file("extdata", "controlData.bim", package="Gimpute") famFile <- system.file("extdata", "controlData.fam", package="Gimpute") metaDataFile <- system.file("extdata", "1_01_metaData.txt", package="Gimpute") system(paste0("scp ", bedFile, bimFile, famFile, " .")) inputPrefix <- "controlData" ## Specify the input PLINK file prefix outputPrefix <- "1_03_replacedGroupAndSex" ## Not run: Requires an executable program PLINK, e.g. ## plink <- "/home/tools/plink" ## updateGroupIdAndSex(plink, inputPrefix, metaDataFile, outputPrefix)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.