| 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.framecontaining 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,N1andN2= Number of genotypes equal to 0, 1 and 2 respectively,NAs= Number of missing genotypes,callrate= Individual callrate. snps:-
data.framecontaining 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,N1andN2= 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:-
vectororNULLfor allelic frequencies (allèleA2). mu:-
vectororNULLfor genotype means (usuallymu = 2*p). sigma:-
vectororNULLfor genotypic standard deviation standardize_p:-
logical. IfTRUE, the genotype matrix is standardized using means2*pand genotypic standard deviationsqrt(2*p*(1-p)) standardize_mu_sigma:-
logical. IfTRUE, the genotype matrix is standardize using meansmuand 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 amatrixor avector.- %*%
signature(x = "matrix" or "vector", y = "bed.matrix"):
Left matrix multiplication of the genotype matrix with amatrixor avector.- as.matrix
signature(x = "bed.matrix"):
Convert abed.matrixinto 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.matrixobject.- mu
signature(x = "bed.matrix"):
Get themuslot of abed.matrix.- mu<-
signature(x = "bed.matrix"):
Set themuslot of abed.matrix.- p
signature(x = "bed.matrix"):
Get thepslot of abed.matrix.- p<-
signature(x = "bed.matrix"):
Set thepslot of abed.matrix.- show
signature(object = "bed.matrix"):
Displays basic information about abed.matrix.- sigma
signature(x = "bed.matrix"):
Get thesigmaslot of abed.matrix.- sigma<-
signature(x = "bed.matrix"):
Set thesigmaslot of abed.matrix.- cbind
signature(... = "bed.matrix"):
Combine a sequence ofbed.matrixby columns.- rbind
signature(... = "bed.matrix"):
Combine a sequence ofbed.matrixby 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)