Learn R Programming

pbatR (version 2.1.1)

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 data.frame structure, and is almost identical to the data.frame object described to create it, only with some special reserved names.

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

The `pped' functions provide support for a more compressed form of input, that can be read in faster, and so may be faster when running in clustered mode.

Usage

as.ped( x,
        pid="pid", id="id", idfath="idfath",
        idmoth="idmoth", sex="sex", affection="AffectionStatus",
        clearSym=FALSE )

as.pedlist( x, pid="pid", id="id", idfath="idfath", idmoth="idmoth", sex="sex", affection="AffectionStatus", clearSym=FALSE )

is.ped( obj, pure.ped=FALSE )

is.pedlist( obj )

read.ped( filename, format="ped", lowercase=TRUE, sym=TRUE, max=100, ... ) fread.ped( filename, ... )

write.ped( file, ped )

is.pped( obj )

read.pped( filename, max=100 )

as.pped( ped, ppedname="" )

## S3 method for class 'ped': sort(x,decreasing=FALSE,...)

plotPed( ped, sink=NULL )

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

pid
String corresponding to column name for pedigree id.
id
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 (and sym is FALSE), enforces all headers to lowercase for convenience.
...
Options for read.table, used only when sym is FALSE. Do not put in header=TRUE, as this will cause an error, as the header is automatically loaded.

With the proper fil

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
sym
When TRUE, only the header of the file is read in; only PBAT will load in the file. When FALSE, the entire file will be read in, and can be modified before using with PBAT.
max
When sym is TRUE, the amount of headers to read in before going pure symbolic (so that the SNP usage consistency will not be assessed by pbatR, only by PBAT).
clearSym
When TRUE, if a symbolic file is found, it will be read in; otherwise, it will stay symbolic.
pure.ped
When FALSE, tests if an object is a `ped' or `pped'. When TRUE, tests only if the object is a `ped'.
ppedname
Name of the `pped' file. If a symbolic ped, it defaults to that name except with a pped extension; otherwise, it defaults to `pped.pped'.
decreasing
Whether to sort in decreasing/increasing order.
sink
For `plot.ped', this is the name of a pdf file to output all of the plots to (there will be one plot per page).

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.

`plot.ped' attempts to make use of the `kinship' package to draw the pedigrees. In my personal experience, this package cannot handle all pedigrees. My preferred alternative would be to use Madeline, which makes beautiful pictures (amongst other things): http://eyegene.ophthy.med.umich.edu/

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( pid       = c(1,1,1,1,1),
                 id        = 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),
                 AffectionStatus = c(1,0,0,1,0),
                 m1.a      = c(1,1,1,1,1),
                 m1.b      = c(1,2,1,1,2),
                 m2.a      = c(4,4,4,4,4),
                 m2.b      = c(3,3,3,4,3) )
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, pid="mypedid", id="subid", idfath="fathid",
                 idmoth="mothid", sex="gender", affection="affection" )
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