snpgdsSNPListIntersect | R Documentation |
Get a common SNP list by comparing their snp id, chromosome, positions and allele frequency if needed.
snpgdsSNPListIntersect(snplist1, snplist2, ..., method=c("position", "exact"),
na.rm=TRUE, same.strand=FALSE, verbose=TRUE)
snplist1 |
the SNP list object |
snplist2 |
the SNP list object |
... |
the other SNP list objects |
method |
|
na.rm |
if TRUE, remove mismatched alleles |
same.strand |
if TRUE, assuming the alleles on the same strand |
verbose |
if TRUE, show information |
Return a list of snpgdsSNPListClass
including the following
components:
idx1 |
the indices of common SNPs in the first GDS file |
idx2 |
the indices of common SNPs in the second GDS file |
idx... |
|
idx\code{n} |
the indices of common SNPs in the n-th GDS file |
flag2 |
an integer vector, flip flag for each common SNP for the
second GDS file (assuming a value |
flag... |
|
flag\code{n} |
flip flag for each common SNP for the n-th GDS file |
Xiuwen Zheng
snpgdsSNPList
# open an example dataset (HapMap)
genofile <- snpgdsOpen(snpgdsExampleFileName())
# to get a snp list object
snplist1 <- snpgdsSNPList(genofile)
snplist2 <- snpgdsSNPList(genofile)
# a common snp list, exactly matching
v <- snpgdsSNPListIntersect(snplist1, snplist2)
names(v)
# "idx1" "idx2"
# a common snp list, matching by position
v <- snpgdsSNPListIntersect(snplist1, snplist2, method="pos")
names(v)
# "idx1" "idx2" "flag2"
table(v$flag2, exclude=NULL)
# close the file
snpgdsClose(genofile)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.