ChemistryQuantitativeAnalysis.AnalysisMethodType
AnalysisMethod{A, M <: Table, C <: AbstractDataTable, D <: Union{AbstractDataTable, Nothing}}

A type containing analytes settings, and source calibration data. A determines analyte type.

Fields

  • analytetable: M contaning three columns.
    • analyte: AbstractVector{A}, analytes in user-defined types.
    • isd: AbstractVector{Int}, index of internal standard. 0 means no internal standard, and -1 means the analyte itself is a internal standard.
    • calibration: index of analyte for calibration curve. -1 means the analyte itself is a internal standard, so it will not be put into any calibration curve.
  • signal: Symbol, data type for quantification, e.g. :area.
  • pointlevel: Vector{Int} matching each point to level. It can be empty if there is only one level in conctable.
  • conctable: C <: AbstractDataTable{<: A, Int} containing concentration data for each level. Samples must integers. One level indicates using SingleCalibration.
  • signaltable: D <: AbstractDataTable{A} containig signal for each point. It can be nothing if signal data is unecessary.

Properties

  • analyte: AbstractVector{A}, analytes in user-defined types, identical to analytetable.analyte.
  • isd: AbstractVector{A}, analytes which are internal standards.
  • nonisd: AbstractVector{A}, analytes which are not internal standards.
  • point: AbstractVector{S}, calibration points, identical to sampleobj(signaltable). If signaltable is nothing, this value is nothing too.
  • level: AbstractVector{Int}, calibration levels, identical to sampleobj(conctable).
ChemistryQuantitativeAnalysis.AnalysisMethodMethod
AnalysisMethod(conctable::AbstractDataTable{A, Int}, signaltable::SampleDataTable, signal::Symbol, levelname::Symbol; kwargs...)
AnalysisMethod(conctable::AbstractDataTable{A, Int}, signaltable::Nothing, signal::Symbol; kwargs...)
AnalysisMethod(conctable::AbstractDataTable, signaltable::Union{AbstractDataTable, Nothing}, signal::Symbol, pointlevel::AbstractVector{Int}; kwargs...)

Convenient contructors for AnalysisMethod which make constructing a Table optional. kwargs will be columns in analytetable; when analyte, isd and calibration are not provided, it will use analyte in conctable.

levelname is the column name for pointlevel. See AnalysisMethod for details of other arguments.

ChemistryQuantitativeAnalysis.AnalysisTableType
AnalysisTable{A, S, T <: AbstractDataTable{A, S}}

Wrapper of multiple tables representing different types of values. A determines analyte type, S determines sample type, and T determines datatable type. It is implemented as a Dictionary{Symbol, T <: AbstractDataTable{A, S}}, but unlike dictionaries, each datatable can also be extracted using getproperty.

Fields

  • analyte: Vector{A}, analytes in user-defined types. Use analyteobj to get this field.
  • sample: Vector{S}, samples in user-defined types. Use sampleobj to get this field.
  • tables: Dictionary{Symbol, T}, a dictionary mapping data type to datatable. Use tables to get this field.

Properties

All keys of tables.

ChemistryQuantitativeAnalysis.AnalysisTableMethod
AnalysisTable(keys::AbstractVector{Symbol}, tables::AbstractVector{<: AbstractDataTable{A, S}})

A Dictionary-like constructor for AnalysisTable from two iterable inputs keys and tables. The first value of keys will be the index for the first value of tables.

ChemistryQuantitativeAnalysis.AnalyteDataTableType
AnalyteDataTable{A, S, N <: Real, T} <: AbstractDataTable{A, S, N, T}

Tabular data wrapper indicates part of columns represent analyte, and all rows reprsent samples. A determines analyte type, S determines sample type, N determines numeric value type, and T determines table type.

Fields

  • analyte: Vector{A}, analytes in user-defined types, i.e., getproperty(table(dt), analytecol(dt)). Use analyteobj to get this field.
  • sample: Vector{S}, samples in user-defined types. Use sampleobj to get this field.
  • analytecol: Symbol, the column name that each element is analyte name. Use analytecol to get this field.
  • table: Tabular data of type T. Use table to get this field.

Properties

All properties of table.

ChemistryQuantitativeAnalysis.AnalyteDataTableMethod
AnalyteDataTable(analytecol::Symbol, samplename::AbstractVector, table)
AnalyteDataTable(table, analytecol::Symbol, samplename::AbstractVector)

An interface equivalent to AnalyteDataTable(getproperty(table, analytecol), samplename, analytecol, table).

ChemistryQuantitativeAnalysis.AnalyteDataTableMethod
AnalyteDataTable(analytecol::Symbol, sampletype::TypeOrFn, table; samplename = setdiff(propertynames(table), [analytecol]))
AnalyteDataTable(table, analytecol::Symbol, sampletype::TypeOrFn; samplename = setdiff(propertynames(table), [analytecol]))
AnalyteDataTable(analytecol::Symbol, table; samplename = setdiff(propertynames(table), [analytecol]))
AnalyteDataTable(table, analytecol::Symbol; samplename = setdiff(propertynames(table), [analytecol]))

