plinkPhewasExport: Export a table for PheWAS analysis in plink

View source: R/plinkPhewasExport.R

plinkPhewasExportR Documentation

Export a table for PheWAS analysis in plink

Description

This function will export a table created by createPhewasTable as a secondary phenotype file for use in plink.

Usage

plinkPhewasExport(phenotypes, file="plink.pheno", translateIDs=TRUE) 

Arguments

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.

Details

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).

Author(s)

Robert Carroll

See Also

createPhewasTable

Examples


#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")


PheWAS/PheWAS documentation built on July 3, 2023, 3:40 p.m.