writeStandardOutput: Write simulated data into formats used by standard GWAS...

Description Usage Arguments External formats See Also Examples

View source: R/outputFunctions.R

Description

writeStandardOutput can write genotypes and phenotypes as well as possible covariates and kinship matrices into a number of formats for standard GWAS software: plink, snptest, bimbam, gemma, limmbo. For more information on the different file formats see External formats.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
writeStandardOutput(
  directory,
  phenotypes = NULL,
  genotypes = NULL,
  additionalPhenotypes = NULL,
  covariates = NULL,
  kinship = NULL,
  eval_kinship = NULL,
  evec_kinship = NULL,
  id_samples,
  id_snps,
  id_phenos,
  outstring = NULL,
  standardInput_samples = NULL,
  standardInput_genotypes = NULL,
  format = NULL,
  intercept_gemma = FALSE,
  nameAdditional = "_nonLinear",
  verbose = TRUE
)

Arguments

directory

Absolute path (no tilde expansion) to parent directory [string] where the data should be saved [needs user writing permission]

phenotypes

[NrSamples x NrTrait] Data.frame/matrix of phenotypes [doubles].

genotypes

[NrSamples x NrSNP] Data.frame/matrix of genotypes [integers]/[doubles].

additionalPhenotypes

[NrSamples x NrTrait] Data.frame/matrix of additional phenotypes (for instance non-linearly tranformed orginal

covariates

[NrSamples x NrCovariates] Data.frame/matrix of covariates [integers]/[doubles].

kinship

[NrSamples x NrSamples] Data.frame/matrix of kinship estimates [doubles].

eval_kinship

[NrSamples] vector with eigenvalues of kinship matrix [doubles].

evec_kinship

[NrSamples x NrSamples] Data.frame/matrix with eigenvectors of kinship matrix [doubles].

id_samples

Vector of [NrSamples] sample IDs [string] of simulated phenotypes, genotypes and covariates.

id_snps

Vector of [NrSNPs] SNP IDs [string] of (simulated) genotypes.

id_phenos

Vector of [NrTraits] phenotype IDs [string] of simulated phenotypes.

outstring

(optional) Name [string] of subdirectory (in relation to directory) to save set-up independent simulation results.

standardInput_samples

(optional) Data.frame of sample information obtained when genotypes were read from plink, oxgen or genome file.

standardInput_genotypes

(optional) Data.frame of genotypes obtained when reading genotypes from plink, oxgen, or genome file.

format

Vector of name(s) [string] of file formats, options are: "plink", "snptest", "gemma", "bimbam", "delim". For details on the file formats see External formats.

intercept_gemma

[boolean] When modeling an intercept term in gemma, a column of 1's have to be appended to the covariate files. Set intercept_gemma to TRUE to include a column of 1's in the output.

nameAdditional

name [string] of additonal phenotypes to be appended to filename.

verbose

[boolean]; If TRUE, progress info is printed to standard out

External formats

See Also

readStandardGenotypes

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
simulation <- runSimulation(N=10, P=2, genVar=0.4, h2s=0.2, phi=1)
genotypes <- simulation$rawComponents$genotypes
kinship <-  simulation$rawComponents$kinship
phenotypes <- simulation$phenoComponents$Y

## Not run: 
# Save in plink format (.bed, .bim, .fam, Y_sim_plink.txt)
writeStandardOutput(directory=tempdir(), 
genotypes=genotypes$genotypes, phenotypes=phenotypes, 
id_samples = genotypes$id_samples, id_snps = genotypes$id_snps, 
id_phenos = colnames(phenotypes), format="plink")

# Save in gemma and snptest format
writeStandardOutput(directory=tempdir(), 
genotypes=genotypes$genotypes, phenotypes=phenotypes, 
id_samples = genotypes$id_samples, id_snps = genotypes$id_snps, 
id_phenos = colnames(phenotypes), kinship=kinship, 
format=c("snptest", "gemma"))

## End(Not run)

Example output

Save genotypes in PLINK format
Writing FAM file to /work/tmp/tmp/RtmpFJ58tZ/Genotypes.fam 
Writing extended MAP file to /work/tmp/tmp/RtmpFJ58tZ/Genotypes.bim 
Writing BED file to /work/tmp/tmp/RtmpFJ58tZ/Genotypes.bed (SNP-major mode)
Save genotypes in GEMMA format
Save kinship in GEMMA format
Save genotypes in SNPTEST format
SNPTEST format does not support a kinship, supplied  kinship ignored

PhenotypeSimulator documentation built on July 16, 2021, 5:06 p.m.