Higher level interfaces for AnalyteDataTable{A, S}.

  • analytecol: Symbol, the column name that each element is analyte name.
  • samplename: AbstractVector, the column names of table that are sample names. It will be converted to Vector{String} before conversion to AbstractVector{S} (string.(samplename)).
  • sampletype: type S or a function. After first conversion of sampletype, it converts samplename to AbstractVector{S} using cqamap(sampletype, sampletype). See cqaconvert for the requirement of sampletype.
ChemistryQuantitativeAnalysis.AnalyteDataTableMethod
AnalyteDataTable(tbl::SampleDataTable{A, S, N, T}, analytecol::Symbol, tablesink::TypeOrFn = T)
AnalyteDataTable(analytecol::Symbol, tablesink::TypeOrFn, tbl::SampleDataTable)
AnalyteDataTable(analytecol::Symbol, tbl::SampleDataTable)

Convert SampleDataTable to AnalyteDataTable with analytecol as the column name of analyte.

ChemistryQuantitativeAnalysis.BatchType
Batch{A, M <: AnalysisMethod{A}, C <: AbstractVector{<: AbstractCalibration{<: A}}, D <: Union{AnalysisTable{<: A}, Nothing}}

A type representing a batch for quantitative analysis. A determines analyte type, and T determines table type.

Fields

  • method: M, method.
  • calibration: C, calibration curves.
  • data: D, data for analysis, .

Properties

  • analyte: AbstractVector{A}, analytes in user-defined types, identical to method.analyte.
  • isd: AbstractVector{<: A}, analytes which are internal standards, identical to method.isd.
  • nonisd: AbstractVector{<: A}, analytes which are not internal standards, identical to method.nonisd.
  • point: AbstractVector or Nothing, calibration points, identical to method.point.
  • level: AbstractVector{Int}, calibration levels, identical to method.level.

Constructors

  • Batch(method, calibration, data = nothing)
ChemistryQuantitativeAnalysis.BatchMethod
Batch(dt::AbstractDataTable; 
    signal::Symbol = :area, 
    calid = r"Cal_(\d)_(\d*-*\d*)", 
    order = "LR", 
    f2c = 1,
    parse_decimal = x -> replace(x, "-" => "."))

Construct a batch from data. All analytes are considered as normal analytes, so calibration curves are not contructed immediately; call init_calibration! after confirming isd and calibration settings in batch.method.analytetable.

Arguments

  • dt: data containing both calibration curves and samples.

Keyword Arguments

  • signal: Symbol, data type for quantification, e.g. :area.
  • calid: Regex, identifier for calibration data; level and concentration related factors (ratio of concentration or dilution factor) should be captured.

The former should be able to be parsed as integer directly; the latter should be able to be parsed as floating number after applying parse_decimal.

  • order: String, represents the order and identity of captured string; L is level, R is ratio of concentration, D is dilution factor (df).
  • f2c: Number or vector of numbers; concentration equals to f2c * ratio or f2c / df. When a vector is provided, each element represents f2c value of each analyte.
  • parse_decimal: Function, converts a string into another string which can be parsed as floating number.
ChemistryQuantitativeAnalysis.BatchMethod
Batch(method::AnalysisMethod, data = nothing; type = true, zero = false, weight = 0)

Construct a Batch from method, and optionally data with specified calibration parameters. See "MultipleCalibration" for detail description of keyword arguments.

ChemistryQuantitativeAnalysis.MultipleCalibrationType
MultipleCalibration{A, N, T <: Table} <: AbstractCalibration{A, N}

A mutable type holding all data and settings for a calibration curve. A determines analyte type, and N determines numeric type. Only Float64 is supported because of issue of GLM.

Fields

  • analyte: Tuple{A, Any}. First element is the analyte being quantified, and the second element is its internal standard for which nothing indicates no internal standard.
  • type: Bool determines whether fitting a linear line (true) or quadratic curve (false).
  • zero: Bool determines whether forcing the curve crossing (0, 0) (true) or ignoring it (false).
  • weight: Float64 represents the exponential applying to each element of x as a weighting vector.
  • formula: FormulaTerm, the formula for fitting calibration curve.
  • table: TypedTable.Table, the cleaned up calibration data, containing 7 columns.
    • id: Point name
    • level: The index of concentration level. The larger, the higher concentraion it represents.
    • y: Signal or relative signal
    • x: True concentraion
    • : Predicted concentration
    • accuracy: Accuracy, i.e. x̂/x.
    • include: Whether this point is included or not
  • model: GLM object.
