sim_crossing_block: Create a crossing block from a vector of parents

View source: R/sim_crossing_block.R

sim_crossing_blockR Documentation

Create a crossing block from a vector of parents

Description

Create a crossing block based on parent names, with different options for mating scheme.

Usage

sim_crossing_block(
  parents,
  n.crosses = NULL,
  type = c("2way", "4way"),
  scheme = c("random", "chain"),
  use.parents.once = FALSE
)

Arguments

parents

A character of line names to use as parents. If second.parents is not provided, crosses are assigned from randomly sampling the entries in parents.

n.crosses

The number of crosses to generate. Cannot be more than the possible number of crosses. If NULL, the function returns all possible crosses.

type

The type of crosses to simulate. Can be "2way" for bi-parental crosses or "4way" for 4-way crosses.

scheme

The mating scheme. Can be one of "random" or "chain". See Details for more information.

use.parents.once

Logical - should parents be used only once?

Details

Several options are available to generate crossing blocks from a list of parents. Here are the rules used for generating different crossing blocks.

scheme = "random"

A data.frame is first constructed with all possible pairwise combinations of parents. Self-crosses and reciprocal crosses are removed and n.crosses crosses are randomly sampled. If use.parents.once = TRUE, crosses are selected such that any one parent is used only once.

scheme = "chain"

Crosses are generated by pairing the first element in parents with the second element, the second element with the third, and so on. The n.crosses and use.parents.once arguments are ignored.

Further rules:

  • If second.parents = NULL, then parents is duplicated.

Value

A data.frame with two columns. The first is the names of the first parents, and the second is the name of the second parents. Each row is a mating pair.

Examples


parents <- paste("line", seq(10), sep = "")

# Generate 3 crosses randomly
cb <- sim_crossing_block(parents = parents, n.crosses = 3)

# Generate 3 crosses randomly, while using parents only once.
cb <- sim_crossing_block(parents = parents, n.crosses = 3, use.parents.once = TRUE)

# Generate a chain of crosses
cb <- sim_crossing_block(parents = parents, scheme = "chain")



neyhartj/pbsim documentation built on Nov. 11, 2023, 4:07 p.m.