@@ -25,15 +25,15 @@ Additionally, `tryparse` have to be extended for `CSV` parsing:
2525
2626See README.md for the structure of ".batch" file.
2727"""
28- function read (file:: String , T; analytetype = String, sampletype = String, numbertype = Float64, delim = ' \t ' , kwargs... )
28+ function read (file:: String , T; analytetype = String, sampletype = String, numbertype = Float64, modeltype = CalibrationModel, delim = ' \t ' , kwargs... )
2929 if endswith (file, " .batch" )
30- read_batch (file, T; analytetype, sampletype, numbertype, delim, kwargs... )
30+ read_batch (file, T; analytetype, sampletype, numbertype, modeltype, delim, kwargs... )
3131 elseif endswith (file, " .ical" ) || endswith (file, " .ecal" )
3232 read_calibrator (file; analytetype, numbertype, delim, kwargs... )
3333 elseif endswith (file, " .at" )
3434 read_analysistable (file, T; analytetype, sampletype, numbertype, delim, kwargs... )
3535 elseif endswith (file, " .am" )
36- read_method (file, T; analytetype, sampletype, numbertype, delim, kwargs... )
36+ read_method (file, T; analytetype, sampletype, numbertype, delim, modeltype, kwargs... )
3737 elseif endswith (file, " .sdt" ) || endswith (file, " .adt" )
3838 read_datatable (file, T; analytetype, sampletype, numbertype, delim, kwargs... )
3939 end
@@ -93,7 +93,7 @@ function read_calibrator(file::String; analytetype = String, numbertype = Float6
9393 if endswith (file, " .ical" )
9494 return InternalCalibrator (analytetype (config[:analyte ]), parse (numbertype, config[:conc ]))
9595 end
96- tbl = CSV. read (joinpath (file, " table.txt" ), Table; delim = get (config, :delim , delim), typemap = Dict (Int => numbertype, Float64 => numbertype), types = Dict (:level => Int))
96+ tbl = CSV. read (joinpath (file, " table.txt" ), Table; delim = get (config, :delim , delim), typemap = Dict (Int => numbertype, Float64 => numbertype), types = Dict (:level => Int), stringtype = String )
9797 model = cqaconvert (modeltype, config[:model ])
9898 externalcalibrate (cqaconvert (analytetype, config[:analyte ]), config[:isd ] == " nothing" ? nothing : cqaconvert (analytetype, config[:isd ]), tbl, model; decode_config (modeltype, config)... )
9999end
@@ -146,7 +146,7 @@ function read_sampledatatable(file::String, T; analytetype = String, sampletype
146146 config = read_config (joinpath (file, " config.txt" ))
147147 delim = get (config, :delim , delim)
148148 sample_name = Symbol (first (split (config[:Sample ], " \t " )))
149- tbl = CSV. read (joinpath (file, " table.txt" ), T; delim, typemap = Dict (Int => numbertype), types = Dict (sample_name => sampletype, levelname => Int), validate = false )
149+ tbl = CSV. read (joinpath (file, " table.txt" ), T; delim, typemap = Dict (Int => numbertype), types = Dict (sample_name => sampletype, levelname => Int), stringtype = String, validate = false )
150150 analyte_name = String .(filter! (! isempty, vectorize (config[:Analyte ])))
151151 for i in Symbol .(analyte_name)
152152 replace! (getproperty (tbl, i), missing => 0 )
@@ -178,7 +178,7 @@ function read_analytedatatable(file::String, T; analytetype = String, sampletype
178178 delim = get (config, :delim , delim)
179179 analyte_name = Symbol (config[:Analyte ])
180180 sample_name = String .(filter! (! isempty, vectorize (config[:Sample ])))
181- tbl = CSV. read (joinpath (file, " table.txt" ), T; delim, typemap = Dict (Int => numbertype), types = Dict (analyte_name => analytetype), validate = false )
181+ tbl = CSV. read (joinpath (file, " table.txt" ), T; delim, typemap = Dict (Int => numbertype), types = Dict (analyte_name => analytetype), stringtype = String, validate = false )
182182 for i in Symbol .(sample_name)
183183 replace! (getproperty (tbl, i), missing => 0 )
184184 end
@@ -240,7 +240,7 @@ function read_method(file::String, T; analytetype = String, sampletype = String,
240240 est_conc = Symbol (get (config, :est_conc , :estimated_concentration ))
241241 nom_conc = Symbol (get (config, :nom_conc , :nominal_concentration ))
242242 acc = Symbol (get (config, :acc , :accuracy ))
243- analytetable = CSV. read (joinpath (file, " analytetable.txt" ), Table)
243+ analytetable = CSV. read (joinpath (file, " analytetable.txt" ), Table; stringtype = String )
244244 analyte = analytetype .(analytetable. analyte)
245245 isd = replace (analytetable. isd, missing => 0 )
246246 model = :model in propertynames (analytetable) ? cqaconvert .(modeltype, analytetable. model) : [LinearCalibrator (ConstWeight ()) for _ in eachindex (analytetable)]
0 commit comments