ChemistryQuantitativeAnalysis.SampleDataTableType
SampleDataTable{A, S, N <: Real, T} <: AbstractDataTable{A, S, N, T}

Tabular data wrapper indicates part of columns represent analytes, and all rows reprsent samples. A determines analyte type, S determines sample type, N determines numeric value type, and T determines table type.

Fields

  • analyte: Vector{A}, analytes in user-defined types. Use analyteobj to get this field.
  • sample: Vector{S}, samples in user-defined types, i.e., getproperty(table(dt), samplecol(dt)). Use sampleobj to get this field.
  • samplecol: Symbol, the column name that each element is sample name. Use samplecol to get this field.
  • table: Tabular data of type T. Use table to get this field.

Properties

All properties of table.

ChemistryQuantitativeAnalysis.SampleDataTableMethod
SampleDataTable(analyte::AbstractVector, samplecol::Symbol, table)
SampleDataTable(table, analytename::AbstractVector, samplecol::Symbol)

An interface equivalent to SampleDataTable(analyte, getproperty(table, samplecol), samplecol, table).

ChemistryQuantitativeAnalysis.SampleDataTableMethod
SampleDataTable(analytetype::TypeOrFn, samplecol::Symbol, table; analytename = setdiff(propertynames(table), [samplecol]))
SampleDataTable(table, analytetype::TypeOrFn, samplecol::Symbol; analytename = setdiff(propertynames(table), [samplecol]))
SampleDataTable(samplecol::Symbol, table; analytename = setdiff(propertynames(table), [samplecol]))
SampleDataTable(table, samplecol::Symbol; analytename = setdiff(propertynames(table), [samplecol]))

Higher level interfaces for SampleDataTable{A}.

  • analytename: AbstractVector, the column names of table that are analyte names. It will be converted to AbstractVector{String} before conversion to AbstractVector{A} (string.(analytename)).
  • samplecol: Symbol, the column name that each element is sample name.
  • analytetype: type A or a function. After first conversion of analytename, it convert analytename to AbstractVector{A} using cqamap(analytetype, analytename). See cqaconvert for the requirement of analytetype.
ChemistryQuantitativeAnalysis.SampleDataTableMethod
SampleDataTable(tbl::AnalyteDataTable{A, S, N, T}, samplecol::Symbol, tablesink::TypeOrFn = T)
SampleDataTable(samplecol::Symbol, tablesink::TypeOrFn, tbl::AnalyteDataTable)
SampleDataTable(samplecol::Symbol, tbl::AnalyteDataTable)

Convert AnalyteDataTable to SampleDataTable with samplecol as the column name of sample.

ChemistryQuantitativeAnalysis.SingleCalibrationType
SingleCalibration{A, N} <: AbstractCalibration{A, N}

A mutable type holding all data for single point calibration.

Fields

  • analyte: Tuple{A} is the analyte with known concentration (internal standard).
  • conc: Float64, concentration of analyte.
Base.writeMethod
ChemistryQuantitativeAnalysis.write(file::String, object; delim = "\t")

Write object into ".scal" for SingleCalibration, ".mcal" for MultipleCalibration, ".sdt" for SampleDataTable, ".adt" for AnalyteDataTable, ".at" for AnalysisTable, ".am" for AnalysisMethod, and ".batch" for Batch.

delim specifies delimiter for tabular data if config[:delim] does not exist.

See README.md for the structure of all files.

ChemistryQuantitativeAnalysis.accuracyMethod
accuracy(at::AnalysisTable; true_conc = :true_concentration, est_conc = :estimated_concentration) 
accuracy(dtp::AbstractDataTable, dtt::AbstractDataTable)
accuracy(cal::MultipleCalibration, tbl = cal.table)
accuracy(cal::SingleCalibration, tbl)
accuracy(x̂::AbstractVector, x::AbstractVector)

Calculate accuracy and return the values as AbstractDataTable or Vector. tbl must contain two properties, y and x, as same as cal.table.

ChemistryQuantitativeAnalysis.analysistableMethod
analysistable(iter)

A dictionary-like function for constructing AnalysisTable from an iterable iter of key-value Pairs (or other iterables of two elements, such as a two-tuples). Keys should be Symbols, and values should be AbstractDataTables.

ChemistryQuantitativeAnalysis.analytenameMethod
analytename(dt::AbstractDataTable) -> Vector{Symbol}
analytename(at::AnalysisTable) -> Vector{Symbol}

Equivalent to Symbol.(analyteobj(dt)) or Symbol.(analyteobj(at)).

ChemistryQuantitativeAnalysis.analyteobjMethod
analyteobj(dt::AbstractDataTable{A}) -> Vector{A}
analyteobj(at::AnalysisTable{A}) -> Vector{A}

Equivalent to getfield(dt, :analyte) or getfield(at, :analyte).

