readStandardGenotypes: Read genotypes from file.

Description Usage Arguments Details Value External genotype software and formats Examples

View source: R/genotypeFunctions.R

Description

readStandardGenotypes can read genotypes from a number of input formats for standard GWAS (binary plink, snptest, bimbam, gemma) or simulation software (binary plink, hapgen2, genome). Alternatively, simple text files (with specified delimiter) can be read. For more information on the different file formats see External genotype software and formats.

Usage

1
2
3
4
5
6
7
8
9
readStandardGenotypes(
  N,
  filename,
  format = NULL,
  verbose = TRUE,
  sampleID = "ID_",
  snpID = "SNP_",
  delimiter = ","
)

Arguments

N

Number [integer] of samples to simulate.

filename

path/to/genotypefile [string] in plink, oxgen (impute2/snptest/hapgen2), genome, bimbam or [delimiter]-delimited format ( for format information see External genotype software and formats).

format

Name [string] of genotype file format. Options are: "plink", "oxgen", "genome", "bimbam" or "delim".

verbose

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

sampleID

Prefix [string] for naming samples (will be followed by sample number from 1 to N when constructing id_samples).

snpID

Prefix [string] for naming SNPs (will be followed by SNP number from 1 to NrSNP when constructing id_snps).

delimiter

Field separator [string] of genotype file when format == "delim".

Details

The file formats and software formates supported are described below. For large external genotypes, consider the option to only read randomly selected, causal SNPs into memory via getCausalSNPs.

Value

Named list of [NrSamples X NrSNPs] genotypes (genotypes), their [NrSNPs] SNP IDs (id_snps), their [NrSamples] sample IDs (id_samples) and format-specific additional files (such as format-specific genotypes encoding or sample information; might be used for output writing).

External genotype software and formats

Formats:

Genotype simulation characteristics:

Examples on how to call these genotype simulation tools can be found in the vignette sample-scripts-external-genotype-simulation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# Genome format
filename_genome  <- system.file("extdata/genotypes/genome/",
"genotypes_genome.txt",
package = "PhenotypeSimulator")
data_genome <- readStandardGenotypes(N=100, filename_genome, format ="genome")

filename_hapgen  <- system.file("extdata/genotypes/hapgen/",
"genotypes_hapgen.controls.gen",
package = "PhenotypeSimulator")
filename_hapgen <- gsub("\\.gen", "", filename_hapgen)
data_hapgen <- readStandardGenotypes(N=100, filename_hapgen, format='oxgen')

filename_plink  <- system.file("extdata/genotypes/plink/",
"genotypes_plink.bed",
package = "PhenotypeSimulator")
filename_plink <- gsub("\\.bed", "", filename_plink)
data_plink <- readStandardGenotypes(N=100, filename=filename_plink,
format="plink")

filename_delim  <- system.file("extdata/genotypes/",
"genotypes_chr22.csv",
package = "PhenotypeSimulator")
data_delim <- readStandardGenotypes(N=50, filename=filename_delim,
format="delim")

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