write.snps: Write genotype matrices to file, AlphaImpute style.

Description Usage Arguments Details Value See Also

View source: R/auxil.R

Description

write.snps is short hand for write.table with some default options. For AlphaImpute format see Siccuracy.

Writes genotypes in VCF class objects to files in AlphaImpute-format.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
write.snps(x, file, row.names = TRUE, na = "9", ...)

## S3 method for class 'matrix'
write.snps(x, file, row.names = TRUE, na = "9", ...)

## S3 method for class 'oxford'
write.snps(x, file, row.names = TRUE, na = "9", ...)

## S3 method for class 'haps'
write.snps(x, file, row.names = TRUE, na = "9", newID = 0,
  ...)

## S3 method for class 'vcfR'
write.snps(x, file, row.names = TRUE, na = "9", newID = 0,
  element = "GT", as.numeric = TRUE, convertNA = TRUE, ...)

Arguments

x

The matrix to write.

file

Filename or connection to write to.

row.names

If genotype matrix is "raw" and has first column with animals IDs, set this to FALSE.

na

The string to use for NA in the data.

...

Passed on to write.table.

newID

... New ID, see convert_plinkA, but with some caveats here. I don't know.

element

element to extract from vcf genotype, see extract.gt.

as.numeric

logical, should the matrix be converted to numerics.

convertNA

logical indicating whether to convert "." to NA (see na for which value to use when writing to text file).

Details

The new integer IDs can be supplied. If not, they will be made for you. newID may be an integer vector and will be used as is. If data.frame with columns sampID and newID, they will be reordered to match input file.

Value

Returns data frame with ID mapping, truncated to those elements outputted.

See Also

write.table, connections.

write.snps


stefanedwards/Siccuracy documentation built on Dec. 14, 2017, 7:41 p.m.