View source: R/plinkPhewasExport.R
plinkPhewasExport | R Documentation |
This function will export a table created by createPhewasTable as a secondary phenotype file for use in plink.
plinkPhewasExport(phenotypes, file="plink.pheno", translateIDs=TRUE)
phenotypes |
The phenotype file generated by createPhewasTable (or similar). |
file |
The path and filename for the phenotype file. |
translateIDs |
If true, the function will duplicate the first column (presumably the unique id) into two columns named FID and IID. The default (TRUE) will handle createPhewasTable input. FALSE requires columns named "FID" and "IID" to be present. |
Plink https://www.cog-genomics.org/plink2 is a commonly used genetics analysis tool heavily optimized for handling GWAS. This function will export a phenotype file as expected by plink which can be helpful for analysis.
The translateIDs
options allows users to supply their own FID/IID pairs in case they are not identical (common in sets with no family information).
Robert Carroll
createPhewasTable
#Generate some example data
ex=generateExample(hit="335")
#Extract the two parts from the returned list
id.icd9.count=ex$id.icd9.count
genotypes=ex$genotypes
#Create the PheWAS code table- translates the icd9s, adds exclusions, and reshapes to a wide format
phenotypes=createPhewasTable(id.icd9.count)
#Export the file for use in plink
plinkPhewasExport(phenotypes, file="my.example.pheno")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.