bed.matrix-class {gaston} | R Documentation |
Class "bed.matrix"
Description
S4 class for SNP genotype matrices
Objects from the Class
Objects can be created by calls of the form new("bed.matrix", ...)
.
Slots
ped
:-
data.frame
containing information for each individual:famid
= Family ID,id
= Individual ID,father
= Father ID,mother
= Mother ID,sex
= Sex andpheno
= Phenotype. Can also contain individuals statistic, for example:N0
,N1
andN2
= Number of genotypes equal to 0, 1 and 2 respectively,NAs
= Number of missing genotypes,callrate
= Individual callrate. snps
:-
data.frame
containing information for each SNP:chr
= Chromosome,id
= SNP ID,dist
= Genetic Distance,pos
= Physical position,A1
= Reference Allele,A2
= Alternative Allele. Can also contain SNPs statistic, for example:N0
,N1
andN2
= Number of genotypes equal to 0, 1 and 2 repectively,NAs
= Number of missing genotypes,callrate
= SNP callrate,maf
= Minor allele frequency),hz
= heterozygosity bed
:-
externalptr
(pointing to the genotype matrix). p
:-
vector
orNULL
for allelic frequencies (allèleA2
). mu
:-
vector
orNULL
for genotype means (usuallymu = 2*p
). sigma
:-
vector
orNULL
for genotypic standard deviation standardize_p
:-
logical
. IfTRUE
, the genotype matrix is standardized using means2*p
and genotypic standard deviationsqrt(2*p*(1-p))
standardize_mu_sigma
:-
logical
. IfTRUE
, the genotype matrix is standardize using meansmu
and genotypic standard deviationsigma
.
For more details please check the vignette.
Methods
- [
signature(x = "bed.matrix", i = "numeric" or "logical" or "missing",
j = "numeric" or "logical" or "missing", drop = "missing")
:
Extract a sub-matrix (a newbed.matrix
).- %*%
signature(x = "bed.matrix", y = "matrix" or "vector")
:
Right matrix multiplication of the genotype matrix (possibly centered and reduced) with amatrix
or avector
.- %*%
signature(x = "matrix" or "vector", y = "bed.matrix")
:
Left matrix multiplication of the genotype matrix with amatrix
or avector
.- as.matrix
signature(x = "bed.matrix")
:
Convert abed.matrix
into amatrix
. The resulting matrix can be huge, use this method only for a small bed.matrix!- standardize
signature(x = "bed.matrix")
:
Get the standardize parameter ofbed.matrix
. Can be "none", "p" or "mu_sigma".- standardize<-
signature(x = "bed.matrix")
:
Set the standardize parameter of abed.matrix
.- dim
signature(x = "bed.matrix")
:
Get the number of individuals (rows) and the number of SNPs (columns).- head
signature(x = "bed.matrix")
:
Print the head of the genotype matrix of abed.matrix
object.- mu
signature(x = "bed.matrix")
:
Get themu
slot of abed.matrix
.- mu<-
signature(x = "bed.matrix")
:
Set themu
slot of abed.matrix
.- p
signature(x = "bed.matrix")
:
Get thep
slot of abed.matrix
.- p<-
signature(x = "bed.matrix")
:
Set thep
slot of abed.matrix
.- show
signature(object = "bed.matrix")
:
Displays basic information about abed.matrix
.- sigma
signature(x = "bed.matrix")
:
Get thesigma
slot of abed.matrix
.- sigma<-
signature(x = "bed.matrix")
:
Set thesigma
slot of abed.matrix
.- cbind
signature(... = "bed.matrix")
:
Combine a sequence ofbed.matrix
by columns.- rbind
signature(... = "bed.matrix")
:
Combine a sequence ofbed.matrix
by rows.
Author(s)
Hervé Perdry and Claire Dandine-Roulland
See Also
read.bed.matrix
, write.bed.matrix
,
set.stats
, select.snps
, select.inds
, GRM
Examples
showClass("bed.matrix")
# Conversion example
data(LCT)
x1 <- as(LCT.gen, "bed.matrix")
x1
head(x1@ped)
head(x1@snps)
# the function as.bed.matrix is an alternative
x2 <- as.bed.matrix(LCT.gen, LCT.fam, LCT.bim)
x2
head(x2@ped)
head(x2@snps)