ChemistryQuantitativeAnalysis.calibrate!Method
calibrate!(batch::Batch)
calibrate!(cal::Vector{<: AbstractCalibration})
calibrate!(cal::MultipleCalibration)

Fit a GLM model based on provided formula, type, zero and weight or parameters from calibration curves.

Field model will be mutated for mutating version. Calling calibrate! on a Batch will apply calibrate! to all calibration curves.

It returns GLM object input for mutating version.

ChemistryQuantitativeAnalysis.calibrateMethod
calibrate(tbl, formula, type, zero, weight)
calibrate(cal::MultipleCalibration)

Fit a GLM model based on provided formula, type, zero and weight or parameters from calibration curves.

Field model will be mutated for mutating version. Calling calibrate! on a Batch will apply calibrate! to all calibration curves.

It returns GLM object, and input object for mutating version.

ChemistryQuantitativeAnalysis.calibrationMethod
calibration(anisd::Tuple, tbl::Table; analyte = 1, isd = 0, type = true, zero = false, weight = 0)
calibration(batch::Batch{A}, ana::B; id = sample(batch.method.signaltable), isd = isdof(batch.method, analyte),
                    type = true, zero = false, weight = 0) where {A, B <: A}
calibration(method::AnalysisMethod{A}, ana::B; id = sample(method.signaltable), isd = isdof(method, analyte),
            type = true, zero = false, weight = 0) where {A, B <: A}

Create MultipleCalibration.

  • anisd: Tuple{B <: A, Any} which will be stored as analyte. The first element is the analyte to be quantified, and the second element is its internal standard, which nothing means no internal standard.
  • analyte: B which will be stored as first argument of analyte.
  • tbl: TypedTable.Table which will be stored as table. It is clean-up calibration data for points selection.
  • method: AnalysisMethod, calibration method and data.
  • batch: Batch.

Keyword arguments

  • type: Bool determines whether fitting a linear line (true) or quadratic curve (false), which will be stored as type.
  • zero: Bool determines whether forcing the curve crossing (0, 0) (true) or ignoring it (false), which will be stored as zero.
  • weight: Float64 represents the exponential applying to each element of x as a weighting vector, which will be stored as weight.
ChemistryQuantitativeAnalysis.cqaconvertMethod
cqaconvert(::Type{T}, x::S)
cqaconvert(fn::Function, x::S)

Call constructor, parse, or fn. Extend this function if defining T(x) is not safe.

Return

  • parse(T, x) if T <: Number and S <: Union{AbstractString, AbstractChar}.
  • fn(x) if fn is a Function.
  • T(x) otherwise.

Note that string(cqaconvert(T, x)) should equal x for a valid string x, i.e. string and x -> cqaconvert(T, x) are inverse functions.

ChemistryQuantitativeAnalysis.cqamapMethod
cqamap(::Type{T}, x::AbstractVector{S})
cqamap(fn::Function, x::AbstractVector)

Convert x to AbstractVector{T}. If direct construction is not possible, i.e. neither T <: S nor S <: T, it applys cqaconvert on every elements.

For a function, T is inferred by cqatype(fn) first and then cqatype(fn, v) for the returned vector v to avoid abstract element type.

ChemistryQuantitativeAnalysis.cqatypeMethod
cqatype(fn::Function)
cqatype(fn::Function, x::AbstractVector)

Default returned type of cqaconvert(fn, x). By default, the union of types of each element is used to avoid abstract element type. Extend this function if neccessary.

ChemistryQuantitativeAnalysis.eachanalyteMethod
eachanalyte(dt::AbstractDataTable)

Create an iterator which gets data belonging to each analyte as a Vector. For AnalyteDataTable, new vectors are created; mutating these vector will not change the value in dt.

ChemistryQuantitativeAnalysis.eachsampleMethod
eachsample(dt::AbstractDataTable)

Create an iterator which gets data belonging to each sample as a Vector. For SampleDataTable, new vectors are created; mutating these vector will not change the value in dt.

ChemistryQuantitativeAnalysis.findanalyteMethod
findanalyte(dt::AbstractDataTable{A}, analyte::B) where {A, B <: A}
findanalyte(dt::AbstractDataTable, analyte::Symbol)

Return the index of the first element of analyteobj(dt) or analytename(dt) for which the element equals to analyte.

ChemistryQuantitativeAnalysis.findsampleMethod
findsample(dt::AbstractDataTable{A, S}, sample::T) where {A, S, T <: S}
findsample(dt::AbstractDataTable, sample::Symbol)

Return the index of the first element of sampleobj(dt) or samplename(dt) for which the element equals to sample.

ChemistryQuantitativeAnalysis.format_numberMethod
format_number(x; digits = nothing, sigdigits = 4)

Return string representation of number with specified digits.

If digits is nothing, the function uses sigdigits instead.

