Learn R Programming

optiSel (version 2.0.9)

read.indiv: Reads Individual IDs from a Genotype File

Description

Reads individual IDs from a genotype file.

Usage

read.indiv(file, skip=NA, cskip=NA)

Value

Vector with the IDs of the individuals.

Arguments

file

Name of the genotype file.

skip

Take line skip+1 of the genotype files as the row with column names. By default, the number is determined automatically.

cskip

Take column cskip+1 of the genotype files as the first column with genotypes. By default, the number is determined automatically.

Author

Robin Wellmann

Details

Reading individual IDs from phased marker files.

Marker file format: Each marker file containing phased genotypes has a header and no row names. Cells are separated by blank spaces. The number of rows is equal to the number of markers from the respective chromosome and the markers are in the same order as in the map. The first cskip columns are ignored. The remaining columns contain genotypes of individuals written as two alleles separated by a character, e.g. A/B, 0/1, A|B, A B, or 0 1. The same two symbols must be used for all markers. Column names are the IDs of the individuals. If the blank space is used as separator then the ID of each individual should repeated in the header to get a regular delimited file. The columns to be skipped and the individual IDs must have no white spaces. The name of each file must contain the chromosome name as specified in the map in the form "ChrNAME.", e.g. "Breed2.Chr1.phased".

Examples

Run this code
data(Cattle)

dir   <- system.file("extdata", package = "optiSel")
file  <- file.path(dir, "Chr1.phased")
ID    <- read.indiv(file)

identical(Cattle$Indiv, ID)
#[1] TRUE


Run the code above in your browser using DataLab