| ped {pbatR} | R Documentation |
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.
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 )
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 is of class data.frame, the columns have entries
that match the string parameters idped,...,censor;
genetic markers consist of subsequent columns
formated as follows: e.g. marker `p5' would need
two columns known as `p5.a' `p5.b' (or really
just where the characters a and b are different).
When x is of class list, the
entries still include idped,...,censor as discussed
previously, and genetic markers consist of a list object of two
vectors for each unphased haplotype.
|
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 not be used. |
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 |
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.
http://www.biostat.harvard.edu/~clange/default.htm
http://www.people.fas.harvard.edu/~tjhoffm/pbatR.html
read.ped,
write.ped,
as.pedlist
# 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.