inst/doc/multidog.R

## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.width=4.5,
  fig.height=3.5
)

## ----setup--------------------------------------------------------------------
library(future)
library(updog)
data("uitdewilligen")

## -----------------------------------------------------------------------------
refmat  <- t(uitdewilligen$refmat)
sizemat <- t(uitdewilligen$sizemat)
ploidy  <- uitdewilligen$ploidy

## -----------------------------------------------------------------------------
setdiff(colnames(sizemat), colnames(refmat))
setdiff(rownames(sizemat), rownames(refmat))

## -----------------------------------------------------------------------------
future::availableCores()

## -----------------------------------------------------------------------------
mout <- multidog(refmat = refmat, 
                 sizemat = sizemat, 
                 ploidy = ploidy, 
                 model = "norm",
                 nc = 2)

## ----eval = FALSE-------------------------------------------------------------
#  future::plan(future::multisession, workers = nc)

## ----eval = FALSE-------------------------------------------------------------
#  future::plan(future::multicore, workers = 2)
#  mout <- multidog(refmat = refmat,
#                   sizemat = sizemat,
#                   ploidy = ploidy,
#                   model = "norm",
#                   nc = NA)
#  
#  ## Shut down parallel workers
#  future::plan(future::sequential)

## -----------------------------------------------------------------------------
plot(mout, indices = c(1, 5, 100))

## -----------------------------------------------------------------------------
str(mout$snpdf)

## -----------------------------------------------------------------------------
str(mout$inddf)

## -----------------------------------------------------------------------------
genomat <- format_multidog(mout, varname = "geno")
head(genomat)

## -----------------------------------------------------------------------------
dim(mout$snpdf)
dim(mout$inddf)
mout_cleaned <- filter_snp(mout, prop_mis < 0.05 & bias > exp(-1) & bias < exp(1))
dim(mout_cleaned$snpdf)
dim(mout_cleaned$inddf)

Try the updog package in your browser

Any scripts or data that you put into this service are public.

updog documentation built on Nov. 17, 2023, 9:06 a.m.