Description Usage Arguments Value Author(s) See Also Examples
View source: R/SNPRelate_Main.r
To create a GDS file of genotypes from a specified GDS file.
1 2 | snpgdsCreateGenoSet(src.fn, dest.fn, sample.id=NULL, snp.id=NULL,
snpfirstdim=NULL, compress.annotation="ZIP.max", compress.geno="", verbose=TRUE)
|
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 |
compress.geno |
the compression method for the variable |
verbose |
if TRUE, show information |
None.
Xiuwen Zheng
snpgdsCreateGeno
, snpgdsCombineGeno
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.