convert_phases: Convert phase files to genotype files.

Description Usage Arguments Details Value

Description

Simply sums every pair of rows together.

Usage

1
2
convert_phases(fn, outfn, ncol = NULL, nlines = NULL, na = 9,
  int = TRUE, format = NULL)

Arguments

fn

Filename of input file, every two rows are for same animal.

outfn

Filename of intended output.

ncol

Integer, number of SNP columns in files. When NULL, automagically detected with get_ncols(phasefn)-1.

nlines

Integer, maximum number of pairs of lines to convert.

na

Missing value.

int

Logical (default TRUE), read and write integers.

format

Character, Fortran edit descriptors for output. See parseformat.

Details

A phase file has format similar to SNP files, expect the genotype on each allele are listed on two pairs of rows. Each individual has therefore two rows, one for each allele, see following example:

Genotype file:

1003 0 1 1 2 0
1004 1 1 0 1 0

Phase file:

1003 0 0 1 1 0
1003 0 1 0 1 0
1004 0 1 0 0 0
1004 1 0 0 1 0

By default assumes genotypes are whole integers (cf. int argument). If numeric values are required, e.g. gene dosages from imputation, use int=FALSE. Use format to change from default 5 characters width and 2 decimals ("5.2"). NB! Function does not test for validity of this argument, so change with caution!

Missing values: Values after summing less than 0 or greater than 2 are assumed as missing and replaced with na.

Value

Number of rows written.


stefanedwards/Siccuracy documentation built on May 30, 2019, 10:44 a.m.