Description Usage Arguments Details Value Author(s) See Also Examples
Calculate the fraction of identity by state for each pair of samples
1 2 3 |
gdsobj |
an object of class |
sample.id |
a vector of sample id specifying selected samples; if NULL, all samples are used |
snp.id |
a vector of snp id specifying selected SNPs; if NULL, all SNPs are used |
autosome.only |
if |
remove.monosnp |
if TRUE, remove monomorphic SNPs |
maf |
to use the SNPs with ">= maf" only; if NaN, no MAF threshold |
missing.rate |
to use the SNPs with "<= missing.rate" only; if NaN, no missing threshold |
num.thread |
the number of (CPU) cores used; if |
useMatrix |
if |
verbose |
if TRUE, show information |
The minor allele frequency and missing rate for each SNP passed in
snp.id
are calculated over all the samples in sample.id
.
The values of the IBS matrix range from ZERO to ONE, and it is defined as
the average of 1 - | g_{1,i} - g_{2,i} | / 2
across the genome for the
first and second individuals and SNP i.
Return a list (class "snpgdsIBSClass"):
sample.id |
the sample ids used in the analysis |
snp.id |
the SNP ids used in the analysis |
ibs |
a matrix of IBS proportion, "# of samples" x "# of samples" |
Xiuwen Zheng
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # open an example dataset (HapMap)
genofile <- snpgdsOpen(snpgdsExampleFileName())
# perform identity-by-state calculations
ibs <- snpgdsIBS(genofile)
# perform multidimensional scaling analysis on
# the genome-wide IBS pairwise distances:
loc <- cmdscale(1 - ibs$ibs, k = 2)
x <- loc[, 1]; y <- loc[, 2]
race <- as.factor(read.gdsn(index.gdsn(genofile, "sample.annot/pop.group")))
plot(x, y, col=race, xlab = "", ylab = "", main = "cmdscale(IBS Distance)")
legend("topleft", legend=levels(race), text.col=1:nlevels(race))
# close the file
snpgdsClose(genofile)
|
Loading required package: gdsfmt
SNPRelate -- supported by Streaming SIMD Extensions 2 (SSE2)
Identity-By-State (IBS) analysis on genotypes:
Excluding 365 SNPs on non-autosomes
Excluding 1 SNP (monomorphic: TRUE, MAF: NaN, missing rate: NaN)
Working space: 279 samples, 8,722 SNPs
using 1 (CPU) core
IBS: the sum of all selected genotypes (0,1,2) = 2446510
Sun Jan 21 05:32:11 2018 (internal increment: 13056)
[..................................................] 0%, ETC: ---
[==================================================] 100%, completed in 0s
Sun Jan 21 05:32:11 2018 Done.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.