Skip to contents

Wrapper for snpclone initializer.

Usage

as.snpclone(x, ..., parallel = FALSE, n.cores = NULL, mlg, mlgclass = TRUE)

Arguments

x

a genlight or snpclone object

...

arguments to be passed on to the genlight constructor. These are not used if x is not missing.

parallel

should the parallel package be used to construct the object?

n.cores

how many cores should be utilized? See documentation for genlight for details.

mlg

a vector of multilocus genotypes or an object of class MLG for the new snpclone object.

mlgclass

if TRUE (default), the multilocus genotypes will be represented as an MLG object.

Author

Zhian N. Kamvar

Examples

(x <- as.snpclone(glSim(100, 1e3, ploid=2)))
#>  ||| SNPCLONE OBJECT |||||||||
#> 
#>  || 100 genotypes,  1,000 binary SNPs, size: 182.6 Kb
#>  0 (0 %) missing data
#> 
#>  || Basic content
#>    @gen: list of 100 SNPbin
#>    @mlg: 100 original multilocus genotypes
#>    @ploidy: ploidy of each individual  (range: 2-2)
#> 
#>  || Optional content
#>    @other: a list containing: ancestral.pops 
#> 
#> NULL
# \dontrun{
# Without parallel processing
system.time(x <- as.snpclone(glSim(1000, 1e5, ploid=2)))
#>    user  system elapsed 
#> 110.935  14.390 125.455 

# With parallel processing... doesn't really save you much time.
system.time(x <- as.snpclone(glSim(1000, 1e5, ploid=2, parallel = TRUE), 
                             parallel = TRUE))
#> Loading required package: parallel
#>    user  system elapsed 
#> 110.695  12.397 123.898 
# }