ChemistryQuantitativeAnalysis.formula_reprMethod
formula_repr(cal::SingleCalibration; digits = nothing, sigdigits = 4)
formula_repr(cal::MultipleCalibration; digits = nothing, sigdigits = 4)

Return string representation of formula of cal with specified digits and sigdigits. See format_number.

ChemistryQuantitativeAnalysis.getanalyteMethod
getanalyte(dt::AnalyteDataTable, id::Int)
getanalyte(dt::SampleDataTable, id::Int)
getanalyte(dt::AnalyteDataTable, analyte)
getanalyte(dt::SampleDataTable, analyte)

Get data belonging to analyte or analyteobj(dt)[id] as a Vector. For AnalyteDataTable, a new vector is created; mutating this vector will not change the value in dt.

ChemistryQuantitativeAnalysis.getformulaMethod
getformula(cal::MultipleCalibration)
getformula(type::Bool, zero::Bool)

Get a FormulaTerm based on type and zero or parameters from cal.

See MultipleCalibration for detail description of type and zero.

ChemistryQuantitativeAnalysis.getsampleMethod
getsample(dt::AnalyteDataTable, id::Int)
getsample(dt::SampleDataTable, id::Int)
getsample(dt::AnalyteDataTable, sample)
getsample(dt::SampleDataTable, sample)

Get data belonging to sample or sampleobj(dt)[id] as a Vector. For SampleDataTable, a new vector is created; mutating this vector will not change the value in dt.

ChemistryQuantitativeAnalysis.idcolMethod
idcol(dt::AbstractDataTable) -> Symbol

Unified interface for identity column. Equivalent to samplecol(dt::SampleDataTable) or analytecol(dt::SampleDataTable).

ChemistryQuantitativeAnalysis.inv_predictMethod
inv_predict(batch::Batch, at::AnalysisTable; rel_sig = :relative_signal)
inv_predict(batch::Batch, dt::AbstractDataTable)

Inversely predict concentration based on relative signal data, getproperty(at, rel_sig) or dt, and return the result as AbstractDataTable.

ChemistryQuantitativeAnalysis.inv_predictMethod
inv_predict(cal::AbstractCalibration, dt::AbstractDataTable; analyte = first(cal.analyte))
inv_predict(cal::SingleCalibration, y::AbstractArray)
inv_predict(cal::MultipleCalibration, y::AbstractArray)
inv_predict(cal::SingleCalibration)
inv_predict(cal::MultipleCalibration)

Inversely predict concentration of analyte or analyte specified in cal, and return the result as a vector using data in dt, y or cal.table.y as inverse predictors.

ChemistryQuantitativeAnalysis.lodMethod
lod(cal::MultipleCalibration)

Theoretical limit of quantification (LOQ); concentration of signal adding blank signal and 3.3 times standard deviation of LLOQ signal.

Blank signal is defined as the lowest signal such that the corresponding concentration is larger than 0.

ChemistryQuantitativeAnalysis.loqMethod
loq(cal::MultipleCalibration)

Theoretical limit of quantification (LOQ); concentration of signal adding blank signal and 10 times standard deviation of LLOQ signal.

Blank signal is defined as the lowest signal such that the corresponding concentration is larger than 0.

ChemistryQuantitativeAnalysis.mkbatchMethod
mkbatch(file::String; 
        delim = '	',
        data_table = SampleDataTable,
        signal_table = SampleDataTable,
        conc_table = SampleDataTable,
        data_config = Dict{Symbol, Any}(), 
        signal_config = Dict{Symbol, Any}(), 
        conc_config = Dict{Symbol, Any}(), 
        method_config = Dict{Symbol, Any}()
        )

Create a template directory of a batch. See "README.md" for available keys and values for config.

The default table wrapper is SampleDataTable, whose default sample column name is "Sample", and default sample column name for levels is "Level". The default analyte column name for AnalyteDataTable is "Analyte".

The priorities of default analytes are conc_config[:Analyte], signal_config[:Analyte], data_config[:Analyte], and lastly ["Analyte1", "Analyte2"]. The default samples for data are ["S1", "S2"]. The default calibration points are ["C1", "C2", "C3", "C4", "C5"]. The default calibration levels are [1, 2, 3, 4, 5].

ChemistryQuantitativeAnalysis.quantificationMethod
quantification(batch::Batch, at::AnalysisTable; signal = batch.method.signal)
quantification(batch::Batch, dt::AbstractDataTable)

Quantify all analyes based on relative signal data, and return the result as AbstractDataTable using getproperty(at, signal) or dt as signal data.

ChemistryQuantitativeAnalysis.quantificationMethod
quantification(cal::AbstractCalibration, dt::AbstractDataTable; analyte = cal.analyte)

Quantify analyte using data in dt as signals, and return the result as a vector.

