Skip to content

Commit 23b6f81

Browse files
committed
Updated io functions
1 parent 21a0117 commit 23b6f81

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/io/export_to_type.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,8 @@ function get_geno(filename::String)
270270
for i in 1:length(chr)
271271
for j in 1:length(marker[i])
272272
uni = unique(Vector(df_geno[findfirst(x -> x == marker[i][j], marker[i]), 2:end]))
273-
val[i][:, j] = recode(Vector(df_geno[findfirst(x -> x == marker[i][j], marker[i]), 2:end]), uni[1] => 1, uni[2] => 2, uni[3] => 0)
273+
map = Dict(uni[1] => 1, uni[2] => 2, uni[3] => 0)
274+
val[i][:, j]=[map[v] for v in Vector(df_geno[findfirst(x -> x == marker[j], marker), 2:end])]
274275
end
275276

276277
end
@@ -339,7 +340,8 @@ function get_chromosome(gmapfile::String, genofile::String, number::Int)
339340
val = Matrix{Int}(undef, length(samples), length(marker))
340341
for j in 1:length(marker)
341342
uni = unique(Vector(df_geno[findfirst(x -> x == marker[j], marker), 2:end]))
342-
val[:, j] = recode(Vector(df_geno[findfirst(x -> x == marker[j], marker), 2:end]), uni[1] => 1, uni[2] => 2, uni[3] => 0)
343+
map = Dict(uni[1] => 1, uni[2] => 2, uni[3] => 0)
344+
val[:, j]=[map[v] for v in Vector(df_geno[findfirst(x -> x == marker[j], marker), 2:end])]
343345
end
344346

345347
return Chromosome(name, marker, val)

0 commit comments

Comments
 (0)