Skip to contents

A class to store multilocus genotypes in genclone objects. This is intended for internal use only.

Slots

mlg

a list containing four vectors, one for each type of MLG manipulation.

visible

a character specifying which MLG type is to be displayed and accessed.

distname

the name of the distance function or matrix used to collapse mlgs.

distenv

the environment that contains the distance function or matrix

distargs

the arguments provided to compute the distance function.

distalgo

the algorithm used to contract multilocus genotypes.

cutoff

Two numbers specifying the cutoff value for expanding and collapsing MLGs.

See also

genclone snpclone mll For developers: visible

Author

Zhian N. Kamvar

Examples


# These examples will simply show you what you can do with these
set.seed(5000)
(x <- sample(10, 20, replace = TRUE))
#>  [1]  8  5  5  2  3  1  4  9  6  4  5  9  7 10  2  4  2  4 10  2
(m <- new("MLG", x))
#> 20 original mlgs.
#>  [1]  8  5  5  2  3  1  4  9  6  4  5  9  7 10  2  4  2  4 10  2

 visible(m) # original is always default
#> [1] "original"
 
 m[]       # adding braces after the object will always return a vector of 
#>  [1]  8  5  5  2  3  1  4  9  6  4  5  9  7 10  2  4  2  4 10  2
           # the same type as defined in "visible"
           
 m + 1     # You can do math on the numeric ones
#>  [1]  9  6  6  3  4  2  5 10  7  5  6 10  8 11  3  5  3  5 11  3
 
 visible(m) <- "custom"
 m + 2     # This should throw a warning
#> Warning: ‘+’ not meaningful for factors
#>  [1] NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA
 # The types are stored in a data frame. You can retrieve them easily:
 visible(m) <- "original"
 m
#> 20 original mlgs.
#>  [1]  8  5  5  2  3  1  4  9  6  4  5  9  7 10  2  4  2  4 10  2
 m[, "custom"]
#>  [1] 8  5  5  2  3  1  4  9  6  4  5  9  7  10 2  4  2  4  10 2 
#> Levels: 1 2 3 4 5 6 7 8 9 10
 
 # Important for subsetting, if you subset the object, normally, it will 
 # return a vector unless you specify all = TRUE
 m[1:10]             # original vector
#>  [1] 8 5 5 2 3 1 4 9 6 4
 m[1:10, all = TRUE] # still class MLG
#> 10 original mlgs.
#>  [1] 8 5 5 2 3 1 4 9 6 4