as.ped {pedtools} | R Documentation |
Conversions to ped objects
Description
Conversions to ped objects
Usage
as.ped(x, ...)
## S3 method for class 'data.frame'
as.ped(
x,
famid_col = NA,
id_col = NA,
fid_col = NA,
mid_col = NA,
sex_col = NA,
marker_col = NA,
locusAttributes = NULL,
missing = 0,
sep = NULL,
sexCodes = NULL,
addMissingFounders = FALSE,
validate = TRUE,
verbose = TRUE,
...
)
Arguments
x |
Any object. |
... |
Not used. |
famid_col |
Index of family ID column. If NA, the program looks for a column named "famid" (ignoring case). |
id_col |
Index of individual ID column. If NA, the program looks for a column named "id" (ignoring case). |
fid_col |
Index of father ID column. If NA, the program looks for a column named "fid" (ignoring case). |
mid_col |
Index of mother ID column. If NA, the program looks for a column named "mid" (ignoring case). |
sex_col |
Index of column with gender codes (0 = unknown; 1 = male; 2 = female). If NA, the program looks for a column named "sex" (ignoring case). If this is not found, genders of parents are deduced from the data, leaving the remaining as unknown. |
marker_col |
Index vector indicating columns with marker alleles. If NA,
all columns to the right of all pedigree columns are used. If |
locusAttributes |
Passed on to |
missing |
Passed on to |
sep |
Passed on to |
sexCodes |
A list with optional entries "male", "female" and "unknown",
indicating how non-default entries in the |
addMissingFounders |
A logical. If TRUE, any parent not included in the
|
validate |
A logical indicating if the pedigree structure should be validated. |
verbose |
A logical. |
Value
A ped
object or a list of such.
Examples
df = data.frame(famid = c("S1", "S2"),
id = c("A", "B"),
fid = 0,
mid = 0,
sex = 1)
# gives a list of two singletons
as.ped(df)
# Trio
df1 = data.frame(id = 1:3, fid = c(0,0,1), mid = c(0,0,2), sex = c(1,2,1))
as.ped(df1)
# Disconnected example: Trio (1-3) + singleton (4)
df2 = data.frame(id = 1:4, fid = c(2,0,0,0), mid = c(3,0,0,0),
M = c("1/2", "1/1", "2/2", "3/4"))
as.ped(df2)
# Two singletons
df3 = data.frame(id = 1:2, fid = 0, mid = 0, sex = 1)
as.ped(df3)
# Add missing parents as founders
df4 = data.frame(id = 1, fid = 2, mid = 3, sex = 1)
as.ped(df4, addMissingFounders = TRUE)