an object of class SNPGDSFileClass,
a SNP GDS file
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
FUN
the user-defined function, see details
winsize
the size of sliding window
shift
the amount of shifting the sliding window
unit
"basepair" – winsize and shift are
applied with SNP coordinate of basepair; "locus" –
winsize and shift are applied according to the SNP order
in the GDS file
winstart
NULL – no specific starting position; an integer
– a starting position for all chromosomes; or a vector of integer
– the starting positions for each chromosome
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 "<= missing.rate" only; if NaN,
no missing threshold
as.is
save the value returned from FUN as "list" or
"numeric"; "array" is equivalent to "numeric" except some cases,
see details
with.id
"snp.id", "snp.id.in.window" or "none"
num.thread
the number of (CPU) cores used; if NA, detect
the number of cores automatically
verbose
if TRUE, show information
...
optional arguments to FUN
Details
If FUN="snpgdsFst", two additional arguments "population" and
"method" should be specified. "population" and "method"
are defined in snpgdsFst. "as.is" could be "list" (returns
a list of the values from snpgdsFst), "numeric" (
population-average Fst, returns a vector) or "array" (population-average and
-specific Fst, returns a ‘# of pop + 1’-by-‘# of windows’ matrix, and the first
row is population-average Fst).
If FUN="snpgdsSNPRateFreq", .
Value
Return a list
Author(s)
Xiuwen Zheng
Examples
# open an example dataset (HapMap)
genofile <- snpgdsOpen(snpgdsExampleFileName())
# sliding windows
rv <- snpgdsSlidingWindow(genofile, winsize=500000, shift=100000,
FUN=function(...) NULL)
# plot
plot(rv$chr1.num, ylab="# of SNPs in the sliding window")
# close the genotype file
snpgdsClose(genofile)
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(SNPRelate)
Loading required package: gdsfmt
SNPRelate -- supported by Streaming SIMD Extensions 2 (SSE2)
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/SNPRelate/snpgdsSlidingWindow.Rd_%03d_medium.png", width=480, height=480)
> ### Name: snpgdsSlidingWindow
> ### Title: Sliding window
> ### Aliases: snpgdsSlidingWindow
> ### Keywords: GDS GWAS
>
> ### ** Examples
>
> # open an example dataset (HapMap)
> genofile <- snpgdsOpen(snpgdsExampleFileName())
>
> # sliding windows
> rv <- snpgdsSlidingWindow(genofile, winsize=500000, shift=100000,
+ FUN=function(...) NULL)
Sliding Window Analysis:
Excluding 8 SNPs (monomorphic: TRUE, < MAF: NaN, or > missing rate: NaN)
Working space: 279 samples, 9080 SNPs
using 1 (CPU) core
Window size: 500000, shift: 100000 (basepair)
Chromosome Set: 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23
Wed Jul 6 05:34:52 2016, Chromosome 1 (716 SNPs), 2448 windows
Wed Jul 6 05:34:52 2016, Chromosome 2 (742 SNPs), 2416 windows
Wed Jul 6 05:34:52 2016, Chromosome 3 (609 SNPs), 1985 windows
Wed Jul 6 05:34:52 2016, Chromosome 4 (562 SNPs), 1894 windows
Wed Jul 6 05:34:52 2016, Chromosome 5 (566 SNPs), 1797 windows
Wed Jul 6 05:34:52 2016, Chromosome 6 (565 SNPs), 1694 windows
Wed Jul 6 05:34:52 2016, Chromosome 7 (472 SNPs), 1573 windows
Wed Jul 6 05:34:52 2016, Chromosome 8 (488 SNPs), 1445 windows
Wed Jul 6 05:34:52 2016, Chromosome 9 (416 SNPs), 1393 windows
Wed Jul 6 05:34:52 2016, Chromosome 10 (483 SNPs), 1343 windows
Wed Jul 6 05:34:52 2016, Chromosome 11 (447 SNPs), 1338 windows
Wed Jul 6 05:34:52 2016, Chromosome 12 (427 SNPs), 1316 windows
Wed Jul 6 05:34:52 2016, Chromosome 13 (344 SNPs), 948 windows
Wed Jul 6 05:34:52 2016, Chromosome 14 (281 SNPs), 847 windows
Wed Jul 6 05:34:52 2016, Chromosome 15 (262 SNPs), 774 windows
Wed Jul 6 05:34:52 2016, Chromosome 16 (278 SNPs), 873 windows
Wed Jul 6 05:34:52 2016, Chromosome 17 (207 SNPs), 773 windows
Wed Jul 6 05:34:52 2016, Chromosome 18 (266 SNPs), 753 windows
Wed Jul 6 05:34:52 2016, Chromosome 19 (120 SNPs), 627 windows
Wed Jul 6 05:34:52 2016, Chromosome 20 (229 SNPs), 602 windows
Wed Jul 6 05:34:52 2016, Chromosome 21 (126 SNPs), 311 windows
Wed Jul 6 05:34:52 2016, Chromosome 22 (116 SNPs), 312 windows
Wed Jul 6 05:34:52 2016, Chromosome 23 (358 SNPs), 1507 windows
>
> # plot
> plot(rv$chr1.num, ylab="# of SNPs in the sliding window")
>
> # close the genotype file
> snpgdsClose(genofile)
>
>
>
>
>
> dev.off()
null device
1
>