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

# \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")
#>  [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
mll(Pinf.new, "contracted")
#>  [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
mll(Pinf.new, "custom")
#>  [1] MLG11 MLG10 MLG11 MLG11 MLG33 MLG13 MLG10 MLG11 MLG01 MLG52 MLG51 MLG43
#> [13] MLG49 MLG46 MLG47 MLG47 MLG09 MLG21 MLG02 MLG03 MLG32 MLG20 MLG15 MLG30
#> [25] MLG35 MLG22 MLG26 MLG38 MLG40 MLG50 MLG25 MLG39 MLG24 MLG16 MLG63 MLG37
#> [37] MLG29 MLG27 MLG57 MLG36 MLG55 MLG48 MLG31 MLG53 MLG58 MLG54 MLG12 MLG56
#> [49] MLG56 MLG56 MLG56 MLG56 MLG17 MLG17 MLG17 MLG04 MLG59 MLG62 MLG64 MLG60
#> [61] MLG23 MLG34 MLG65 MLG66 MLG19 MLG28 MLG05 MLG10 MLG14 MLG07 MLG06 MLG28
#> [73] MLG13 MLG08 MLG19 MLG19 MLG18 MLG19 MLG45 MLG44 MLG41 MLG42 MLG41 MLG41
#> [85] MLG08 MLG61
#> 66 Levels: MLG01 MLG02 MLG03 MLG04 MLG05 MLG06 MLG07 MLG08 MLG09 ... MLG66

# 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")
#>  [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
mll(Pinf.new, "contracted")
#>  [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
# }