GRM | R Documentation |
Class for storing RA data and associated functions for analyzing unstructured populations (e.g., populations with no known structure).
A genomic relationship matrix (GRM) object is created from the makeGRM
function and contains RA data,
various statistics of the dataset that have been computed, and functions (or methods)
for analyzing the data. Information in a GRM object are specific to constructing a genomic relationship matrix
GUSbase::RA
-> GRM
new()
Method for initializing GRM object.
GRM$new(RAobj, ploid, indsubset, saminfo)
RAobj
Existing RA object to use in initializing the GRM object.
ploid
Vector of integer values indicating the ploid levels of each individual.
indsubset
Vector of indices specifying which individuals from the RA object to retain.
saminfo
Data frame of sample information.
print()
Print output from a GRM object
GRM$print()
Prints the summary information of the dataset and if any GRMs have been constructed, it also prints out summary information of the GRM runs.
computeGRM()
Construct a genomic relationship matrix (GRM)
GRM$computeGRM( name, method = "VanRaden", ep = 0, snpsubset = NULL, filter = list(MAF = NULL, MISS = NULL, PVALUE = NULL), ... )
name
Specific name given to the run constructing the GRM.
method
Character value indicating which method to used to construct the GRM.
ep
Sequencing error rate. Can be a single value, a vector equal to the number of SNPs or a matrix the same dimension as the data
snpsubset
Vector of indices indicated which SNPs to retain to construct the GRM.
filter
Name list specifying the filtering criteria to be applied.
...
Not used currently.
The filtering criteria currently implemented are:
Minor allele frequency (MAF
): SNPs are discarded if their MAF is less than the threshold (default is NULL
)
Proportion of missing data (MISS
): SNPs are discarded if the proportion of individuals with no reads (e.g. missing genotype)
is greater than the threshold value (default is NULL
).
P-value from a HWE test(PVALUE
): SNPs are discarded if the p-value from the Hardy-Weinberg equilibrium test is less than
the threshold. (default is NULL
)
If a filtering criteria is set to NULL
, then no filtering in regard to
that threshold is applied.
Not that for the PVALUE
filter, the HWE test must first be run using the $HWEtest
method.
HWEtest()
Perform a Hardy–Weinberg Equilibrium (HWE) test for autopolyploids.
GRM$HWEtest( snpsubset = NULL, indsubset = NULL, nThreads = 1, para = NULL, EMpara = NULL )
snpsubset
Vector of SNP indices indicating which SNPs to do the HWE test on. Excluded SNPs are given a p-value of 0.
indsubset
Vector of indices of the samples indicating which samples to use in the HWE test.
nThreads
Integer value specifying the number of threads to use in the parallelization.
para
Starting values passed to the p_est_em
and g_est_em
functions.
EMpara
Convergence criteria passed to the p_est_em
and g_est_em
functions.
The function calls the p_est_em
and g_est_em
functions in the
GUSbase
package to perform the HWE test.
removeGRM()
Delete a GRM run within the GRM object.
GRM$removeGRM(name)
name
Name of the GRM run to delete.
PCA()
Produce a PCA plot of a constructed GRM
GRM$PCA( name, npc = 3, colour = NULL, shape = NULL, group.hover = NULL, interactive = FALSE )
name
Character value giving the name of the GRM run to extract the constructed GRM from.
npc
Integer number specifying the number of PCs to plot
colour
Character string specifying which column of the sample information to use to colour the points
shape
Character string specifying which column of the sample information to use to group the points based on point shape
group.hover
Character vector specifying which column(s) of the sample information to include in the hover information for the
interactive plots. Only used if interactive=TRUE
.
interactive
Logical value: If TRUE
, then an interactive plot using the plotly
package is produced.
Otherwise, a standard ggplot
is constructed.
The sample information used by this function is the information added by the '$addSampleInfo' method.
addSampleInfo()
Add sample information to the GRM object
GRM$addSampleInfo(samfile)
samfile
Path to the file that contains the sample information to be loaded to GRM object.
The sample information must contain a column 'ID' that has the ID of the samples and must match the IDs of the samples already in the GRM object. Any extra columns will be added to the existing sample information data.
Note that a column named 'Ploidy' can not be present in the file. If there are any columns already present then the function throw and error.
removeSampleInfo()
Remove sample information from a GRM object
GRM$removeSampleInfo(name)
name
Character vector of column names to remove from the sample information data.
Note that columns 'ID' and 'Ploidy' cannot be deleted.
extractGRM()
Extract a GRM from a run.
GRM$extractGRM(name, IDvar = NULL)
name
Character value specifying which run to extract the GRM from.
IDvar
Character value specifying which column of the sample information to use for
IDs in the GRM matrix. If IDvar=NULL
, then the 'ID' column is used.
writeGRM()
Write GRM to file.
GRM$writeGRM(name, filename, IDvar = NULL)
name
Character value specifying which run to write the GRM from.
filename
Character value giving the name of the output file.
IDvar
Character value specifying which column of the sample information to use for
IDs in the GRM matrix. If IDvar=NULL
, then the 'ID' column is used.
The file format is currently a symmetric matrix with the IDs on the rows and columns.
clone()
The objects of this class are cloneable with this method.
GRM$clone(deep = FALSE)
deep
Whether to make a deep clone.
Timothy P. Bilton
makeGRM
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.