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$
Details
Not all combinations of the include.itself and signed.r
make sense, nor fully operational.
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).
Note
The ld.with function started its life as an extractor
function to take the output of ld.snp, a
snp.dprime-class object, to rearrange it
in a more convenient form to focus on the LD's against specific SNPs,
but then evolved to take a snp.matrix-class object
alternatively and perform the same task directly and more efficiently.
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))
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(chopsticks)
Loading required package: survival
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/chopsticks/ld.with.Rd_%03d_medium.png", width=480, height=480)
> ### Name: ld.with
> ### Title: function to calculate the LD measures of specific SNPs against
> ### other SNPs
> ### Aliases: ld.with ld.with,snp.matrix,character-method
> ### Keywords: dplot manip models
>
> ### ** Examples
>
> data(testdata)
> snps10 <- Autosomes[1:10,1:10]
> obj.snp.dprime <- ld.snp(snps10)
Information: The input contains 10 samples with 10 snps
... Done
>
> # 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))
Information: The input contains 10 samples with 10 snps
>
>
>
>
>
> dev.off()
null device
1
>