ChemistryQuantitativeAnalysis.readMethod
ChemistryQuantitativeAnalysis.read(file::String, T; analytetype = String, sampletype = String, numbertype = Float64, delim = '\t')

Read ".scal" as SingleCalibration, ".mcal" as MultipleCalibration, ".sdt" as SampleDataTable, ".adt" as AnalyteDataTable, ".at" as AnalysisTable, ".am" as AnalysisMethod, and ".batch" as Batch.

T is the sink function for tabular data, analytetype is a concrete type for analyte, sampletype is a concrete type for sample, numbertype is the type for numeric data, and delim specifies delimiter for tabular data if config[:delim] does not exist.

For analytetype and sampletype, string(cqaconvert(analytetype, x)) and string(cqaconvert(sampletype, x)) should equal x if x is a valid string. Additionally, tryparse have to be extended for CSV parsing:

  • tryparse(::Type{analytetype}, x::AbstractString) is neccessary for AnalyteDataTable.
  • tryparse(::Type{sampletype}, x::AbstractString) is neccessary for SampleDataTable.

See README.md for the structure of ".batch" file.

ChemistryQuantitativeAnalysis.read_analysistableMethod
read_analysistable(file::String, T; analytetype = String, sampletype = String, numbertype = Float64, delim = '\t') -> AnalysisTable{analytetype, sampletype}

Read ".at" file into julia as AnalysisTable. T is the sink function for tabular data, analytetype is a concrete type for analyte, sampletype is a concrete type for sample, numbertype is the type for numeric data, and delim specifies delimiter for tabular data if config[:delim] in tables do not exist.

See ChemistryQuantitativeAnalysis.read for the requirements of analytetype and sampletype.

See README.md for the structure of ".at" file.

ChemistryQuantitativeAnalysis.read_analytedatatableMethod
read_analytedatatable(file::String, T; analytetype = String, sampletype = String, numbertype = Float64, delim = '\t') -> AnalyteDataTable{analytetype, sampletype, numbertype}

Read ".adt" file into julia as AnalyteDataTable. T is the sink function for tabular data, analytetype is a concrete type for analyte, sampletype is a concrete type for sample, numbertype is the type for numeric data, and delim specifies delimiter for tabular data if config[:delim] does not exist.

See ChemistryQuantitativeAnalysis.read for the requirements of analytetype and sampletype.

See README.md for the structure of ".adt" file.

ChemistryQuantitativeAnalysis.read_batchMethod
read_batch(file::String, T; analytetype = String, sampletype = String, numbertype = Float64, delim = '\t') -> Batch{analytetype}

Read ".batch" file into julia as Batch. T is the sink function for tabular data, analytetype is a concrete type for analyte, sampletype is a concrete type for sample, numbertype is the type for numeric data, and delim specifies delimiter for tabular data if config[:delim] does not exist.

See ChemistryQuantitativeAnalysis.read for the requirements of analytetype and sampletype.

See README.md for the structure of ".batch" file.

ChemistryQuantitativeAnalysis.read_calibrationMethod
read_calibration(file::String; analytetype = String, numbertype = Float64, delim = '\t') -> AbstractCalibration{analytetype, numbertype}

Read ".mcal" or ".scal" file into julia as MultipleCalibration or SingleCalibration. analytetype is a concrete type for analyte, , numbertype is the type for numeric data, and delim specifies delimiter for tabular data if config[:delim] does not exist.

numbertype is forced to Float64 because of issue of GLM.

See ChemistryQuantitativeAnalysis.read for the requirement of analytetype.

See README.md for the structure of ".mcal" and ".scal" file.

ChemistryQuantitativeAnalysis.read_datatableMethod
read_datatable(file::String, T; analytetype = String, sampletype = String, numbertype = Float64, delim = '\t', levelname = :level) -> AbstractDataTable{analytetype, sampletype, numbertype}

Read ".sdt" and ".adt" file into julia as SampleDataTable and AnalyteDataTable, respectively. T is the sink function for tabular data, analytetype is a concrete type for analyte, sampletype is a concrete type for sample, numbertype is the type for numeric data, and delim specifies delimiter for tabular data if config[:delim] does not exist. level is specifically used for AnalysisMethod, indicating the column representing calibration level; this column should be all integers.

See ChemistryQuantitativeAnalysis.read for the requirements of analytetype and sampletype.

See README.md for the structure of ".sdt" and ".adt" file.

ChemistryQuantitativeAnalysis.read_methodMethod
read_method(file::String, T; analytetype = String, sampletype = String, numbertype = Float64, delim = '\t') -> AnalysisMethod{analytetype, <: Table}

Read ".am" file into julia as AnalysisMethod. T is the sink function for tabular data, analytetype is a concrete type for analyte, sampletype is a concrete type for sample, numbertype is the type for numeric data, and delim specifies delimiter for tabular data if config[:delim] does not exist.

