setModelCovars: Set R&R GDM covariate paths

View source: R/RandR_webtool_setCovars.R

setModelCovarsR Documentation

Set R&R GDM covariate paths

Description

Set paths to covariate files within an R&R GDM model object to the standard paths for the webtool

Usage

setModelCovars(
  thisModel,
  thisTaxon = NULL,
  envDataPath = NULL,
  qDataPath = NULL,
  numQfiles = 0,
  newThreshold = NULL,
  trace = FALSE
)

Arguments

thisModel

Character. Full path the .Rd file for an R&R GDM model object.

thisTaxon

Character. Name of the taxon corresponding to the model given in thisModel.

envDataPath

Character. OPTIONAL. Full path to the folder of environmental covariate layers. When environmental covariates are present in the model object, a default of NULL sets the path to the standard Linux environment on which the webtool operates (i.e. '/home/RandR/envData/eastOZ').

qDataPath

Character. OPTIONAL. Full path to the folder of environmental ancestral mixing coefficent (Q-data covariate) layers. When Q covariates are present in the model object, a default of NULL sets the path to the standard Linux environment on which the webtool operates (i.e. '/home/RandR/qData/eastOZ').

numQfiles

Numeric. The number of Q-files to be included for this GDM.

trace

Logical. Should some hopefully useful information be output to the terminal? Default is FALSE.

threshold

Numeric. A value between 0 and 1 to replace the threshold value of the model object. Default of NULL leaves the threshold unchanged.

Details

The R&R webtool allows the use of two types of covariate files: Environmental covariates, and ancestry mixing coefficients (Q-files).

Environmental covariates are stored in /home/RandR/envData with sub-folders for geographically-defined extents. At present, the only sub-folder used is "eastOZ".

Q-file covariates are stored on the server in /home/RandR/qData, and there is also, at present, only one sub-folder 'eastOZ'.

This function looks at the covariates listed for the fitted GDM model, confirms that the matching covariate files are present in the necessary location, and then sets the necessary elements of the model object to load raster stacks of covariates from the appropriate folders described above.

A new value for the threshold applied to the GIS raster output by the model to create the "local" genetic region or provenance can be set by passing a new value in the parameter threshold. Threshold values must be between 0 and 1; a value passed into the function outside this range causes the function to stop. The default value of NULL leaves the threshold value unchanged.

The updated model object is then saved over the original model object. For safety, it is recommended that a copy is archived in a folder not used by this function.


peterbat1/RandR.webtool.dataPrep documentation built on Jan. 7, 2023, 3:05 p.m.