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. : 90.67 Min. :44.16 Min. :1.00
#> Class :character 1st Qu.: 99.84 1st Qu.:54.01 1st Qu.:1.75
#> Mode :character Median :102.36 Median :57.25 Median :2.50
#> Mean :102.13 Mean :57.15 Mean :2.50
#> 3rd Qu.:104.27 3rd Qu.:60.29 3rd Qu.:3.25
#> Max. :112.28 Max. :72.22 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. : 79.62 Min. :39.81 Min. :1
#> Class :character 1st Qu.: 91.25 1st Qu.:49.25 1st Qu.:1
#> Mode :character Median : 93.88 Median :51.81 Median :2
#> Mean : 94.01 Mean :52.20 Mean :2
#> 3rd Qu.: 96.68 3rd Qu.:55.12 3rd Qu.:3
#> Max. :105.12 Max. :66.52 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] 392
summary(pheno3$data)
#> ind Trait1 Trait2 rep
#> Length:196 Min. : 84.44 Min. :38.87 Min. :1.000
#> Class :character 1st Qu.: 91.49 1st Qu.:49.20 1st Qu.:1.000
#> Mode :character Median : 94.13 Median :52.77 Median :1.000
#> Mean : 94.12 Mean :52.59 Mean :1.607
#> 3rd Qu.: 96.57 3rd Qu.:55.81 3rd Qu.:2.000
#> Max. :104.31 Max. :65.37 Max. :3.000
#> phenotyper
#> Length:196
#> Class :character
#> Mode :character
#>
#>
#>
## ------------------------------------------------
## Method `phenotyper$he`
## ------------------------------------------------
phenoLab1$he(example_pop)
#> Trait1 Trait2
#> 0.40 0.55
phenoLab2$he(example_pop)
#> Trait1 Trait2
#> 0.3396647 0.6412943