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  1.33081889
#> Coll0002 -3.86384670
#> Coll0003  9.47277031
#> Coll0004  4.24236567
#> Coll0005  5.92835763
#> Coll0006  8.38889621
#> Coll0007  5.68567903
#> Coll0008  3.27343623
#> Coll0009  4.40608194
#> Coll0010  1.36342494
#> Coll0011  4.23352051
#> Coll0012  4.72179153
#> Coll0013  4.25707492
#> Coll0014  6.91564850
#> Coll0015  6.05117251
#> Coll0016  6.43686826
#> Coll0017  9.13095692
#> Coll0018  2.32898704
#> Coll0019  6.50661403
#> Coll0020  2.44771126
#> Coll0021  1.68588024
#> Coll0022 -0.05574874
#> Coll0023  1.17823306
#> Coll0024  1.58606344
#> Coll0025  5.21799241
#> Coll0026 -0.84148556
#> Coll0027  2.42903299
#> Coll0028  0.03955991
#> Coll0029  2.65465855
#> Coll0030  5.78191827
#> Coll0031  5.03515845
#> Coll0032 -1.43387116
#> Coll0033  1.16526582
#> Coll0034  1.57639763
#> Coll0035  2.13326123
#> Coll0036  4.75922869
#> Coll0037  1.90380791
#> Coll0038  3.49749326
#> Coll0039 -1.52048585
#> Coll0040  2.20230259
#> Coll0041  3.94585909
#> Coll0042 -2.80357182
#> Coll0043 -3.36204017
#> Coll0044  3.25325491
#> Coll0045  7.18228840
#> Coll0046  5.67914831
#> Coll0047 -1.28617182
#> Coll0048  0.39519550
#> Coll0049 10.01024152
#> Coll0050  1.20815849
#> Coll0051 11.74287977
#> Coll0052  7.80284217
#> Coll0053  6.07047948
#> Coll0054  1.54412467
#> Coll0055 -2.06851650
#> Coll0056  1.21124536
#> Coll0057  5.69113066
#> Coll0058  6.19018938
#> Coll0059  6.64560566
#> Coll0060 -0.47307625
#> Coll0061 -0.19835418
#> Coll0062  1.89770480
#> Coll0063  3.70419171
#> Coll0064  2.50227631
#> Coll0065 -2.09606355
#> Coll0066  8.33512437
#> Coll0067  1.24806400
#> Coll0068  2.37466865
#> Coll0069  3.74370686
#> Coll0070  9.97936128
#> Coll0071  6.61920358
#> Coll0072  4.25905818
#> Coll0073  1.25597810
#> Coll0074  7.86905252
#> Coll0075  5.94750022
#> Coll0076 -3.05304681
#> Coll0077 -3.19738377
#> Coll0078 -1.20636816
#> Coll0079  0.57028700
#> Coll0080  8.11025808
#> Coll0081  5.86601909
#> Coll0082  5.00307657
#> Coll0083  0.96023540
#> Coll0084  2.31676871
#> Coll0085  5.22509183
#> Coll0086 -2.51622551
#> Coll0087  4.07725382
#> Coll0088  1.03993167
#> Coll0089  3.62033933
#> Coll0090  2.61405095
#> Coll0091  1.76903421
#> Coll0092  4.63169784
#> Coll0093 -0.24560065
#> Coll0094  3.68384336
#> Coll0095  1.07232404
#> Coll0096  1.06381978
#> Coll0097  9.61093854
#> Coll0098  6.59338448
#> Coll0099  8.02812411
#> Coll0100  2.25227175