bdapply {BinaryDosage}R Documentation

Apply a function to each SNP in a binary dosage file

Description

A routine that reads in the SNP data serially from a binary dosage file and applies a user specified function to the data.

Usage

bdapply(bdinfo, func, ...)

Arguments

bdinfo

List with information about the binary dosage file returned from getbdinfo

func

A user supplied function to apply to the data for each snp. The function must be provide with the following parameters, dosage, p0, p1, and p2, where dosage is the dosage values for each subject and p0, p1, and p2 are the probabilities that a subject has zero, one, and two copies of the alternate allele, respectively.

...

Additional parameters needed by the user supplied function

Value

A list with length equal to the number of SNPs in the binary dosage file. Each element of the list is the value returned by the user supplied function

See Also

Other Iterating functions: genapply(), vcfapply()

Examples

# Get information about a binary dosage file

vcf1abdfile <- system.file("extdata", "vcf1a.bdose", package = "BinaryDosage")
bdinfo <- getbdinfo(bdfiles = vcf1abdfile)

# Apply the getaaf, get alternate allele frequency, function
# to all the SNPs in the binary dosage file

aaf <- bdapply(bdinfo = bdinfo,
               func = BinaryDosage:::getaaf)

[Package BinaryDosage version 1.0.0 Index]