diff --git a/src/1.JWAS/src/markers/readgenotypes.jl b/src/1.JWAS/src/markers/readgenotypes.jl index 5a32b0fd..32dcecdb 100644 --- a/src/1.JWAS/src/markers/readgenotypes.jl +++ b/src/1.JWAS/src/markers/readgenotypes.jl @@ -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]).