Skip to contents

GENclone is an S4 class that extends the genind object.
SNPclone is an S4 class that extends the genlight object.

They will have all of the same attributes as their parent classes, but they will contain one extra slot to store extra information about multilocus genotypes.

Details

The genclone and snpclone classes will allow for more optimized methods of clone correction.

Previously for genind and genlight objects, multilocus genotypes were not retained after a data set was subset by population. The new mlg slot allows us to assign the multilocus genotypes and retain that information no matter how we subset the data set. This new slot can either contain numeric values for multilocus genotypes OR it can contain a special internal MLG class that allows for custom multilocus genotype definitions and filtering.

Slots

mlg

a vector representing multilocus genotypes for the data set OR an object of class MLG.

Note

When calculating multilocus genotypes for genclone objects, a rank function is used, but calculation of multilocus genotypes for snpclone objects is distance-based (via bitwise.dist and mlg.filter). This means that genclone objects are sensitive to missing data, whereas snpclone objects are insensitive.

Extends

The genclone class extends class "genind", directly.
The snpclone class extends class "genlight", directly.

Author

Zhian N. Kamvar

Examples

# \dontrun{

# genclone objects can be created from genind objects
#
data(partial_clone)
partial_clone
#> /// GENIND OBJECT /////////
#> 
#>  // 50 individuals; 10 loci; 35 alleles; size: 22.6 Kb
#> 
#>  // Basic content
#>    @tab:  50 x 35 matrix of allele counts
#>    @loc.n.all: number of alleles per locus (range: 3-5)
#>    @loc.fac: locus factor for the 35 columns of @tab
#>    @all.names: list of allele names for each locus
#>    @ploidy: ploidy of each individual  (range: 2-2)
#>    @type:  codom
#>    @call: old2new_genind(object = x, donor = new(class(x)))
#> 
#>  // Optional content
#>    @pop: population of each individual (group size range: 12-13)
(pc <- as.genclone(partial_clone))
#> 
#> This is a genclone object
#> -------------------------
#> Genotype information:
#> 
#>    26 original multilocus genotypes 
#>    50 diploid individuals
#>    10 codominant loci
#> 
#> Population information:
#> 
#>     0 strata. 
#>     4 populations defined - 1, 2, 3, 4

# snpclone objects can be created from genlight objects
#
set.seed(999)
(gl <- glSim(100, 0, n.snp.struc = 1e3, ploidy = 2, parallel = FALSE))
#>  /// GENLIGHT OBJECT /////////
#> 
#>  // 100 genotypes,  1,000 binary SNPs, size: 172 Kb
#>  0 (0 %) missing data
#> 
#>  // Basic content
#>    @gen: list of 100 SNPbin
#>    @ploidy: ploidy of each individual  (range: 2-2)
#> 
#>  // Optional content
#>    @pop: population of each individual (group size range: 50-50)
#>    @other: a list containing: ancestral.pops 
#> 
(sc <- as.snpclone(rbind(gl, gl, parallel = FALSE), parallel = FALSE))
#>  ||| SNPCLONE OBJECT |||||||||
#> 
#>  || 200 genotypes,  1,000 binary SNPs, size: 353.7 Kb
#>  0 (0 %) missing data
#> 
#>  || Basic content
#>    @gen: list of 200 SNPbin
#>    @mlg: 100 original multilocus genotypes
#>    @ploidy: ploidy of each individual  (range: 2-2)
#> 
#>  || Optional content
#>    @pop: population of each individual (group size range: 100-100)
#>    @other: a list containing: elements without names 
#> 
#> NULL
# 
# Use mlg.filter to create a distance threshold to define multilocus genotypes.
mlg.filter(sc, threads = 1L) <- 0.25
sc # 82 mlgs
#>  ||| SNPCLONE OBJECT |||||||||
#> 
#>  || 200 genotypes,  1,000 binary SNPs, size: 353.7 Kb
#>  0 (0 %) missing data
#> 
#>  || Basic content
#>    @gen: list of 200 SNPbin
#>    @mlg: 82 contracted multilocus genotypes
#>          (0.25) [t], (bitwise.dist) [d], (farthest) [a]
#>    @ploidy: ploidy of each individual  (range: 2-2)
#> 
#>  || Optional content
#>    @pop: population of each individual (group size range: 100-100)
#>    @other: a list containing: elements without names 
#> 
#> NULL

# }