Converts other objects to
BGData objects by loading supplementary
phenotypes and map files referenced by the object to be used for the sample
information and variant information, respectively.
Currently supported are
BEDMatrix objects, plain or nested in
1 2 3 4 5 6 7 8 9 10 11 12
as.BGData(x, alternatePhenotypeFile = NULL, ...) ## S3 method for class 'BEDMatrix' as.BGData(x, alternatePhenotypeFile = NULL, ...) ## S3 method for class 'ColumnLinkedMatrix' as.BGData(x, alternatePhenotypeFile = NULL, ...) ## S3 method for class 'RowLinkedMatrix' as.BGData(x, alternatePhenotypeFile = NULL, ...)
An object. Currently supported are
Path to an alternate phenotype file.
Additional arguments to the
The .ped and .raw formats only allows for a single phenotype. If more
phenotypes are required it is possible to store them in an
file. The path to such a file can be provided with
alternatePhenotypeFile and will be merged with the existing sample
information. The first and second columns of that file must contain family
and within-family IDs, respectively.
BEDMatrix objects: If a .fam file (which corresponds to the
first six columns of a .ped or .raw file) of the same name and in the same
directory as the .bed file exists, the sample information will be populated
with the data stored in that file. Otherwise a stub that only contains an
IID column populated with the rownames of
geno(x) will be
generated. The same will happen for a .bim file for the variant
ColumnLinkedMatrix objects: See the case for
objects, but only the .fam file of the first node of the
LinkedMatrix will be read and used for the sample information, and
the .bim files of all nodes will be combined and used for the variant
readRAW() to convert text files to
ColumnLinkedMatrix-class for more information
on the above mentioned classes.
fread to learn more about extra arguments that
can be passed via
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# Path to example data path <- system.file("extdata", package = "BGData") # Convert a single BEDMatrix object to a BGData object chr1 <- BEDMatrix::BEDMatrix(paste0(path, "/chr1.bed")) bg1 <- as.BGData(chr1) # Convert multiple BEDMatrix objects in a ColumnLinkedMatrix to a BGData object chr2 <- BEDMatrix::BEDMatrix(paste0(path, "/chr2.bed")) chr3 <- BEDMatrix::BEDMatrix(paste0(path, "/chr3.bed")) clm <- ColumnLinkedMatrix(chr1, chr2, chr3) bg2 <- as.BGData(clm) # Load additional (alternate) phenotypes bg3 <- as.BGData(clm, alternatePhenotypeFile = paste0(path, "/pheno.txt"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.