GRM: GRM object

GRMR Documentation

GRM object

Description

Class for storing RA data and associated functions for analyzing unstructured populations (e.g., populations with no known structure).

Details

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

Super class

GUSbase::RA -> GRM

Methods

Public methods

Inherited methods

Method new()

Method for initializing GRM object.

Usage
GRM$new(RAobj, ploid, indsubset, saminfo)
Arguments
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.


Method print()

Print output from a GRM object

Usage
GRM$print()
Details

Prints the summary information of the dataset and if any GRMs have been constructed, it also prints out summary information of the GRM runs.


Method computeGRM()

Construct a genomic relationship matrix (GRM)

Usage
GRM$computeGRM(
  name,
  method = "VanRaden",
  ep = 0,
  snpsubset = NULL,
  filter = list(MAF = NULL, MISS = NULL, PVALUE = NULL),
  ...
)
Arguments
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.

Details

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.


Method HWEtest()

Perform a Hardy–Weinberg Equilibrium (HWE) test for autopolyploids.

Usage
GRM$HWEtest(
  snpsubset = NULL,
  indsubset = NULL,
  nThreads = 1,
  para = NULL,
  EMpara = NULL
)
Arguments
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.

Details

The function calls the p_est_em and g_est_em functions in the GUSbase package to perform the HWE test.


Method removeGRM()

Delete a GRM run within the GRM object.

Usage
GRM$removeGRM(name)
Arguments
name

Name of the GRM run to delete.


Method PCA()

Produce a PCA plot of a constructed GRM

Usage
GRM$PCA(
  name,
  npc = 3,
  colour = NULL,
  shape = NULL,
  group.hover = NULL,
  interactive = FALSE
)
Arguments
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.

Details

The sample information used by this function is the information added by the '$addSampleInfo' method.


Method addSampleInfo()

Add sample information to the GRM object

Usage
GRM$addSampleInfo(samfile)
Arguments
samfile

Path to the file that contains the sample information to be loaded to GRM object.

Details

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.


Method removeSampleInfo()

Remove sample information from a GRM object

Usage
GRM$removeSampleInfo(name)
Arguments
name

Character vector of column names to remove from the sample information data.

Details

Note that columns 'ID' and 'Ploidy' cannot be deleted.


Method extractGRM()

Extract a GRM from a run.

Usage
GRM$extractGRM(name, IDvar = NULL)
Arguments
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.


Method writeGRM()

Write GRM to file.

Usage
GRM$writeGRM(name, filename, IDvar = NULL)
Arguments
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.

Details

The file format is currently a symmetric matrix with the IDs on the rows and columns.


Method clone()

The objects of this class are cloneable with this method.

Usage
GRM$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Author(s)

Timothy P. Bilton

See Also

makeGRM


tpbilton/GUSrelate documentation built on Feb. 20, 2025, 4:35 p.m.