Description Usage Arguments Details Value Author(s) References See Also Examples
Convert a PLINK binary ped file to a GDS file.
1 2 3 4 |
bed.fn |
the file name of binary file, genotype information |
fam.fn |
the file name of first six columns of |
bim.fn |
the file name of extended MAP file: two extra columns =
allele names; if it is missing, ".bim" is added to |
out.gdsfn |
the output file name of GDS file |
family |
if |
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 GDS variables,
except "genotype"; optional values are defined in the function
|
compress.geno |
the compression method for "genotype"; optional
values are defined in the function |
option |
|
cvt.chr |
|
cvt.snpid |
|
verbose |
if TRUE, show information |
GDS – Genomic Data Structures, the extended file name used for storing genetic data, and the file format is used in the gdsfmt package.
BED – the PLINK binary ped format.
The user could use option
to specify the range of code for autosomes.
For humans there are 22 autosomes (from 1 to 22), but dogs have 38 autosomes.
Note that the default settings are used for humans. The user could call
option = snpgdsOption(autosome.end=38)
for importing the BED file of dog.
It also allow define new chromosome coding, e.g.,
option = snpgdsOption(Z=27)
.
Return the file name of GDS format with an absolute path.
Xiuwen Zheng
Purcell S, Neale B, Todd-Brown K, Thomas L, Ferreira MAR, Bender D, Maller J, Sklar P, de Bakker PIW, Daly MJ & Sham PC. 2007. PLINK: a toolset for whole-genome association and population-based linkage analysis. American Journal of Human Genetics, 81.
snpgdsOption
, snpgdsPED2GDS
,
snpgdsGDS2PED
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | # PLINK BED files
bed.fn <- system.file("extdata", "plinkhapmap.bed.gz", package="SNPRelate")
fam.fn <- system.file("extdata", "plinkhapmap.fam.gz", package="SNPRelate")
bim.fn <- system.file("extdata", "plinkhapmap.bim.gz", package="SNPRelate")
# convert
snpgdsBED2GDS(bed.fn, fam.fn, bim.fn, "HapMap.gds")
# open
genofile <- snpgdsOpen("HapMap.gds")
genofile
# close
snpgdsClose(genofile)
# delete the temporary file
unlink("HapMap.gds", force=TRUE)
|
Loading required package: gdsfmt
SNPRelate -- supported by Streaming SIMD Extensions 2 (SSE2)
Start snpgdsBED2GDS ...
BED file: "/usr/local/lib/R/site-library/SNPRelate/extdata/plinkhapmap.bed.gz" in the SNP-major mode (Sample X SNP)
FAM file: "/usr/local/lib/R/site-library/SNPRelate/extdata/plinkhapmap.fam.gz", DONE.
BIM file: "/usr/local/lib/R/site-library/SNPRelate/extdata/plinkhapmap.bim.gz", DONE.
Wed Nov 28 07:33:58 2018 store sample id, snp id, position, and chromosome.
start writing: 60 samples, 5000 SNPs ...
Wed Nov 28 07:33:58 2018 0%
Wed Nov 28 07:33:58 2018 100%
Wed Nov 28 07:33:58 2018 Done.
Optimize the access efficiency ...
Clean up the fragments of GDS file:
open the file 'HapMap.gds' (104.6K)
# of fragments: 38
save to 'HapMap.gds.tmp'
rename 'HapMap.gds.tmp' (104.4K, reduced: 240B)
# of fragments: 18
File: /work/tmp/HapMap.gds (104.4K)
+ [ ] *
|--+ sample.id { Str8 60 ZIP_ra(38.1%), 190B }
|--+ snp.id { Int32 5000 ZIP_ra(36.2%), 7.1K }
|--+ snp.position { Int32 5000 ZIP_ra(95.1%), 18.6K }
|--+ snp.chromosome { UInt8 5000 ZIP_ra(1.82%), 98B } *
|--+ snp.allele { Str8 5000 ZIP_ra(16.7%), 3.3K }
|--+ genotype { Bit2 60x5000, 73.2K } *
\--+ sample.annot [ data.frame ] *
|--+ sex { Str8 60 ZIP_ra(36.7%), 29B }
\--+ phenotype { Int32 60 ZIP_ra(10.8%), 33B }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.