G.matrix {ASRgenomics} | R Documentation |
Obtains the genomic matrix from SNP data for additive or dominant relationships
Description
Generates the genomic numerator relationship matrix for
additive (VanRaden or Yang) or dominant (Su or Vitezica) relationships.
Matrix provided is of the form
, with
individuals and
markers.
Individual and
marker names are assigned to
rownames
and colnames
, respectively.
SNP data is coded as 0, 1, 2 (integers or decimal numbers).
Missing values, if present, need to be specified.
Usage
G.matrix(
M = NULL,
method = "VanRaden",
na.string = "NA",
sparseform = FALSE,
digits = 8,
message = TRUE
)
Arguments
M |
A matrix with SNP data of form |
method |
The method considered for calculation of genomic matrix.
Options are: |
na.string |
A character that is interpreted as missing values (default = |
sparseform |
If |
digits |
Set up the number of digits used to round the output matrix (default = 8). |
message |
If |
Details
Note: If data is provided with missing values, it will process calculations of relationships on pairwise non-missing data.
It uses function Gmatrix
for calculations
from R package AGHmatrix (Amadeu et al. 2019).
Value
A list with one of these two elements:
G
: thematrix in full form (only if
sparseform = FALSE
).G.sparse
: thematrix in sparse form (only if
sparseform = TRUE
).
References
Amadeu, R.R., Cellon, C., Olmstead, J.W., Garcia, A.A.F, Resende, M.F.R. and P.R. Munoz. 2016. AGHmatrix: R package to construct relationship matrices for autotetraploid and diploid species: A blueberry example. The Plant Genome 9(3). doi: 10.3835/plantgenome2016.01.0009
Examples
# Example: Requesting a full matrix by VanRanden.
# Get G matrix.
G <- G.matrix(M = geno.apple, method = "VanRaden")$G
G[1:5, 1:5]
# Example: Requesting a sparse form by VanRanden.
# Get G matrix.
G <- G.matrix(M = geno.apple, method = "VanRaden", sparseform = TRUE)$G.sparse
head(G)
head(attr(G, "rowNames"))