Learn R Programming

SNPRelate (version 1.6.4)

snpgdsSNPListIntersect: Get a common SNP list between two SNP list objects

Description

Get a common SNP list by comparing their rs id, chromosome indices and positions.

Usage

snpgdsSNPListIntersect(snplist1, snplist2)

Arguments

snplist1
the first SNP list object snpgdsSNPListClass
snplist2
the second SNP list object snpgdsSNPListClass

Value

Return an object of snpgdsSNPListClass including the following components:
rs.id
SNP id
chromosome
SNP chromosome index
position
SNP physical position in basepair
allele
reference / non-ref alleles from the first SNP list object
afreq
allele frequency from the first SNP list object

See Also

snpgdsSNPList, snpgdsSNPListStrand

Examples

Run this code
# open an example dataset (HapMap)
genofile <- snpgdsOpen(snpgdsExampleFileName())

# to get a snp list object
snplist1 <- snpgdsSNPList(genofile)
snplist2 <- snpgdsSNPList(genofile)

# a common snp list
snplist <- snpgdsSNPListIntersect(snplist1, snplist2)

summary(snplist$afreq)

# close the file
snpgdsClose(genofile)

Run the code above in your browser using DataLab