Find single affected and available individual from a Pedigree
Source:R/find_avail_affected.R
find_avail_affected.Rd
Finds one subject from among available non-parents with indicated affection status.
Usage
# S4 method for class 'Ped'
find_avail_affected(obj, avail = NULL, affected = NULL, affstatus = NA)
# S4 method for class 'Pedigree'
find_avail_affected(obj, avail = NULL, affected = NULL, affstatus = NA)
Arguments
- obj
A Ped or Pedigree object.
- 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).- affstatus
Affection status to search for.
Value
A list is returned with the following components
ped The new Ped object
newAvail Vector of availability status of trimmed individuals
idTrimmed Vector of IDs of trimmed individuals
isTrimmed logical value indicating whether Ped object has been trimmed
bit_size Bit size of the trimmed Ped
Details
When used within shrink()
, this function is called
with the first affected indicator,
if the affected item in the Pedigree is a matrix of
multiple affected indicators.
If avail or affected is null, then the function will use the corresponding Ped accessor.
Examples
data(sampleped)
ped <- Pedigree(sampleped)
find_avail_affected(ped, affstatus = 1)
#> $ped
#> Ped object with 38 individuals and 13 metadata columns:
#> id dadid momid sex famid steril
#> col_class <character> <character> <character> <ordered> <character> <logical>
#> 1_103 1_103 1_135 1_136 male 1 <NA>
#> 1_104 1_104 <NA> <NA> female 1 <NA>
#> 1_105 1_105 <NA> <NA> male 1 <NA>
#> 1_106 1_106 <NA> <NA> female 1 <NA>
#> 1_109 1_109 <NA> <NA> female 1 <NA>
#> ... ... ... ... ... ... ...
#> 2_208 2_208 2_201 2_202 female 2 <NA>
#> 2_209 2_209 <NA> <NA> male 2 <NA>
#> 2_211 2_211 2_203 2_204 male 2 <NA>
#> 2_212 2_212 2_209 2_208 female 2 <NA>
#> 2_214 2_214 2_209 2_208 male 2 <NA>
#> status avail affected useful kin isinf
#> col_class <logical> <logical> <logical> <logical> <numeric> <logical>
#> 1_103 <NA> FALSE TRUE <NA> <NA> <NA>
#> 1_104 <NA> FALSE FALSE <NA> <NA> <NA>
#> 1_105 <NA> FALSE <NA> <NA> <NA> <NA>
#> 1_106 <NA> FALSE <NA> <NA> <NA> <NA>
#> 1_109 <NA> TRUE FALSE <NA> <NA> <NA>
#> ... ... ... ... ... ... ...
#> 2_208 <NA> FALSE FALSE <NA> <NA> <NA>
#> 2_209 <NA> FALSE FALSE <NA> <NA> <NA>
#> 2_211 <NA> TRUE FALSE <NA> <NA> <NA>
#> 2_212 <NA> TRUE FALSE <NA> <NA> <NA>
#> 2_214 <NA> TRUE TRUE <NA> <NA> <NA>
#> num_child_tot num_child_dir num_child_ind | family indId
#> col_class <numeric> <numeric> <numeric> <character> <character>
#> 1_103 3 3 0 1 103
#> 1_104 3 3 0 1 104
#> 1_105 4 4 0 1 105
#> 1_106 4 4 0 1 106
#> 1_109 0 0 0 1 109
#> ... ... ... ... ... ...
#> 2_208 2 2 0 2 208
#> 2_209 2 2 0 2 209
#> 2_211 0 0 0 2 211
#> 2_212 0 0 0 2 212
#> 2_214 0 0 0 2 214
#> fatherId motherId gender affection available
#> col_class <character> <character> <character> <character> <character>
#> 1_103 135 136 1 1 0
#> 1_104 <NA> <NA> 2 0 0
#> 1_105 <NA> <NA> 1 <NA> 0
#> 1_106 <NA> <NA> 2 <NA> 0
#> 1_109 101 102 2 0 1
#> ... ... ... ... ... ...
#> 2_208 201 202 2 0 0
#> 2_209 <NA> <NA> 1 0 0
#> 2_211 203 204 1 0 1
#> 2_212 209 208 2 0 1
#> 2_214 209 208 1 1 1
#> num error sterilisation vitalStatus affection_mods
#> col_class <character> <character> <character> <character> <character>
#> 1_103 2 <NA> <NA> <NA> 1
#> 1_104 4 <NA> <NA> <NA> 0
#> 1_105 6 <NA> <NA> <NA> NA
#> 1_106 1 <NA> <NA> <NA> NA
#> 1_109 3 <NA> <NA> <NA> 0
#> ... ... ... ... ... ...
#> 2_208 1 <NA> <NA> <NA> 0
#> 2_209 2 <NA> <NA> <NA> 0
#> 2_211 1 <NA> <NA> <NA> 0
#> 2_212 3 <NA> <NA> <NA> 0
#> 2_214 0 <NA> <NA> <NA> 1
#> avail_mods
#> col_class <character>
#> 1_103 0
#> 1_104 0
#> 1_105 0
#> 1_106 0
#> 1_109 1
#> ... ...
#> 2_208 0
#> 2_209 0
#> 2_211 1
#> 2_212 1
#> 2_214 1
#>
#> $new_avail
#> [1] FALSE FALSE FALSE FALSE TRUE TRUE FALSE FALSE FALSE TRUE FALSE TRUE
#> [13] TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE FALSE FALSE
#> [25] FALSE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE FALSE FALSE TRUE
#> [37] TRUE TRUE
#>
#> $id_trimmed
#> [1] "1_124"
#>
#> $is_trimmed
#> [1] TRUE
#>
#> $bit_size
#> [1] 37
#>