From 1b98277a7f09226cc91054b9de77d5e0a3264955 Mon Sep 17 00:00:00 2001 From: PharmCat <13901158+PharmCat@users.noreply.github.com> Date: Wed, 13 Nov 2024 02:47:32 +0300 Subject: [PATCH] minor changes --- src/MetidaNCA.jl | 1 + src/nca.jl | 7 +++++++ src/show.jl | 6 +++--- test/pdtest.jl | 3 +++ test/tests.jl | 17 +++++++++++++++++ 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/MetidaNCA.jl b/src/MetidaNCA.jl index 622e6bf..a489a28 100644 --- a/src/MetidaNCA.jl +++ b/src/MetidaNCA.jl @@ -37,6 +37,7 @@ PKSubject, UPKSubject, PDSubject, NCAResult function __init__() @require Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" begin savefig = Plots.savefig + current = Plots.current end end diff --git a/src/nca.jl b/src/nca.jl index 8f766ae..bceabb1 100644 --- a/src/nca.jl +++ b/src/nca.jl @@ -1100,7 +1100,14 @@ function nca!(data::PDSubject{T,O}; calcm = :lint, intpm = nothing, verbose = 0, ################################################################################ result[:Obsnum] = obsnum = length(obs_cp) + result[:BL] = data.bl + + result[:TH] = data.th + + result[:Rmax], result[:Tmax], tmaxn = ctmax(time_cp, obs_cp, length(obs_cp)) + + # ALL NAN AND MISSING VALUES LINEAR INTERPOLATED step_2_interpolate!(time_cp, obs_cp, einds, 1, :lint) diff --git a/src/show.jl b/src/show.jl index 76e1149..c014070 100644 --- a/src/show.jl +++ b/src/show.jl @@ -59,13 +59,13 @@ function Base.show(io::IO, obj::PDSubject) PrettyTables.pretty_table(io, metida_table(obj.time, obj.obs; names = (:Time, :Observation)); tf = PrettyTables.tf_compact) end -function subject_type_str(subj::Type{<:PKSubject}) +function subject_type_str(subj::Type{PKS}) where PKS <: PKSubject "Pharmacokinetics subject" end -function subject_type_str(subj::Type{<:UPKSubject}) +function subject_type_str(subj::Type{UPKS}) where UPKS <: UPKSubject "Pharmacokinetics subject (urine)" end -function subject_type_str(subj::Type{<:PDSubject}) +function subject_type_str(subj::Type{PDS}) where PDS <: PDSubject "Pharmacodynamics subject" end function Base.show(io::IO, obj::DataSet{ST}) where ST <: AbstractSubject diff --git a/test/pdtest.jl b/test/pdtest.jl index afb01f4..6ce282f 100644 --- a/test/pdtest.jl +++ b/test/pdtest.jl @@ -6,6 +6,9 @@ @test_nowarn MetidaNCA.pkplot(pd) @test_nowarn MetidaNCA.pkplot(pd[1], drawth = true, drawbl = true) + p = plot() + @test_nowarn MetidaNCA.pkplot!(pd[1], drawth = true, drawbl = true) + pd_res = MetidaNCA.nca!(pd[1]) pd_rds = MetidaNCA.nca!(pd) diff --git a/test/tests.jl b/test/tests.jl index 2bcc94d..23cc2a6 100644 --- a/test/tests.jl +++ b/test/tests.jl @@ -75,6 +75,9 @@ include("refdicts.jl") # If typesort defined and NoPageSort() return one plot pl = @test_nowarn MetidaNCA.pkplot(ds; typesort = :Subject, pagesort = MetidaNCA.NoPageSort(), sort = Dict(:Formulation => "R")) @test isa(pl, Plots.Plot) == true + #@test_throws "There is no pkplot! methods for DataSet, use pkplot or pkplot! for each subject separately." MetidaNCA.pkplot!(ds; typesort = :Subject, pagesort = MetidaNCA.NoPageSort(), sort = Dict(:Formulation => "R")) + + pl = @test_nowarn MetidaNCA.pkplot(ds; typesort = :Formulation, pagesort = MetidaNCA.NoPageSort(), legend = true) @test isa(pl, Plots.Plot) == true @@ -107,12 +110,26 @@ include("refdicts.jl") @test isa(pl, Plots.Plot) == true # Return plot for PKSubject + + @test_nowarn MetidaNCA.pkplot(ds[1].time, ds[1].obs) + @test_nowarn MetidaNCA.pkplot!(ds[1].time, ds[1].obs) + p = plot() + @test_nowarn MetidaNCA.pkplot!(p, ds[1].time, ds[1].obs) + p = plot() + @test_nowarn MetidaNCA.pkplot!(ds[1]) + #p = plot() + #@test_nowarn MetidaNCA.pkplot!(ds[1]) + @test_nowarn pl = MetidaNCA.pkplot(ds[1]; ylims = (0, 250), yscale = :log10, legend = false) @test_nowarn pl = MetidaNCA.pkplot(ds[1]; elim = true, ls = false) @test_nowarn MetidaNCA.plotstyle(40) pl = MetidaNCA.pkplot(ds[3]) pl = MetidaNCA.pkplot!(ds[2]; yscale = :log10) + p = plot() + MetidaNCA.pkplot!(ds[1]; ylims = (0, 250), yscale = :log10, legend = false) + #MetidaNCA.pkplot!(p, ds[1]; ylims = (0, 250), yscale = :log10, legend = false) + kr = MetidaNCA.ElimRange(kelstart = 4, kelend = 12, kelexcl = Int[5,6]) MetidaNCA.setkelrange!(ds, kr, [1,2,3]) dsnca = MetidaNCA.nca!(ds)