diff --git a/Project.toml b/Project.toml index 5e80938..f19f97b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,8 @@ name = "MetidaNCA" uuid = "097c2839-c7bc-4c4b-a5f2-b4167c1b4e7c" authors = ["PharmCat "] -version = "0.5.9" +version = "0.5.10" + [deps] diff --git a/docs/Project.toml b/docs/Project.toml index 8d27f9a..6e76203 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -10,11 +10,11 @@ Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" [compat] -Documenter = "≥0.25" +Documenter = "1" MetidaNCA = "0.5" CSV = "0.8, 0.9, 0.10" DataFrames = "1" PrettyTables = "1, 2" Weave = "0.9, 0.10" Plots = "1" -Latexify = "0.14, 0.15" +Latexify = "0.14, 0.15, 0.16" diff --git a/docs/src/details.md b/docs/src/details.md index a2ef253..f468f29 100644 --- a/docs/src/details.md +++ b/docs/src/details.md @@ -1,5 +1,15 @@ # Details +## Using LimitRule + +```julia +ll = LimitRule(;lloq = 0.1, btmax = 0.0, atmax = NaN, nan = NaN, rm = true) + +``` + +It means that all values below `lloq` will be replaced by `btmax` before Tmax and replaced by `atmax` after Tmax; `NaN` values will be replaced by `nan`. If `rm` is `true`, all `NaN` values will be deleted. + + ## Calculation steps for PK NCA ### Step 1 diff --git a/src/import.jl b/src/import.jl index 1d116c7..dc7af1c 100644 --- a/src/import.jl +++ b/src/import.jl @@ -103,6 +103,8 @@ keywords: If time column have non-unique values - last pair time-concentration will be used. + +See also: [`ElimRange`](@ref), [`DoseTime`](@ref), [`LimitRule`](@ref). """ function pkimport(data, time, conc, sort; kelauto = true, elimrange = ElimRange(), dosetime = nothing, limitrule::Union{Nothing, LimitRule} = nothing, warn = true, kwargs...) if isa(sort, String) sort = [Symbol(sort)] end @@ -181,6 +183,7 @@ end kwargs...) Import PK data from time vector `time` and concentration vector `conc`. + """ function pkimport(time, conc; kelauto = true, elimrange = ElimRange(), dosetime = nothing, id = Dict{Symbol, Any}(), limitrule::Union{Nothing, LimitRule} = nothing, warn = true, kwargs...) timevals_sp, concvals_sp = checkvalues(time, conc, warn = warn) diff --git a/src/nca.jl b/src/nca.jl index 6d2695c..8136eaf 100644 --- a/src/nca.jl +++ b/src/nca.jl @@ -392,6 +392,8 @@ Import data and perform NCA analysis. Syntax simillar to [`pkimport`](@ref) Applicable `kwargs` see [`nca!`](@ref). + +See also: [`ElimRange`](@ref), [`DoseTime`](@ref), [`LimitRule`](@ref). """ function nca(args...; type::Symbol = :bps, bl = 0, th = 0, kelauto = true, elimrange = ElimRange(), dosetime = DoseTime(), limitrule::Union{Nothing, LimitRule} = nothing, kwargs...) if !(type in (:bps, :ur, :pd)) error("Unknown type") end @@ -411,11 +413,12 @@ end Non-compartmental (NCA) analysis of PK/PD data. """ function nca!(data::DataSet{Subj}; kwargs...) where Subj <: AbstractSubject - result = Vector{NCAResult{Subj}}(undef, length(data)) - for i = 1:length(data) - result[i] = nca!(data[i]; kwargs...) - end - DataSet(result) + #result = Vector{NCAResult{Subj}}(undef, length(data)) + #for i = 1:length(data) + # result[i] = nca!(data[i]; kwargs...) + #end + #DataSet(result) + map(x -> nca!(x; kwargs...), data) end """ diff --git a/src/plots.jl b/src/plots.jl index e80c5b3..57532ca 100644 --- a/src/plots.jl +++ b/src/plots.jl @@ -393,6 +393,7 @@ function pkplot(data::DataSet{T}; filter::Union{Nothing, Dict{Symbol}} = nothing, uylims::Bool = false, ldict = nothing, + savepng = nothing, kwargs...) where T <: AbstractSubject kwargs = Dict{Symbol, Any}(kwargs) @@ -414,6 +415,16 @@ function pkplot(data::DataSet{T}; end if !isnothing(filter) data = subset(data, filter) end + if !isnothing(typesort) + if isa(typesort, Symbol) typesort = [typesort] end + typelist = uniqueidlist(data, typesort) + else + typelist = nothing + if !(:legend in k) + kwargs[:legend] = false + end + end + if isnothing(typesort) && isnothing(pagesort) p = [] printtitle = false @@ -430,19 +441,7 @@ function pkplot(data::DataSet{T}; push!(p, pkplot(subj; kwargs...)) end return p - end - - if !isnothing(typesort) - if isa(typesort, Symbol) typesort = [typesort] end - typelist = uniqueidlist(data, typesort) - else - typelist = nothing - if !(:legend in k) - kwargs[:legend] = false - end - end - - if !isnothing(pagesort) && !isa(pagesort, NoPageSort) + elseif !isnothing(pagesort) && !isa(pagesort, NoPageSort) if isa(pagesort, Symbol) pagesort = [pagesort] end p = [] pagelist = uniqueidlist(data, pagesort)