setFixedBias: Set fixed allele read biases

setFixedBiasR Documentation

Set fixed allele read biases

Description

Set fixed allele read biases of valid markers

Usage

setFixedBias(object, bias, ...)

## S4 method for signature 'GbsrGenotypeData'
setFixedBias(object, bias)

Arguments

object

A GbsrGenotypeData object.

bias

A numeric vector of fixed allele read biases to be assigned to valid markers. The length of bias vector should match the number of valid markers. The values in the bias vector are assigned to the valid markers according to their order. NAs in the bias vector indicates non-fixed biases.

...

Unused.

Details

Since the bias set by setFixedBias() function is the reference allele read bias. Thus, the values 0 and 1 mean that the marker only gives alternative and reference allele reads, respectively. Set these fixed biases if some of your markers are dominant markers.

Value

A GbsrGenotypeData object after adding dominant marker information

Examples

# Create a GDS file from a sample VCF file.
vcf_fn <- system.file("extdata", "sample.vcf", package = "GBScleanR")
gds_fn <- tempfile("sample", fileext = ".gds")
gbsrVCF2GDS(vcf_fn = vcf_fn, out_fn = gds_fn, force = TRUE)

# Load data in the GDS file and instantiate a [GbsrGenotypeData] object.
gds <- loadGDS(gds_fn)

# Set fixed allele read biases.
# Initialize the bias vector to be assinged.
bias <- rep(NA, nmar(gds))

# As an example, select 20 markers randomly and assign 0 or 1 to them.
# Since the bias set by setFixedBias() function is the reference allele read
# bias. Thus, the values 0 and 1 means that the marker only gives alternative
# and reference allele reads, respectively.
# Set these fixed biases if some of your markers are dominant markers.
bias[sample(seq_along(bias), 20)] <- sample(c(0, 1), 20, replace = TRUE)

gds <- setFixedBias(gds, bias = bias)

# Close the connection to the GDS file
closeGDS(gds)


tomoyukif/GBScleanR documentation built on Oct. 31, 2024, 2:43 a.m.