snpgdsCreateGenoSet: Create a SNP genotype dataset from a GDS file

Description Usage Arguments Value Author(s) See Also Examples

View source: R/SNPRelate_Main.r

Description

To create a GDS file of genotypes from a specified GDS file.

Usage

1
2
snpgdsCreateGenoSet(src.fn, dest.fn, sample.id=NULL, snp.id=NULL,
	snpfirstdim=NULL, compress.annotation="ZIP.max", compress.geno="", verbose=TRUE)

Arguments

src.fn

the file name of a specified GDS file

dest.fn

the file name of output 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

snpfirstdim

if TRUE, genotypes are stored in the individual-major mode, (i.e, list all SNPs for the first individual, and then list all SNPs for the second individual, etc)

compress.annotation

the compression method for the variables except genotype

compress.geno

the compression method for the variable genotype

verbose

if TRUE, show information

Value

None.

Author(s)

Xiuwen Zheng

See Also

snpgdsCreateGeno, snpgdsCombineGeno

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# open an example dataset (HapMap)
(genofile <- openfn.gds(snpgdsExampleFileName()))
# + 	[   ]
# |--+ sample.id	[ dFStr8 279 ZIP(23.10%) ]
# |--+ snp.id	[ dInt32 45440 ZIP(34.60%) ]
# |--+ snp.rs.id	[ dFStr8 45440 ZIP(41.05%) ]
# |--+ snp.position	[ dInt32 45440 ZIP(94.25%) ]
# |--+ snp.chromosome	[ dInt32 45440 ZIP(0.14%) ]
# |--+ snp.allele	[ dFStr8 45440 ZIP(13.36%) ]
# |--+ genotype	[ dBit2 45440x279 ]
# |--+ sample.annot	[   ] *
# |  |--+ sex	[ dFStr8 279 ZIP(28.32%) ] *
# |  |--+ pop.group	[ dFStr8 279 ZIP(7.89%) ] *

snpset <- unlist(snpgdsLDpruning(genofile))
length(snpset)
# 43518

# close the genotype file
closefn.gds(genofile)

snpgdsCreateGenoSet(snpgdsExampleFileName(), "test.gds", snp.id=snpset)

####################################################
# check

(gfile <- openfn.gds("test.gds"))
# + 	[   ]
# |--+ sample.id	[ dFStr8 279 ZIP(23.10%) ]
# |--+ snp.id	[ dInt32 43518 ZIP(34.61%) ]
# |--+ snp.rs.id	[ dFStr8 43518 ZIP(41.09%) ]
# |--+ snp.position	[ dInt32 43518 ZIP(94.16%) ]
# |--+ snp.chromosome	[ dInt32 43518 ZIP(0.14%) ]
# |--+ snp.allele	[ dFStr8 43518 ZIP(13.37%) ]
# |--+ genotype	[ dBit2 43518x279 ] *

closefn.gds(gfile)

SNPRelate documentation built on May 2, 2019, 4:56 p.m.