getFixedBias: Get fixed allele read biases

getFixedBiasR Documentation

Get fixed allele read biases

Description

Get fixed allele read biases of markers

Usage

getFixedBias(object, valid = TRUE, chr = NULL, ...)

## S4 method for signature 'GbsrGenotypeData'
getFixedBias(object, valid, chr)

Arguments

object

A GbsrGenotypeData object.

valid

A logical value. See details.

chr

A integer or string to specify chromosome to get information.

...

Unused.

Details

If valid = TRUE, A logical vector for the markers which are labeled TRUE in the "valid" column of the "marker" slot will be returned. If you need check the dominant markers in all markers, set valid = FALSE. validMar() tells you which markers are valid.

Value

A numeric vector of fixed allele read biases.

A GbsrGenotypeData object after adding dominant marker information

See Also

setFixedBias()

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)

fixed_bias <- getFixedBias(gds)

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


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