write.vcf: Prepare genotypic data in vcf-Format

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/read.write.vcf.r

Description

Create vcf-file for miscellaneous applications. Within the package it is used to write files for beagle usage.

Usage

1
write.vcf(gp, file, unphased=TRUE)

Arguments

gp

gpData object with elements geno and map

file

character. Filename for writing the file.

unphased

logical. The default is TRUE. Than the seperator between the alleles is "/", and the possible codings are "0/0" for 0 in the genotype matrix, "0/1" for 1 and "1/1" for 2. For getting a phased output, use unphased=FALSE. Than the seperator is "|". For hetercygous genotypes you have to change the 1 to -1 if you like to get the coding "1|0", So posible codings in this case are "0|0" for 0 in the genotype matrix, "0|1" for 1, "1|0" for -1 and "1|1" for 2.

Details

The function writes a vcf-file. The format of the output is "GT". Other formats are not supported.

Value

No value is returned. Function creates files [prefix]ingput.bgl with genotypic data in Beagle input format and [prefix]marker.txt with marker information used by Beagle.

Author(s)

Hans-Juergen Auinger

See Also

read.vcf2matrix, read.vcf2list, codeGeno

Examples

1
2
3
4
5
6
7
8
map <- data.frame(chr=c(1,1,1,1,1,2,2,2,2),pos=1:9)
geno <-  matrix(sample(c(0,1,2,NA),size=10*9,replace=TRUE),nrow=10,ncol=9)
colnames(geno) <- rownames(map) <- paste("SNP",1:9,sep="")
rownames(geno) <- paste("ID",1:10+100,sep="")

gp <- create.gpData(geno=geno,map=map)
gp1 <- discard.markers(gp,rownames(map[map$chr!=1,]))
## Not run: write.vcf(gp1, file="test.vcf")

Example output

sh: 1: cannot create /dev/null: Permission denied

synbreed documentation built on March 19, 2018, 3 p.m.