Learn R Programming

pbatR (version 2.1.1)

cped: Phenotype Object

Description

Creates, tests, reads, or writes an object of class cped.

Usage

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

is.cped( obj )

read.cped( filename, lowercase=TRUE, sym=TRUE, max=100, ... ) fread.cped( filename, ... )

write.cped( file, cped )

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

plotCPed( cped, sink=NULL )

Arguments

x
An object of class cped or data.frame as described below.

If x is of class cped, no other options are used.

When x is of class data.frame, the columns have entries

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.
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
cped
an object of class cped
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.
decreasing
Whether to sort in decreasing/increasing order.
sink
For `plot.cped', 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.cped, a `.cped' file should have the following format. The first line should indicate the names of the copy number 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 (just as in the standard pedigree file!). After this information, for each marker, both marker alleles for each copy number intensity are listed. The order corresponds to the order of the copy number markres in the first line of the file.

must be encoded with a `0', unlike the phenotype file.

`plotCPed' is a hack transforming the data to the `plotPed' routine.

References

http://www.biostat.harvard.edu/~clange/default.htm

http://www.people.fas.harvard.edu/~tjhoffm/pbatR.html

See Also

read.ped, read.cped write.cped, plotCPed ]

Examples

Run this code
# A highly artificial example with not enough subjects to be run;
#  however, it demonstrates how to put data in it.
set.seed(13)
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),
                 c.1.a     = runif(5),
                 c.1.b     = runif(5),
                 c.2.a     = runif(5),
                 c.2.b     = runif(5),
                 c.3.a     = runif(5),
                 c.3.b     = runif(5) )
x
myCPed <- as.cped( x ) # Mark it with the class 'ped'
myCPed

Run the code above in your browser using DataLab