Skip to contents

trait object store information about a phenotypic trait

Public fields

name

[string] Name of the trait

class

"qualitative" or "quantitative" trait ("qualitative" not implemented yet)

qtn

[character vector] names of the causal quantitative trait nucleotides (length(qtn) == length(qtnEff) must be true)

qtnEff

[numeric vector] quantitative trait nucleotides effects

Methods


Method new()

Create a new trait object.

Usage

trait$new(name = NULL, class = "quantitative", qtn = NULL, qtnEff = NULL)

Arguments

name

[character] name of the trait

class

"quantitative" or "qualitative"

qtn

[character vector] list of the quantitative trait nucleotides names implied in the trait

qtnEff

[numeric vector] quantitative trait nucleotides effects (see details for more information).

Details

qtn and qtnEff must be in the same order. qtnEff[n] must be the QTN effect of the QTN qtn[n].

Returns

A new `trait` object.

Examples

mySpec <- specie$new(nChr = 10,
                     lchr = 10^6,
                     lchrCm = 100,
                     specName = "Geneticae Exempli")
SNPs <- SNPinfo$new(SNPcoord = exampleData$snpCoord,
                    specie = mySpec)

myTrait <- trait$new(name = "myTrait",
                     qtn = sample(SNPs$SNPcoord$SNPid, 100),
                     qtnEff = rnorm(100, sd = 0.5))


Method gv()

Calculate the genetic values of a population

Usage

trait$gv(pop)

Arguments

pop

[population class] population (see: population)

Examples

# create population
example_pop <- createPop(geno = exampleData$genotypes,
                         SNPinfo = SNPs,
                         popName = "Example population")
myTrait$gv(example_pop)


Method print()

Display information about the object

Usage

trait$print()


Method clone()

The objects of this class are cloneable with this method.

Usage

trait$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `trait$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)

myTrait <- trait$new(name = "myTrait",
                     qtn = sample(SNPs$SNPcoord$SNPid, 100),
                     qtnEff = rnorm(100, sd = 0.5))

## ------------------------------------------------
## Method `trait$gv`
## ------------------------------------------------

# create population
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 !
myTrait$gv(example_pop)
#>                 [,1]
#> Coll0001   3.8957318
#> Coll0002  -8.5590282
#> Coll0003  -9.3974029
#> Coll0004  -7.4569359
#> Coll0005 -14.3203086
#> Coll0006 -10.3572823
#> Coll0007  -5.2268542
#> Coll0008  -1.9545583
#> Coll0009   1.8377717
#> Coll0010  -1.0782440
#> Coll0011  -3.4290696
#> Coll0012  -4.3079093
#> Coll0013  -2.1225814
#> Coll0014   3.3516381
#> Coll0015   4.0142710
#> Coll0016  -2.5645038
#> Coll0017  -0.2593003
#> Coll0018   0.3297541
#> Coll0019   3.6508317
#> Coll0020  -4.7219192
#> Coll0021   2.1355660
#> Coll0022 -10.8940260
#> Coll0023  -9.3035674
#> Coll0024  -5.1860766
#> Coll0025   1.0025508
#> Coll0026  -8.6687643
#> Coll0027   2.3201724
#> Coll0028  -3.7192777
#> Coll0029  -3.1180431
#> Coll0030  -8.6771239
#> Coll0031   4.1883114
#> Coll0032  -1.5095017
#> Coll0033  -2.8879048
#> Coll0034   0.8603088
#> Coll0035  -3.0543282
#> Coll0036   4.0916538
#> Coll0037 -11.5851298
#> Coll0038   1.9960524
#> Coll0039  -5.8858337
#> Coll0040  -2.1907332
#> Coll0041   1.6180864
#> Coll0042  -5.7460986
#> Coll0043  -2.0878521
#> Coll0044  -5.3785177
#> Coll0045  -6.0830059
#> Coll0046   6.5716875
#> Coll0047   0.5303941
#> Coll0048  -2.1658336
#> Coll0049  -7.0924278
#> Coll0050  -3.1933443
#> Coll0051   9.6944820
#> Coll0052   0.4119142
#> Coll0053  -0.6371540
#> Coll0054  -2.1064161
#> Coll0055  -9.2618338
#> Coll0056  -2.8348676
#> Coll0057   4.4213618
#> Coll0058   2.0549973
#> Coll0059 -10.7454798
#> Coll0060   3.0709983
#> Coll0061  -1.0762653
#> Coll0062  -3.1198165
#> Coll0063  -2.9074041
#> Coll0064  -7.1592331
#> Coll0065  -8.2662867
#> Coll0066  -0.1856418
#> Coll0067  -8.2246253
#> Coll0068   3.4393838
#> Coll0069  -0.7228817
#> Coll0070   3.8837864
#> Coll0071  -3.2236122
#> Coll0072  -5.7184520
#> Coll0073  -6.1160669
#> Coll0074  -1.8374243
#> Coll0075  -2.2274717
#> Coll0076  -0.8120508
#> Coll0077   0.6758870
#> Coll0078  -3.3199234
#> Coll0079 -13.5251258
#> Coll0080   1.4912680
#> Coll0081  -6.3414462
#> Coll0082   3.3079534
#> Coll0083  -7.1247366
#> Coll0084  -4.1855997
#> Coll0085 -11.2423058
#> Coll0086   2.4032325
#> Coll0087  -7.2380905
#> Coll0088  -4.1220305
#> Coll0089  -5.8560442
#> Coll0090  -5.7129902
#> Coll0091  -8.7810970
#> Coll0092   6.3407421
#> Coll0093  -4.3729750
#> Coll0094  -6.6330472
#> Coll0095 -13.6628949
#> Coll0096   0.3565659
#> Coll0097 -11.3181132
#> Coll0098  -0.3659189
#> Coll0099  -2.6717402
#> Coll0100   2.9479336