Learn R Programming

hsphase (version 2.0.4)

.simulateHalfsib: Simulate Half-Sibling Genotypes

Description

This function simulates genotypes for a set of half-siblings based on specified parameters, including the number of individuals, the number of SNPs, recombination boundaries, and the type of data to return. It generates a sire genotype, maternal half-sib genotypes, and combines these to simulate offspring genotypes, optionally returning phased genotypes based on recombination events.

Usage

.simulateHalfsib(
  numInd = 40,
  numSNP = 10000,
  recbound = 0:6,
  type = "genotype"
)

Value

Depending on the type parameter, this function returns a matrix of simulated genotypic data for half-siblings. If type is "genotype", it returns unphased genotypic data; otherwise, it returns phased genotypic data.

Arguments

numInd

Integer, the number of half-siblings to simulate.

numSNP

Integer, the number of SNPs to simulate for each individual.

recbound

Numeric vector, specifying the range of possible recombination events to simulate.

type

Character string, specifying the type of data to return: "genotype" for genotypic data or any other string for phased genotypic data.

Examples

Run this code
sim_genotypes <- .simulateHalfsib(numInd = 40, numSNP = 10000, recbound = 0:6, type = "genotype")
dim(sim_genotypes) # Should return 40 rows (individuals) and 100 columns (SNPs)

Run the code above in your browser using DataLab