Learn R Programming

rJPSGCS (version 0.2-10)

write.pedfile: write a snp.matrix object to a LINKAGE pedigree file.

Description

Write a snp.matrix object to a LINKAGE pedigree file, with pedigree information followed by genotypes. This function can be used to write either post-MAKEPED or pre-MAKEPED pedigree file formats (see Details). In addition to standard pedigree file formats the function can optionally write transposed pedigree files, as required by FitGMLD.

Usage

write.pedfile(pedinf, snp.data, file, transpose=FALSE, sep=" ", eol="\n", na="0")

Arguments

pedinf

The pedigree information for the pedfile as a matrix or data frame. Altnerately, users may specify pedinf="unrelated" for unrelated subjects. See the Examples.

snp.data

A snp.matrix object containing the marker data.

file

File name for the output pedfile.

transpose

Should the pedigree file be transposed, as required by FitGMLD? Default is FALSE.

sep

Field separator (not currently used).

eol

The end-of-line character.

na

The missing data code in snp.data.

Value

A numeric vector comprised of the number of subjects and SNPs written to the pedigree file.

Warning

The function makes NO attempt to check the pedigree information for correctness. It is up to the user to specify valid pedigree information.

Details

JPSGCS pedigree files are in post-MAKEPED format (though much of this information is ignored):

Column 1: Pedigree number
Column 2: Individual ID number
Column 3: ID of father; 0=no father in pedigree
Column 4: ID of mother; 0=no mother in pedigree
Column 5: First offspring ID; ignored by JPSGCS
Column 6: Next paternal sibling ID; ignored by JPSGCS
Column 7: Next maternal sibling ID; ignored by JPSGCS
Column 8: Sex; 1=male, 2=female

The pre-MAKEPED format excludes columns 5 - 7.

See Also

read.pedfile, read.snps.pedfile

Examples

Run this code
# NOT RUN {
data(exdat)
sdat<-as(exdat$markers,"snp.matrix") #coerce to snp.matrix
#Write a post-MAKEPED pedigree file for unrelated subjects. 
pedinf<-matrix(
 c( 1, 1, 0, 0, 0, 0, 0, 1, 1,
    2, 1, 0, 0, 0, 0, 0, 1, 1,
    3, 1, 0, 0, 0, 0, 0, 1, 1,
    4, 1, 0, 0, 0, 0, 0, 1, 1,
    5, 1, 0, 0, 0, 0, 0, 1, 1),
 byrow=TRUE, ncol=9, nrow=5)
write.pedfile(pedinf,sdat,file="test.ped")
#clean up
unlink("test.ped")
# }

Run the code above in your browser using DataLab