Skip to content

Commit 64fd74f

Browse files
committed
handle single animal in breed()
1 parent 411e8d6 commit 64fd74f

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

src/interface/interface.jl

+9-3
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,6 @@ function breed(cohort_A ::Cohort,
175175
else
176176
# Mate
177177
progenies = mate(cohort_A, cohort_B; silent=true, args...)
178-
println(progenies)
179178
# Select
180179
if n_select > 0
181180
progenies = select(progenies, n_select; silent=true, args...)
@@ -189,12 +188,19 @@ function breed(cohort_A ::Cohort,
189188
cohort_A = progenies
190189
cohort_B = progenies
191190
end
192-
println(progenies)
193191

194192
end
195193

194+
if length(cohort_A) == 1
195+
cohort_A = Cohort(cohort_A)
196+
end
197+
if length(cohort_B) == 1
198+
cohort_B = Cohort(cohort_B)
199+
end
200+
196201
# LOG
197-
sm = summary(cohort_A + cohort_B)
202+
sum_cohort = cohort_A + cohort_B
203+
sm = summary(sum_cohort)
198204
LOG("Gen $i -> Mean of BVs: $(sm["mu_g"]), Variance of BVs: $(sm["var_g"])")
199205
end
200206

test/paper_cases.jl

+9-4
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,24 @@ for parent in diverse_parents
8989
end
9090
# Each family produce 200 progenies by selfing
9191
args = Dict(# Mating
92-
:n_per_mate => 1, # single-seed decent (SSD)
92+
:n_per_mate => 10,
9393
:scheme => "selfing",
9494
# Selection
9595
:criteria => "phenotypes",
9696
# Breed
9797
:n_gens => 4,
98-
:n_select => 200)
98+
# single-seed decent
99+
:n_select => 1)
99100
NAM = Cohort()
100101
for family in F1
101-
F2 = mate(family, n_per_mate=200)
102-
NAM += breed(F2; args...)
102+
F2 = mate(family, n_per_mate=200, scheme="selfing")
103+
for seed in F2
104+
NAM += breed(seed; args...)
105+
end
103106
end
104107

108+
family=F1[1]
109+
get_genotypes(F2)
105110

106111
#----- Methods ----------------
107112
path = PATH("map")

0 commit comments

Comments
 (0)