phenotyper object is used to phenotype populations
Public fields
name
[character] name of the phenotyper
plotCost
[numeric] cost for phenotyping one plot
traits
[list] of phenotyped traits
mu
[numeric] vector of the mean for each trait
ve
[numeric] vector of the environmental variance sigma^2 for each trait
Methods
Method new()
Create a new phenotyper object.
Usage
phenotyper$new(
name,
traits,
plotCost = 1,
mu = 0,
ve = NULL,
he = NULL,
pop = NULL
)
Arguments
name
[character] name of the phenotyper
traits
[trait or list] of phenotyped traits
plotCost
[numeric] cost for phenotyping one plot
mu
[numeric] vector of the mean for each trait
ve
[numeric] (if
he
not provided) vector of the environmental variance sigma^2 for each traithe
[numeric] (if
ve
not provided) vector of the target heredity for each traitpop
[population] (if
ve
not provided) population used for the target heredity calculation (see:population)
Examples
mySpec <- specie$new(nChr = 10,
lchr = 10^6,
lchrCm = 100,
specName = "Geneticae Exempli")
SNPs <- SNPinfo$new(SNPcoord = exampleData$snpCoord,
specie = mySpec)
example_pop <- createPop(geno = exampleData$genotypes,
SNPinfo = SNPs,
popName = "Example population")
myTrait1 <- trait$new(name = "Trait1",
qtn = sample(SNPs$SNPcoord$SNPid, 100),
qtnEff = rnorm(100, sd = 0.3))
myTrait2 <- trait$new(name = "Trait2",
qtn = sample(SNPs$SNPcoord$SNPid, 100),
qtnEff = rnorm(100, sd = 0.4))
phenoLab1 <- phenotyper$new(name = "My phenoLab",
traits = list(myTrait1, myTrait2),
plotCost = 1,
mu = c(100, 50),
ve = NULL,
he = c(0.4, 0.55),
pop = example_pop)
phenoLab2 <- phenotyper$new(name = "My phenoLab",
traits = list(myTrait1, myTrait2),
plotCost = 2,
mu = c(100, 50),
ve = c(9, 7),
he = NULL,
pop = NULL)
Method trial()
Phenotype a given population
Arguments
pop
[population class] population (see: population)
rep
[numeric] number of replication for each individuals
offset
[numeric] offset added to the phenotypic calculation results
Details
phenotypic values for individual i repetition j is calculated as follow: $$y_{ij} = \mu + g_i + e_{ij} + offset$$ $$e_{ij} \sim N(0, \sigma_e^2)$$ where g_i is the genetic value of the individual i
Examples
pheno1 <- phenoLab1$trial(example_pop, rep = 4, offset = c(3, 5))
pheno1$cost
summary(pheno1$data)
pheno2 <- phenoLab2$trial(example_pop, rep = 3, offset = c(-5, 0))
pheno2$cost
summary(pheno2$data)
pheno3 <- phenoLab2$trial(example_pop,
rep = round(runif(example_pop$nInd, 1, 3)),
offset = c(-5, 0))
pheno3$cost
summary(pheno3$data)
Examples
## ------------------------------------------------
## Method `phenotyper$new`
## ------------------------------------------------
mySpec <- specie$new(nChr = 10,
lchr = 10^6,
lchrCm = 100,
specName = "Geneticae Exempli")
#> A new species has emerged: Geneticae Exempli !
#>
SNPs <- SNPinfo$new(SNPcoord = exampleData$snpCoord,
specie = mySpec)
example_pop <- createPop(geno = exampleData$genotypes,
SNPinfo = SNPs,
popName = "Example population")
#> Create population: Initialisation...
#> Create population: Create individuals...
#>
1%
2%
3%
4%
5%
6%
7%
8%
9%
10%
11%
12%
13%
14%
15%
16%
17%
18%
19%
20%
21%
22%
23%
24%
25%
26%
27%
28%
29%
30%
31%
32%
33%
34%
35%
36%
37%
38%
39%
40%
41%
42%
43%
44%
45%
46%
47%
48%
49%
50%
51%
52%
53%
54%
55%
56%
57%
58%
59%
60%
61%
62%
63%
64%
65%
66%
67%
68%
69%
70%
71%
72%
73%
74%
75%
76%
77%
78%
79%
80%
81%
82%
83%
84%
85%
86%
87%
88%
89%
90%
91%
92%
93%
94%
95%
96%
97%
98%
99%
100%
#> Create population: Create population object...
#> Create population: Add individuals...
#>
1%
2%
3%
4%
5%
6%
7%
8%
9%
10%
11%
12%
13%
14%
15%
16%
17%
18%
19%
20%
21%
22%
23%
24%
25%
26%
27%
28%
29%
30%
31%
32%
33%
34%
35%
36%
37%
38%
39%
40%
41%
42%
43%
44%
45%
46%
47%
48%
49%
50%
51%
52%
53%
54%
55%
56%
57%
58%
59%
60%
61%
62%
63%
64%
65%
66%
67%
68%
69%
70%
71%
72%
73%
74%
75%
76%
77%
78%
79%
80%
81%
82%
83%
84%
85%
86%
87%
88%
89%
90%
91%
92%
93%
94%
95%
96%
97%
98%
99%
100%
#> A new population created: Example population !
myTrait1 <- trait$new(name = "Trait1",
qtn = sample(SNPs$SNPcoord$SNPid, 100),
qtnEff = rnorm(100, sd = 0.3))
myTrait2 <- trait$new(name = "Trait2",
qtn = sample(SNPs$SNPcoord$SNPid, 100),
qtnEff = rnorm(100, sd = 0.4))
phenoLab1 <- phenotyper$new(name = "My phenoLab",
traits = list(myTrait1, myTrait2),
plotCost = 1,
mu = c(100, 50),
ve = NULL,
he = c(0.4, 0.55),
pop = example_pop)
phenoLab2 <- phenotyper$new(name = "My phenoLab",
traits = list(myTrait1, myTrait2),
plotCost = 2,
mu = c(100, 50),
ve = c(9, 7),
he = NULL,
pop = NULL)
## ------------------------------------------------
## Method `phenotyper$trial`
## ------------------------------------------------
pheno1 <- phenoLab1$trial(example_pop, rep = 4, offset = c(3, 5))
pheno1$cost
#> [1] 400
summary(pheno1$data)
#> ind Trait1 Trait2 rep
#> Length:400 Min. : 93.00 Min. :50.47 Min. :1.00
#> Class :character 1st Qu.: 99.93 1st Qu.:57.83 1st Qu.:1.75
#> Mode :character Median :103.27 Median :60.04 Median :2.50
#> Mean :102.84 Mean :60.23 Mean :2.50
#> 3rd Qu.:105.53 3rd Qu.:62.60 3rd Qu.:3.25
#> Max. :112.88 Max. :71.26 Max. :4.00
#> phenotyper
#> Length:400
#> Class :character
#> Mode :character
#>
#>
#>
pheno2 <- phenoLab2$trial(example_pop, rep = 3, offset = c(-5, 0))
pheno2$cost
#> [1] 600
summary(pheno2$data)
#> ind Trait1 Trait2 rep
#> Length:300 Min. : 83.27 Min. :43.01 Min. :1
#> Class :character 1st Qu.: 92.57 1st Qu.:52.21 1st Qu.:1
#> Mode :character Median : 95.29 Median :54.73 Median :2
#> Mean : 95.20 Mean :54.85 Mean :2
#> 3rd Qu.: 98.02 3rd Qu.:57.26 3rd Qu.:3
#> Max. :106.49 Max. :66.80 Max. :3
#> phenotyper
#> Length:300
#> Class :character
#> Mode :character
#>
#>
#>
pheno3 <- phenoLab2$trial(example_pop,
rep = round(runif(example_pop$nInd, 1, 3)),
offset = c(-5, 0))
pheno3$cost
#> [1] 406
summary(pheno3$data)
#> ind Trait1 Trait2 rep
#> Length:203 Min. : 86.03 Min. :44.17 Min. :1.000
#> Class :character 1st Qu.: 92.12 1st Qu.:51.91 1st Qu.:1.000
#> Mode :character Median : 94.75 Median :54.96 Median :2.000
#> Mean : 94.70 Mean :54.69 Mean :1.631
#> 3rd Qu.: 97.58 3rd Qu.:57.26 3rd Qu.:2.000
#> Max. :104.70 Max. :64.53 Max. :3.000
#> phenotyper
#> Length:203
#> Class :character
#> Mode :character
#>
#>
#>
## ------------------------------------------------
## Method `phenotyper$he`
## ------------------------------------------------
phenoLab1$he(example_pop)
#> Trait1 Trait2
#> 0.40 0.55
phenoLab2$he(example_pop)
#> Trait1 Trait2
#> 0.4216994 0.5221181