Skip to contents

Create population object from genotype data.frame

Usage

createPop(geno, SNPinfo, indNames = NULL, popName = NULL, verbose = TRUE)

Arguments

geno

[data.frame] genotype of the individuals encoded in allele dose. All individuals should be homozygotes. (value 0 or 2)

SNPinfo

[SNPinfo object] information about the individuals haplotypes' SNPs (see:SNPinfo)

indNames

NULL or character string vector specifying the individuals names. If NULL, rownames(geno) will be used.

popName

[character string] population's name.

verbose

[boolean] display information

Value

population object (see:population)

Examples

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)

print(exampleData$genotypes[1:5, 1:10])
#>          snp00006 snp00009 snp00011 snp00018 snp00026 snp00031 snp00035
#> Coll0001        2        2        2        0        2        2        2
#> Coll0002        0        2        2        2        0        0        0
#> Coll0003        2        2        2        0        2        2        2
#> Coll0004        0        2        2        2        0        0        0
#> Coll0005        2        2        2        0        2        2        2
#>          snp00036 snp00049 snp00052
#> Coll0001        0        0        0
#> Coll0002        2        2        2
#> Coll0003        0        0        0
#> Coll0004        2        2        2
#> Coll0005        0        0        0
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 !