See ChemistryQuantitativeAnalysis.read for the requirements of analytetype and sampletype.

See README.md for the structure of ".am" file.

ChemistryQuantitativeAnalysis.read_sampledatatableMethod
read_sampledatatable(file::String, T; analytetype = String, sampletype = String, numbertype = Float64, delim = '\t', levelname = :level) -> SampleDataTable{analytetype, sampletype, numbertype}

Read ".sdt" file into julia as SampleDataTable. T is the sink function for tabular data, analytetype is a concrete type for analyte, sampletype is a concrete type for sample, numbertype is the type for numeric data, and delim specifies delimiter for tabular data if config[:delim] does not exist. level is specifically used for AnalysisMethod, indicating the column representing calibration level; this column should be all integers.

See ChemistryQuantitativeAnalysis.read for the requirements of analytetype and sampletype.

See README.md for the structure of ".sdt" file.

ChemistryQuantitativeAnalysis.relative_signalMethod
relative_signal(batch::Batch, at::AnalysisTable; signal = batch.method.signal)
relative_signal(method::AnalysisMethod, at::AnalysisTable; signal = method.signal)
relative_signal(batch::Batch, dt::AbstractDataTable)
relative_signal(method::AnalysisMethod, dt::AbstractDataTable)

Calculate relative signal using getproperty(at, signal) or dt as signal data, and return the result as AbstractDataTable.

ChemistryQuantitativeAnalysis.replace_cal!Method
replace_cal!(batch::Batch{A}, analyte::B, cal::C, isd::Union{D, Nothing} = isdof(cal, batch.method); type = true, zero = false, weight = 0) where {A, B <: A, C <: A, D <: A}

Delete calibration curve of analyte and replace it with calibration curve of cal. analyte must have a calibration curve. If cal has no caliration curve, a new calibration curve is fitted. The calibration curve use the new isd. All analytes use the calibration curve of analyte are affected.

ChemistryQuantitativeAnalysis.samplenameMethod
samplename(dt::AbstractDataTable) -> Vector{Symbol}
samplename(at::AnalysisTable) -> Vector{Symbol}

Equivalent to Symbol.(sampleobj(dt)) or Symbol.(sampleobj(at)).

ChemistryQuantitativeAnalysis.sampleobjMethod
sampleobj(dt::AbstractDataTable{A, S}) -> Vector{S}
sampleobj(at::AnalysisTable{A, S, T}) -> Vector{S}

Equivalent to getfield(dt, :sample) or getfield(at, :sample).

ChemistryQuantitativeAnalysis.set_accuracy!Method
set_accuracy!(at::AnalysisTable; true_conc = :true_concentration, est_conc = :estimated_concentration, acc = :accuracy)

Calculate accuracy, update or insert the values into at at index acc, and return the object using getproperty(at, true_conc) as true concentration and getproperty(at, est_conc) as estimated concentration.

ChemistryQuantitativeAnalysis.set_accuracyMethod
set_accuracy(at::AnalysisTable; true_conc = :true_concentration, est_conc = :estimated_concentration, acc = :accuracy)

Calculate accuracy, update or insert the values into a copy of at at index acc, and return the copy. using getproperty(at, true_conc) as true concentration and getproperty(at, est_conc) as estimated concentration.

ChemistryQuantitativeAnalysis.set_cal!Method
set_cal!(batch::Batch{A}, analyte::B, cal::C, isd::Union{D, Nothing} = isdof(cal, batch.method); type = true, zero = false, weight = 0) where {A, B <: A, C <: A, D <: A}

Set calibration curve for analyte to calibration curve of cal. cal must have a calibration curve. The calibration curve use the new isd.

ChemistryQuantitativeAnalysis.set_inv_predict!Method
set_inv_predict!(at::AnalysisTable, batch::Batch; rel_sig = :relative_signal, est_conc = :estimated_concentration)

Inversely predict concantration using getproperty(at, rel_sig) as relstive signal data, update or insert the value into at at index est_conc, and return at.

ChemistryQuantitativeAnalysis.set_inv_predictMethod
set_inv_predict(at::AnalysisTable, batch::Batch; rel_sig = :relative_signal, est_conc = :estimated_concentration)

Inversely predict concantration using getproperty(at, rel_sig) as relstive signal data, update or insert the value into a copy of at at index est_conc, and return the copy.

ChemistryQuantitativeAnalysis.set_isd!Method
set_isd!(batch::Batch{A}, analyte::B, isd::C) where {A, B <: A, C <: A}

Set internal standard of analyte to isd. analyte must have a calibration curve and all analytes use this curve will be affected.

ChemistryQuantitativeAnalysis.set_quantification!Method
set_quantification!(at::AnalysisTable, batch::Batch; signal = batch.method.signal, rel_sig = :relative_signal, est_conc = :estimated_concentration)

