Skip to contents

This function will allow you to reset multilocus lineages for your data set.

Usage

mll.reset(x, value)

Arguments

x

a genclone or snpclone object.

value

a character vector that specifies which levels you wish to be reset.

Value

an object of the same type as x

Note

This method has no assignment method. If "original" is not contained in "value", it is assumed that the "original" definition will be used to reset the MLGs.

Author

Zhian N. Kamvar

Examples


# This data set was a subset of a larger data set, so the multilocus
# genotypes are not all sequential
data(Pinf)
mll(Pinf) <- "original"
mll(Pinf)
#>  [1]  17  24  17  17  54  22  14  19   1  84  83  69  79  74  75  75  13  38   4
#> [20]   5  53  37  30  51  56  39  45  59  62  80  42  61  41  33 110  58  50  46
#> [39]  98  57  95  77  52  93  99  94  21  96  97  97  97  97  34  34  34   6 104
#> [58] 109 115 105  40  55 116 117   8  47   7  15  25  11  10  47  23  12  36  36
#> [77]  35  36  72  71  63  68  63  63  12 106

# If we use mll.reset, then it will become sequential
Pinf.new <- mll.reset(Pinf, TRUE) # reset all
mll(Pinf.new)
#>  [1] 13 18 13 13 38 16 11 14  1 57 56 48 54 51 52 52 10 26  2  3 37 25 20 35 40
#> [26] 27 31 43 45 55 30 44 29 21 69 42 34 32 63 41 60 53 36 58 64 59 15 61 62 62
#> [51] 62 62 22 22 22  4 65 68 70 66 28 39 71 72  6 33  5 12 19  8  7 33 17  9 24
#> [76] 24 23 24 50 49 46 47 46 46  9 67

if (FALSE) { # \dontrun{

# It is possible to reset only specific mll definitions. For example, let's
# say that we wanted to filter our multilocus genotypes by nei's distance
mlg.filter(Pinf, dist = nei.dist, missing = "mean") <- 0.02

# And we wanted to set those as custom genotypes,
mll.custom(Pinf) <- mll(Pinf, "contracted")
mll.levels(Pinf) <- .genlab("MLG", nmll(Pinf, "custom"))

# We could reset just the original and the filtered if we wanted to and keep
# the custom as it were.

Pinf.new <- mll.reset(Pinf, c("original", "contracted"))

mll(Pinf.new, "original")
mll(Pinf.new, "contracted")
mll(Pinf.new, "custom")

# If "original" is not one of the values, then that is used as a baseline.
Pinf.orig <- mll.reset(Pinf, "contracted")
mll(Pinf.orig, "contracted")
mll(Pinf.new, "contracted")
} # }