bed.matrix-class: Class '"bed.matrix"'

bed.matrix-classR 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 and pheno = Phenotype. Can also contain individuals statistic, for example: N0, N1 and N2 = 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 and N2 = 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 or NULL for allelic frequencies (allèle A2).

mu:

vector or NULL for genotype means (usually mu = 2*p).

sigma:

vector or NULL for genotypic standard deviation

standardize_p:

logical. If TRUE, the genotype matrix is standardized using means 2*p and genotypic standard deviation sqrt(2*p*(1-p))

standardize_mu_sigma:

logical. If TRUE, the genotype matrix is standardize using means mu and genotypic standard deviation sigma.

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 new bed.matrix).

%*%

signature(x = "bed.matrix", y = "matrix" or "vector"):
Right matrix multiplication of the genotype matrix (possibly centered and reduced) with a matrix or a vector.

%*%

signature(x = "matrix" or "vector", y = "bed.matrix"):
Left matrix multiplication of the genotype matrix with a matrix or a vector.

as.matrix

signature(x = "bed.matrix"):
Convert a bed.matrix into a matrix. The resulting matrix can be huge, use this method only for a small bed.matrix!

standardize

signature(x = "bed.matrix"):
Get the standardize parameter of bed.matrix. Can be "none", "p" or "mu_sigma".

standardize<-

signature(x = "bed.matrix"):
Set the standardize parameter of a bed.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 a bed.matrix object.

mu

signature(x = "bed.matrix"):
Get the mu slot of a bed.matrix.

mu<-

signature(x = "bed.matrix"):
Set the mu slot of a bed.matrix.

p

signature(x = "bed.matrix"):
Get the p slot of a bed.matrix.

p<-

signature(x = "bed.matrix"):
Set the p slot of a bed.matrix.

show

signature(object = "bed.matrix"):
Displays basic information about a bed.matrix.

sigma

signature(x = "bed.matrix"):
Get the sigma slot of a bed.matrix.

sigma<-

signature(x = "bed.matrix"):
Set the sigma slot of a bed.matrix.

cbind

signature(... = "bed.matrix"):
Combine a sequence of bed.matrix by columns.

rbind

signature(... = "bed.matrix"):
Combine a sequence of bed.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)

gaston documentation built on May 29, 2024, 7:33 a.m.