Learn R Programming

SNPRelate (version 1.6.4)

snpgdsFst: F-statistics (fixation indices)

Description

Calculate relatedness measures F-statistics (also known as fixation indices) for given populations

Usage

snpgdsFst(gdsobj, population, method=c("W&H02", "W&C84"), sample.id=NULL, snp.id=NULL, autosome.only=TRUE, remove.monosnp=TRUE, maf=NaN, missing.rate=NaN, with.id=FALSE, verbose=TRUE)

Arguments

gdsobj
an object of class SNPGDSFileClass, a SNP GDS file
population
a factor, indicating population information for each individual
method
"W&H02" -- relative beta estimator in Weir&Hill 2002, "W&C84" -- Fst estimator in Weir&Cockerham 1984
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 TRUE, use autosomal SNPs only; if it is a numeric or character value, keep SNPs according to the specified chromosome
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 "
with.id
if TRUE, the returned value with sample.id and sample.id
verbose
if TRUE, show information

Value

Return a list:
sample.id
the sample ids used in the analysis
snp.id
the SNP ids used in the analysis
Fst
Fst estimator
Beta
Beta matrix

Details

The minor allele frequency and missing rate for each SNP passed in snp.id are calculated over all the samples in sample.id.

References

Weir, B. S. & Cockerham, C. C. Estimating F-statistics for the analysis of population structure. (1984).

Weir, B. S. & Hill, W. G. Estimating F-statistics. Annual review of genetics 36, 721-50 (2002).

Examples

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

group <- as.factor(read.gdsn(index.gdsn(
    genofile, "sample.annot/pop.group")))

# Fst estimation
snpgdsFst(genofile, population=group, method="W&H02")

# or
snpgdsFst(genofile, population=group, method="W&C84")


# close the genotype file
snpgdsClose(genofile)

Run the code above in your browser using DataLab