snp_readBed | R Documentation |
Functions to read bed/bim/fam files into a bigSNP.
snp_readBed(bedfile, backingfile = sub_bed(bedfile))
snp_readBed2(
bedfile,
backingfile = sub_bed(bedfile),
ind.row = rows_along(obj.bed),
ind.col = cols_along(obj.bed),
ncores = 1
)
bedfile |
Path to file with extension ".bed" to read. You need the corresponding ".bim" and ".fam" in the same directory. |
backingfile |
The path (without extension) for the backing files for the cache of the bigSNP object. Default takes the bedfile without the ".bed" extension. |
ind.row |
An optional vector of the row indices (individuals) that
are used. If not specified, all rows are used. |
ind.col |
An optional vector of the column indices (SNPs) that are used.
If not specified, all columns are used. |
ncores |
Number of cores used. Default doesn't use parallelism.
You may use |
For more information on these formats, please visit
PLINK webpage.
For other formats, please use PLINK to convert them in bedfiles,
which require minimal space to store and are faster to read. For example,
to convert from a VCF file, use the --vcf
option. See snp_plinkQC.
The path to the RDS file that stores the bigSNP
object.
Note that this function creates one other file which stores the values of
the Filebacked Big Matrix.
You shouldn't read from PLINK files more than once. Instead, use
snp_attach to load the "bigSNP" object in any R session from backing files.
(bedfile <- system.file("extdata", "example.bed", package = "bigsnpr"))
# Reading the bedfile and storing the data in temporary directory
rds <- snp_readBed(bedfile, backingfile = tempfile())
# Loading the data from backing files
test <- snp_attach(rds)
str(test)
dim(G <- test$genotypes)
G[1:8, 1:8]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.