Learn R Programming

pbatR (version 0.7)

ped: Pedigree Object

Description

Creates, tests, reads, or writes objects of type ped or pedlist to be used with the pbat commands.

The ped class inherits the list structure, and is almost identical to the list object described to create it, only with some special reserved names.

The pedlist class inherits the data.frame structure, and is almost identical to the data.frame object described to create it, only with some special reserved names.

Usage

as.ped( x,
        idped="idped", idsub="idsub", idfath="idfath",
        idmoth="idmoth", sex="sex", affection="affection" )

as.pedlist( x, idped="idped", idsub="idsub", idfath="idfath", idmoth="idmoth", sex="sex", affection="affection" )

is.ped( obj );

is.pedlist( obj );

read.ped( filename, format="ped", lowercase=TRUE, ... )

write.ped( file, ped )

Arguments

x
An object of class ped, pedlist, data.frame, or list as described below.

If x is of class ped or pedlist, no other options are used. When x<

idped
String corresponding to column name for pedigree id.
idsub
String corresponding to column name for subject id.
idfath
String corresponding to column name for father id.
idmoth
String corresponding to column name for mother id.
sex
String corresponding to column name for sex.
affection
String corresponding to column name for affection status.
filename
Filename to open; does not need .phe extension.
format
Toggles the return structure, set to "ped" or "pedlist".
lowercase
When TRUE, enforces all headers to lowercase for convenience.
...
Options for read.table. Do not put in header=TRUE, as this will cause an error, as the header is automatically loaded. With the proper file formatting, this should
file
string representing filename, or a connection for file output
ped
an object of class ped or pedlist (see as.ped or as.pedlist)
obj
an object

Details

When reading in a file on disk using read.ped, a `.ped' file should have the following format (taken from the PBAT web-page). The first line of the PBAT pedigree file contains the names of the markers. Each subsequent line stands for one individual/subject, starting with the pedigree id, followed by the individual/subject id, the id of the father, the id of the mother, the individual's sex and affection status. After this information, for each marker, both marker alleles are listed. The order of the markers has to correspond to the order of the marker names in the first line of the file. Missing values here must be encoded with a `0', unlike the phenotype file. Examples of this type of file can be found on the PBAT webpage.

The usage of as.ped and as.pedlist should also follow the same missingness convention.

References

http://www.biostat.harvard.edu/~clange/default.htm http://www.people.fas.harvard.edu/~tjhoffm/pbatR.html

See Also

read.ped, write.ped, as.pedlist

Examples

Run this code
# A highly artificial example with not enough subjects to be run;
#  however, it demonstrates how to put data in it.
x <- data.frame( idped =     c(1,1,1,1,1),
                 idsub =     c(1,2,3,4,5),
                 idfath =    c(4,4,4,0,0),
                 idmoth =    c(5,5,5,0,0),
                 sex =       c(1,2,1,1,2),
                 affection = c(1,0,0,1,0),
                 m1.a =      c(1,1,4,4,4),
                 m1.b =      c(2,3,2,2,3),
                 m2.a =      c(4,4,4,4,4),
                 m2.b =      c(1,1,1,4,1) )
x
myPed <- as.ped( x )          # Mark it with the class 'ped'
myPedlist <- as.pedlist( x )  # Instead mark it with 'pedlist'
myPed
myPedlist

# an alternate example of creating
names( x )[1:6] <- c( "mypedid", "subid", "fathid",
                      "mothid", "gender", "affection" );
x
myPed <- as.ped( x, idped="mypedid", idsub="subid", idfath="fathid",
                 idmoth="mothid", sex="gender" ) # affection need not be
                                                 #  specified here
myPed  # Note it's the same as before!

myPed <- as.ped( myPedlist )       # Easy conversion back
myPedlist <- as.pedlist( myPed )   #  and forth between formats.

Run the code above in your browser using DataLab