library(gscramble)
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

# determine if dot is on the system or not.  If we are running it on
# our own machines, with dot, then it will update the images. If dot is
# not on the system it will just use the stored dot images.
HasDot <- Sys.which("dot") != ""


# function to get the bits of the index
bits <- function(i) {as.logical(sapply(i,function(x){ as.logical(intToBits(x))}))[1:4]}

# a vector of the hybrid categories possible
classes <- c("F1", "F2", "F1B", "F1B2")

# a function to create (if dot is present) the figure for the i-th
# component of GSP_opts
make_plots <- function(i) {

  # get the section title for it
  section_title <- paste(
    "### ",
    #names(GSP_opts)[i],
    #":  ",
    paste(classes, " = ", bits(i), ", &nbsp;&nbsp;&nbsp;&nbsp; ", sep = "", collapse = "")
  )

  # make the plots if dot is installed
  if(HasDot) {
    gsp2dot(GSP_opts[[i]], paste("../man/figures/", i, sep=""))
  }

  # remove the dot and png files, that we do not need
  catch <- file.remove(paste("../man/figures/", i, c(".dot", ".png"), sep = ""))

  # now actually make the text for the sections
  ticks3 <- "```"
  sprintf("\n\n%s\n\n%s{r, echo=FALSE, out.width='100%%', fig.align='center'}\nknitr::include_graphics('../man/figures/%d.svg')\n%s", section_title, ticks3, i, ticks3)
}

# uncomment the following line and run in the console to get text for 
# all the sections:
#dump <- lapply(1:15, function(i) cat(make_plots(i)))

The function create_GSP() allows the user to quickly create several different pedigree structures that are "saturated" in the sense of using all the genomic material of the founders. There are 15 different pedigrees, and they can be specified by the user according to whether the user wants to have any of the following four hybrid categories to be present amongst the simulated descendants:

The following images show the pedigrees created by create_GSP() with different inputs (TRUE or FALSE) for the four parameters, F1, F2, F1B, F1B2, to the function.

See the documentation ?create_GSP for more information.

F1 = TRUE,      F2 = FALSE,      F1B = FALSE,      F1B2 = FALSE,     

knitr::include_graphics('../man/figures/1.svg')

F1 = FALSE,      F2 = TRUE,      F1B = FALSE,      F1B2 = FALSE,     

knitr::include_graphics('../man/figures/2.svg')

F1 = TRUE,      F2 = TRUE,      F1B = FALSE,      F1B2 = FALSE,     

knitr::include_graphics('../man/figures/3.svg')

F1 = FALSE,      F2 = FALSE,      F1B = TRUE,      F1B2 = FALSE,     

knitr::include_graphics('../man/figures/4.svg')

F1 = TRUE,      F2 = FALSE,      F1B = TRUE,      F1B2 = FALSE,     

knitr::include_graphics('../man/figures/5.svg')

F1 = FALSE,      F2 = TRUE,      F1B = TRUE,      F1B2 = FALSE,     

knitr::include_graphics('../man/figures/6.svg')

F1 = TRUE,      F2 = TRUE,      F1B = TRUE,      F1B2 = FALSE,     

knitr::include_graphics('../man/figures/7.svg')

F1 = FALSE,      F2 = FALSE,      F1B = FALSE,      F1B2 = TRUE,     

knitr::include_graphics('../man/figures/8.svg')

F1 = TRUE,      F2 = FALSE,      F1B = FALSE,      F1B2 = TRUE,     

knitr::include_graphics('../man/figures/9.svg')

F1 = FALSE,      F2 = TRUE,      F1B = FALSE,      F1B2 = TRUE,     

knitr::include_graphics('../man/figures/10.svg')

F1 = TRUE,      F2 = TRUE,      F1B = FALSE,      F1B2 = TRUE,     

knitr::include_graphics('../man/figures/11.svg')

F1 = FALSE,      F2 = FALSE,      F1B = TRUE,      F1B2 = TRUE,     

knitr::include_graphics('../man/figures/12.svg')

F1 = TRUE,      F2 = FALSE,      F1B = TRUE,      F1B2 = TRUE,     

knitr::include_graphics('../man/figures/13.svg')

F1 = FALSE,      F2 = TRUE,      F1B = TRUE,      F1B2 = TRUE,     

knitr::include_graphics('../man/figures/14.svg')

F1 = TRUE,      F2 = TRUE,      F1B = TRUE,      F1B2 = TRUE,     

knitr::include_graphics('../man/figures/15.svg')


eriqande/gscramble documentation built on March 5, 2024, 4:22 p.m.