read.geno: Read genotype data based on the file format

Description Usage Arguments Details Value Author(s) Examples

Description

Read genotype data.

Usage

1
2
3
read.geno(fname = NULL, verbose = getOption("verbose"), run = TRUE,
  cleanup = TRUE, ftype = c("ind.head", "plink", "snp.head"),
  plink.path = NULL, ...)

Arguments

fname

a string specifying the file to read genotype information from

verbose

when set show the commands that are to be called through system.

run

when set (default) execute the system calls.

cleanup

when set (default) remove intermediate files before returning.

ftype

genotype file format, it accepts three options:

"plink":

plink format (.bed, .bim, .fam or .map, .ped);

"ind.head":

columns are the indviduals and lines are SNPs;

"snp.head":

columns are SNPs and lines are indviduals.

For "plink", fgeno needs to be given without suffix and plink.path may need to be assigned by the user because plink will be run from within SimPhe. More detail see plink.path. For the other options, fgeno should be the full name (with suffix and path if necessary) of the genotype file. Of course, this does not apply if fgeno is provided as a data frame.

plink.path

path of plink executable. Only needed when the ftype is "plink". Default is NULL. The function will detect the plink path with system("where plink") for Windows users and system("which plink") for Linux and MacOS users. But there is no garantee that the commands work on all devices. If the path cannot be determined or the executable cannot be called from read.geno, then users have to try other formats.

...

not used.

Details

If it is plink file format (.bed, .bim, .fam), make sure that plink has already been installed in the system

Value

a dataframe of genotype data: columns are the SNPs; rows are indviduals.

Author(s)

Beibei Jiang beibei_jiang@psych.mpg.de and Benno Pütz puetz@psych.mpg.de

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## "snp.head" genotype file: rows are individuals and columns are SNPs
# get full path of example file
fgeno.path <- system.file("extdata", "10SNP.txt", package="SimPhe")

geno <- read.geno(fgeno.path, ftype = "snp.head")
head(geno)

## "plink" genotype file: 1).map and .ped; 2).bed, .fam and .bim
# get directory of plink example file
fpath <- strsplit(fgeno.path, "10SNP.txt")

#### Note: before run this example, specify your installation path of plink ####
# geno <- read.geno(paste0(fpath, "bdemo"), ftype = "plink", plink.path = "user's plink path")

Example output

     SNP01 SNP02 SNP03 SNP04 SNP05 SNP06 SNP07 SNP08 SNP09 SNP10
ind1     0     0     1     2     1     2     1     1     2     1
ind2     0     2     0     1     0     0     0     1     0     0
ind3     0     1     0     1     0     1     1     1     2     0
ind4     0     0     1     2     2     0     1     0     0     1
ind5     0     0     0     0     2     0     0     1     0     0
ind6     0     1     1     1     0     1     1     0     0     0

SimPhe documentation built on May 1, 2019, 9:10 p.m.