trialInfo: R6 Class representing information of field trial

trialInfoR Documentation

R6 Class representing information of field trial

Description

traitInfo object store specific information of field trial.

Public fields

population

[population class] population class object

herit

[numeric] Heritability for each trait (plot-based/line-based)

nRep

[numeric] Replication of the field trial (common to all traits)

multiTraitsAsEnvs

[logical] Treat multiple traits as multiple environments or not

envSpecificEffects

[numeric] Effects specific to each environments / treatments. If 'multiTraitsAsEnvs = FALSE', envSpecificEffects will be 0 for all traits.

residCor

[matrix] Residual correlation between traits

seedResid

[numeric] Random seed for selecting residuals

trueGeneticVar

[numeric] True genetic variance

trueGeneticCov

[matrix] True genetic covariance between traits

trueGeneticCor

[matrix] True genetic correlation between traits

residVar

[numeric] Residual variance for each trait

residCov

[matrix] Residual covariance between traits

resid

[array] individual x traits x replication (3-dimensional array) of residuals

trueResidVar

[numeric] True residual variance for each trait

trueResidCov

[matrix] True residual covariance between traits

trueResidCor

[matrix] True residual correlation between traits

trueHeritLine

[numeric] True heritability of each trait (plot-based/line-based)

trueHeritInd

[numeric] True heritability of each trait (individual-based)

Methods

Public methods


Method new()

Create a new trialInfo object.

Usage
trialInfo$new(
  population,
  herit = NULL,
  nRep = NULL,
  multiTraitsAsEnvs = FALSE,
  envSpecificEffects = NULL,
  residCor = NULL,
  seedResid = NA
)
Arguments
population

[population class] population class object

herit

[numeric] Heritability for each trait (plot-based/line-based)

nRep

[numeric] Replication of the field trial (common to all traits)

multiTraitsAsEnvs

[logical] Treat multiple traits as multiple environments or not

envSpecificEffects

[numeric] Effects specific to each environments / treatments. If 'multiTraitsAsEnvs = FALSE', envSpecificEffects will be 0 for all traits.

residCor

[matrix] Residual correlation between traits

seedResid

[numeric] Random seed for selecting residuals

Returns

A new 'trialInfo' object.

Examples
### create simulation information
mySimInfo <- simInfo$new(simName = "Simulation Example",
                         simGeno = TRUE,
                         simPheno = TRUE,
                         nSimGeno = 1,
                         nSimPheno = 3,
                         nCoreMax = 4,
                         nCorePerGeno = 1,
                         nCorePerPheno = 3,
                         saveDataFileName = NULL)
### create specie information
mySpec <- specie$new(nChr = 3,
                     lChr = c(100, 150, 200),
                     specName = "Example 1",
                     ploidy = 2,
                     mutRate = 10^-8,
                     recombRate = 10^-6,
                     chrNames = c("C1", "C2", "C3"),
                     nLoci = 100,
                     recombRateOneVal = FALSE,
                     effPopSize = 100,
                     simInfo = mySimInfo,
                     verbose = TRUE)
### create lociInfo object
myLoci <- lociInfo$new(genoMap = NULL, specie = mySpec)
plot(myLoci, alpha = 0.1)
### create traitInfo object
myTrait <- traitInfo$new(lociInfo = myLoci,
                         nMarkers = 80,
                         nTraits = 3,
                         nQTLs = c(4, 8, 3),
                         actionTypeEpiSimple = TRUE,
                         qtlOverlap = TRUE,
                         nOverlap = c(2, 3, 0),
                         effCor = 0.1,
                         propDomi = 0.2,
                         interactionMean = c(4, 1, 2))
### create simulated population
simulatedPop <- createPop(geno = NULL,
                          haplo = NULL,
                          lociInfo = myLoci,
                          traitInfo = myTrait,
                          founderIsInitPop = TRUE,
                          popName = "First Population",
                          verbose = FALSE)
### create trialInfo object
myTrial <- trialInfo$new(population = simulatedPop,
                         herit = c(0.4, 0.7, 0.2),
                         nRep = 2,
                         multiTraitsAsEnvs = FALSE,
                         residCor = 0.3)
simulatedPop$inputTrialInfo(trialInfoNow = myTrial)


Method print()

Display summary information about the object: traitInfo

Usage
trialInfo$print()

Method clone()

The objects of this class are cloneable with this method.

Usage
trialInfo$clone(deep = FALSE)
Arguments
deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `trialInfo$new`
## ------------------------------------------------

### create simulation information
mySimInfo <- simInfo$new(simName = "Simulation Example",
                         simGeno = TRUE,
                         simPheno = TRUE,
                         nSimGeno = 1,
                         nSimPheno = 3,
                         nCoreMax = 4,
                         nCorePerGeno = 1,
                         nCorePerPheno = 3,
                         saveDataFileName = NULL)
### create specie information
mySpec <- specie$new(nChr = 3,
                     lChr = c(100, 150, 200),
                     specName = "Example 1",
                     ploidy = 2,
                     mutRate = 10^-8,
                     recombRate = 10^-6,
                     chrNames = c("C1", "C2", "C3"),
                     nLoci = 100,
                     recombRateOneVal = FALSE,
                     effPopSize = 100,
                     simInfo = mySimInfo,
                     verbose = TRUE)
### create lociInfo object
myLoci <- lociInfo$new(genoMap = NULL, specie = mySpec)
plot(myLoci, alpha = 0.1)
### create traitInfo object
myTrait <- traitInfo$new(lociInfo = myLoci,
                         nMarkers = 80,
                         nTraits = 3,
                         nQTLs = c(4, 8, 3),
                         actionTypeEpiSimple = TRUE,
                         qtlOverlap = TRUE,
                         nOverlap = c(2, 3, 0),
                         effCor = 0.1,
                         propDomi = 0.2,
                         interactionMean = c(4, 1, 2))
### create simulated population
simulatedPop <- createPop(geno = NULL,
                          haplo = NULL,
                          lociInfo = myLoci,
                          traitInfo = myTrait,
                          founderIsInitPop = TRUE,
                          popName = "First Population",
                          verbose = FALSE)
### create trialInfo object
myTrial <- trialInfo$new(population = simulatedPop,
                         herit = c(0.4, 0.7, 0.2),
                         nRep = 2,
                         multiTraitsAsEnvs = FALSE,
                         residCor = 0.3)
simulatedPop$inputTrialInfo(trialInfoNow = myTrial)


KosukeHamazaki/myBreedSimulatR documentation built on Aug. 31, 2024, 3:55 p.m.