Quantify all analytes, update or insert the values into at at index rel_sig for relative signal and est_conc for concentration, and return at.

ChemistryQuantitativeAnalysis.set_quantificationMethod
set_quantification(at::AnalysisTable, batch::Batch; signal = batch.method.signal, rel_sig = :relative_signal, est_conc = :estimated_concentration)

Quantify all analytes using getproperty(at, signal) as signal data., update or insert the values into a copy of at at index rel_sig for relative signal and est_conc for concentration, and return the copy.

ChemistryQuantitativeAnalysis.set_relative_signal!Method
set_relative_signal!(at::AnalysisTable, batch::Batch; signal = batch.method.signal, rel_sig = :relative_signal)
set_relative_signal!(at::AnalysisTable, method::AnalysisMethod; signal = method.signal, rel_sig = :relative_signal)

Calculate relative signal using getproperty(at, signal) as signal data, update and insert the value into at at index rel_sig, and return at.

ChemistryQuantitativeAnalysis.set_relative_signalMethod
set_relative_signal(at::AbstractDataTable, batch::Batch; signal = batch.method.signal, rel_sig = :relative_signal)
set_relative_signal(at::AnalysisTable, method::AnalysisMethod; signal = method.signal, rel_sig = :relative_signal)

Calculate relative signal using getproperty(at, signal) as signal data, update or insert the value into a copy of at at index rel_sig, and return the copy.

ChemistryQuantitativeAnalysis.typedmapMethod
typedmap(::Type{T}, c...) 
typedmap(f, ::Type{T}, c...)

Transform collection c by applying f to each element. For multiple collection arguments, apply f elementwise, and stop when any of them is exhausted. The element type of returned collection will be forced to T. In addtion, typedmap(T, c...) is equivalent to typedmap(T, T, c...).

ChemistryQuantitativeAnalysis.update_accuracy!Method
update_accuracy!(batch::Batch; true_conc = :true_concentration, est_conc = :estimated_concentration, acc = :accuracy)

Calculate accuracy, and update or insert the values into batch.data or a copy of batch.data at index acc, and returns the updated batch. Use getproperty(batch.data, true_conc) as true concentration and getproperty(batch.data, est_conc) as estimated concentration. This function assigns at to batch.data

ChemistryQuantitativeAnalysis.update_calibration!Method
update_calibration!(batch::Batch{A}, analyte::B) where {A, B <: A}
update_calibration!(batch::Batch, cal_id::Int)
update_calibration!(cal::MultipleCalibration, method::AnalysisMethod)

Update calibration obeject for analyte, batch.calibration[cal_id] or cal after modifying any parameters in method or calibration object.

ChemistryQuantitativeAnalysis.update_inv_predict!Method
update_inv_predict!(batch::Batch; rel_sig = :relative_signal, est_conc = :estimated_concentration)

Inversely predict concentration using getproperty(batch.data, rel_sig) or dt as relstive signal data, update or insert the value into batch.data at index est_conc and returns the updated batch.

ChemistryQuantitativeAnalysis.update_quantification!Method
update_quantification!(batch::Batch; signal = batch.method.signal, rel_sig = :relative_signal, est_conc = :estimated_concentration)

Quantify all analytes using getproperty(at, signal) as signal data, update or insert the values into batch.data at index rel_sig for relative signal and est_conc for concentration, and returns the updated batch.

ChemistryQuantitativeAnalysis.update_relative_signal!Method
update_relative_signal!(batch::Batch; signal = batch.method.signal)

Calculate relative signal using getproperty(batch.data, signal) as signal data, update and insert the value into batch.data at index rel_sig, and return the updated batch.

ChemistryQuantitativeAnalysis.validate_accuracy!Method
validate_accuracy!(batch::Batch)
validate_accuracy!(cal::Vector{<: AbstractCalibration})
validate_accuracy!(cal::MultipleCalibration)
validate_accuracy!(cal::SingleCalibration)

Calculate accuracy for analyte specified by cal, update each cal.table.x̂ with the result(s), and return cal or batch.

ChemistryQuantitativeAnalysis.validate_inv_predict!Method
validate_inv_predict!(batch::Batch)
validate_inv_predict!(cal::Vector{<: AbstractCalibration})
validate_inv_predict!(cal::SingleCalibration)
validate_inv_predict!(cal::MultipleCalibration)

Inverse predict concentration, update each cal.table.x̂ with the result(s) and returns cal or batch.

ChemistryQuantitativeAnalysis.weight_reprMethod
weight_repr(cal::MultipleCalibration)
weight_repr(weight::Number)

Return string representation of cal.weight or weight.

"none" for 0, "1/√x" for -0.5, "1/x" for -1, "1/x²" for -2, "x^$weight" for other positive weight, and "1/x^$(abs(weight))" for other negative weight