Skip to content

Commit

Permalink
Update readgenotypes.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
reworkhow authored Mar 27, 2024
1 parent 4f5217c commit 97b6157
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/1.JWAS/src/markers/readgenotypes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,10 @@ function get_genotypes(file::Union{AbstractString,Array{Float64,2},Array{Float32
#read a large genotype file
data = CSV.read(file,DataFrame,types=etv,delim = separator,header=false,skipto=(header==true ? 2 : 1))
obsID = map(string,data[!,1])
genotypes = Matrix(data[!,2:end]) #memory usage is doubled here
genotypes = map(data_type, Matrix(file[!,2:end]))
#clean memory
data = nothing
GC.gc()
#data = nothing
#GC.gc()
#Note: why we choose to use `genotypes = Matrix(data[!,2:end])` due to limitation of DataFrames.jl
#- cannot use `genotypes=@view data[!,2:end]` because the view will be copied as a new DataFrame in QC: `genotypes = genotypes[:,select]`
#- cannot use `select!(genotypes, Not(1))` to simply delete the 1st column of obsID from the DataFrame, because genotypes must be a Matrix used for matrix multiplication (e.g. EBV += Mi.output_genotypes*Mi.α[traiti]).
Expand Down

0 comments on commit 97b6157

Please sign in to comment.