S4 class to represent the identity informations of the individuals in a pedigree.
Usage
# S4 method for class 'data.frame'
Ped(obj, cols_used_init = FALSE, cols_used_del = FALSE)
# S4 method for class 'character_OR_integer'
Ped(
obj,
sex,
dadid,
momid,
famid = NA,
steril = NA,
status = NA,
avail = NA,
affected = NA,
missid = NA_character_,
useful = NA,
isinf = NA,
kin = NA_real_
)
Arguments
- obj
A character vector with the id of the individuals or a
data.frame
with all the informations in corresponding columns.- cols_used_init
Boolean defining if the columns that will be used should be initialised to NA.
- cols_used_del
Boolean defining if the columns that will be used should be deleted.
- sex
A character, factor or numeric vector corresponding to the gender of the individuals. This will be transformed to an ordered factor with the following levels:
male
<female
<unknown
<terminated
The following values are recognized:character() or factor() : "f", "m", "woman", "man", "male", "female", "unknown", "terminated"
numeric() : 1 = "male", 2 = "female", 3 = "unknown", 4 = "terminated"
- dadid
A vector containing for each subject, the identifiers of the biologicals fathers.
- momid
A vector containing for each subject, the identifiers of the biologicals mothers.
- famid
A character vector with the family identifiers of the individuals. If provide, will be aggregated to the individuals identifiers separated by an underscore.
- steril
A logical vector with the sterilisation status of the individuals (i.e.
FALSE
= not sterilised,TRUE
= sterilised,NA
= unknown).- status
A logical vector with the affection status of the individuals (i.e.
FALSE
= alive,TRUE
= dead,NA
= unknown).- avail
A logical vector with the availability status of the individuals (i.e.
FALSE
= not available,TRUE
= available,NA
= unknown).- affected
A logical vector with the affection status of the individuals (i.e.
FALSE
= unaffected,TRUE
= affected,NA
= unknown).- missid
A character vector with the missing values identifiers. All the id, dadid and momid corresponding to those values will be set to
NA_character_
.- useful
A logical vector with the usefulness status of the individuals (i.e.
FALSE
= not useful,TRUE
= useful).- isinf
A logical vector indicating if the individual is informative or not (i.e.
FALSE
= not informative,TRUE
= informative).- kin
A numeric vector with minimal kinship value between the individuals and the informative individuals.
Details
The minimal needed informations are id
, dadid
,
momid
and sex
.
The other slots are used to store recognized informations.
Additional columns can be added to the Ped object and will be
stored in the elementMetadata
slot of the Ped object.
Slots
id
A character vector with the id of the individuals.
dadid
A character vector with the id of the father of the individuals.
momid
A character vector with the id of the mother of the individuals.
sex
An ordered factor vector for the sex of the individuals (i.e.
male
<female
<unknown
<terminated
).famid
A character vector with the family identifiers of the individuals (optional).
steril
A logical vector with the sterilisation status of the individuals (i.e.
FALSE
= not sterilised,TRUE
= sterilised,NA
= unknown).status
A logical vector with the affection status of the individuals (i.e.
FALSE
= alive,TRUE
= dead,NA
= unknown).avail
A logical vector with the availability status of the individuals (i.e.
FALSE
= not available,TRUE
= available,NA
= unknown).affected
A logical vector with the affection status of the individuals (i.e.
FALSE
= not affected,TRUE
= affected,NA
= unknown).useful
A logical vector with the usefulness status of the individuals (i.e.
FALSE
= not useful,TRUE
= useful).isinf
A logical vector indicating if the individual is informative or not (i.e.
FALSE
= not informative,TRUE
= informative).kin
A numeric vector with minimal kinship value between the individuals and the useful individuals.
num_child_tot
A numeric vector with the total number of children of the individuals.
num_child_dir
A numeric vector with the number of children of the individuals.
num_child_ind
A numeric vector with the number of children of the individuals.
elementMetadata
A DataFrame with the additional metadata columns of the Ped object.
metadata
Meta informations about the pedigree.
Accessors
For all the following accessors, the x
parameters is a Ped object.
Each getters return a vector of the same length as x
with the values
of the corresponding slot. For each getter, you have a setter with the
same name, to be use as slot(x) <- value
.
The value
parameter is a vector of the same length as x
,
except for the mcols()
accessors where value
is a list
or a data.frame with each elements with the same length as x
.
id(x)
: Individuals identifiers
dadid(x)
: Individuals' father identifiers
momid(x)
: Individuals' mother identifiers
famid(x)
: Individuals' family identifiers
sex(x)
: Individuals' gender
affected(x)
: Individuals' affection status
avail(x)
: Individuals' availability status
status(x)
: Individuals' death status
isinf(x)
: Individuals' informativeness status
kin(x)
: Individuals' kinship distance to the informative individuals
useful(x)
: Individuals' usefullness status
mcols(x)
: Individuals' metadata
Generics
summary(x)
: Compute the summary of a Ped object
show(x)
: Convert the Ped object to a data.frame and print it with its summary.
as.list(x)
: Convert a Ped object to a list with the metadata columns at the end.
as.data.frame(x)
: Convert a Ped object to a data.frame with the metadata columns at the end.
subset(x, i, del_parents = FALSE, keep = TRUE)
: Subset a Ped object based on the individuals identifiers given.i
: A vector of individuals identifiers to keep.del_parents
: A value indicating if the parents of the individuals should be deleted.keep
: A logical value indicating if the individuals should be kept or deleted.
Examples
data(sampleped)
Ped(sampleped)
#> Ped object with 55 individuals and 2 metadata columns:
#> id dadid momid sex famid steril
#> col_class <character> <character> <character> <ordered> <character> <logical>
#> 101 101 <NA> <NA> male 1 <NA>
#> 102 102 <NA> <NA> female 1 <NA>
#> 103 103 135 136 male 1 <NA>
#> 104 104 <NA> <NA> female 1 <NA>
#> 105 105 <NA> <NA> male 1 <NA>
#> ... ... ... ... ... ... ...
#> 210 210 203 204 male 2 <NA>
#> 211 211 203 204 male 2 <NA>
#> 212 212 209 208 female 2 <NA>
#> 213 213 209 208 male 2 <NA>
#> 214 214 209 208 male 2 <NA>
#> status avail affected useful kin isinf
#> col_class <logical> <logical> <logical> <logical> <numeric> <logical>
#> 101 <NA> FALSE <NA> <NA> <NA> <NA>
#> 102 <NA> FALSE <NA> <NA> <NA> <NA>
#> 103 <NA> FALSE <NA> <NA> <NA> <NA>
#> 104 <NA> FALSE <NA> <NA> <NA> <NA>
#> 105 <NA> FALSE <NA> <NA> <NA> <NA>
#> ... ... ... ... ... ... ...
#> 210 <NA> FALSE <NA> <NA> <NA> <NA>
#> 211 <NA> TRUE <NA> <NA> <NA> <NA>
#> 212 <NA> TRUE <NA> <NA> <NA> <NA>
#> 213 <NA> FALSE <NA> <NA> <NA> <NA>
#> 214 <NA> TRUE <NA> <NA> <NA> <NA>
#> num_child_tot num_child_dir num_child_ind | affection num
#> col_class <numeric> <numeric> <numeric> <character> <character>
#> 101 1 1 0 0 2
#> 102 1 1 0 1 3
#> 103 4 4 0 1 2
#> 104 4 4 0 0 4
#> 105 4 4 0 <NA> 6
#> ... ... ... ... ... ...
#> 210 0 0 0 0 2
#> 211 0 0 0 0 1
#> 212 0 0 0 0 3
#> 213 0 0 0 0 2
#> 214 0 0 0 1 0
Ped(
obj = c("1", "2", "3", "4", "5", "6"),
dadid = c("4", "4", "6", "0", "0", "0"),
momid = c("5", "5", "5", "0", "0", "0"),
sex = c(1, 2, 3, 1, 2, 1),
missid = "0"
)
#> Ped object with 6 individuals and 0 metadata columns:
#> id dadid momid sex famid steril
#> col_class <character> <character> <character> <ordered> <character> <logical>
#> 1 1 4 5 male <NA> <NA>
#> 2 2 4 5 female <NA> <NA>
#> 3 3 6 5 unknown <NA> <NA>
#> 4 4 <NA> <NA> male <NA> <NA>
#> 5 5 <NA> <NA> female <NA> <NA>
#> 6 6 <NA> <NA> male <NA> <NA>
#> status avail affected useful kin isinf
#> col_class <logical> <logical> <logical> <logical> <numeric> <logical>
#> 1 <NA> <NA> <NA> <NA> <NA> <NA>
#> 2 <NA> <NA> <NA> <NA> <NA> <NA>
#> 3 <NA> <NA> <NA> <NA> <NA> <NA>
#> 4 <NA> <NA> <NA> <NA> <NA> <NA>
#> 5 <NA> <NA> <NA> <NA> <NA> <NA>
#> 6 <NA> <NA> <NA> <NA> <NA> <NA>
#> num_child_tot num_child_dir num_child_ind
#> col_class <numeric> <numeric> <numeric>
#> 1 0 0 0
#> 2 0 0 0
#> 3 0 0 0
#> 4 3 2 1
#> 5 3 3 0
#> 6 3 1 2