Learn R Programming

chopsticks (version 1.36.0)

ld.with: function to calculate the LD measures of specific SNPs against other SNPs

Description

This function calculates the LD measures ($r^2$, D', LOD) of specific SNPs against other SNPs.

Usage

ld.with(data, snps, include.itself = as.logical(length(snps) - 1), signed.r = NULL)

Arguments

data
either a snp.dprime-class object or a snp.matrix-class object
snps
A list of snps, some of which are found in data
include.itself
Whether to include LD measures of SNPs against itself - it is FALSE for one SNP, since in that case, the result is known and trivial; but otherwise TRUE
signed.r
Logical, whether to output signed r or $r^2$

Value

The returned value is somewhat similiar to a snp.dprime object, but not the same. It is a list of 3 named matrices dprime, rsq2 (or r depending on the input), lod.

Warning

Because this is really two functions rolled into one, depending on the class of data, not all combinations of the include.itself and signed.r make sense, nor fully operational. Also, the two versions have slightly different idea about invalid values, e.g. the LOD value for a SNPs against itself, or $r^2$ for two monomorphic snps (such as one against itself).

Details

Not all combinations of the include.itself and signed.r make sense, nor fully operational.

See Also

ld.snp, snp.dprime-class

Examples

Run this code
data(testdata)
snps10 <- Autosomes[1:10,1:10]
obj.snp.dprime <- ld.snp(snps10)

# result1 and result2 should be almost identical
# except where noted in the warning section above:
result1 <- ld.with(obj.snp.dprime, colnames(snps10))
result2 <- ld.with(snps10, colnames(snps10))

Run the code above in your browser using DataLab