Skip to content

Latest commit

 

History

History
162 lines (91 loc) · 2.87 KB

examples.md

File metadata and controls

162 lines (91 loc) · 2.87 KB

Examples

ENV["GKSwstype"] = "nul"

Import

Use pkimport to import PK data from table to subject set.

using MetidaNCA, CSV, DataFrames;

pkdata2 = CSV.File(joinpath(dirname(pathof(MetidaNCA)), "..", "test", "csv",  "pkdata2.csv")) |> DataFrame

ds = pkimport(pkdata2, :Time, :Concentration, [:Subject, :Formulation]; dosetime = DoseTime(dose = 100, time = 0))

sort!(ds, :Subject)

NCA

Perform NCA analysis with nca!. Access to result set is similar to DataFrame or any table. Find parameter list [here](@ref parameter_list).

dsnca = nca!(ds, adm = :ev, calcm = :lint)

dsnca[:, :AUClast]

Partial AUC

dsnca = nca!(ds, adm = :ev, calcm = :lint, partials = [(1, 7)])

dsnca[:, :AUC_1_7]

Print output

dsnca = nca!(ds[1], adm = :ev, calcm = :lint, verbose = 2);

Plotting

using Plots

p = pkplot(ds; typesort = :Subject, pagesort = nothing, filter = Dict(:Formulation => "R"))

png(p, "plot1.png")

p = pkplot(ds; typesort = :Formulation, pagesort = nothing, legend = true)

png(p, "plot2.png")

p = pkplot(ds; elim = true, ls = true)

png(p[1], "plot3.png")

p = pkplot(ds; typesort = :Subject, pagesort = :Formulation)

png(p[1], "plot4.png")

Plot 1

Plot 2

Plot 3

Plot 4

Set dose time

You can set dose time with setdosetime! for whole subject set or for selected subjects.

dt = DoseTime(dose = 200, time = 0)

setdosetime!(ds, dt, Dict(:Formulation => "R"))

dsnca = nca!(ds)

dsnca[:, :Dose]

Set range for elimination

By default no exclusion or range specified. With setkelrange! elimination range and exclusion can be specified for whole subject set or for any selected subjects.

kr =  ElimRange(kelstart = 4, kelend = 12, kelexcl = Int[5,6])

setkelrange!(ds, kr, [1,2,3])

dsnca = nca!(ds)

p = pkplot(ds[1]; elim = true)

png(p, "plot5.png")

getkeldata(ds[1])

Plot 5

Without import

You can use nca for NCA analysis directly from tabular data.


dsnca = nca(pkdata2, :Time, :Concentration, [:Subject, :Formulation]; dosetime = DoseTime(dose = 100, time = 0))

sort!(dsnca, :Subject)

dsnca[:, :AUClast]

PD subject

Use pdimport to import PD data from table to subject set.

Import & NCA


pddata = CSV.File(joinpath(dirname(pathof(MetidaNCA)), "..", "test", "csv",  "pddata.csv")) |> DataFrame

pd =  MetidaNCA.pdimport(pddata, :time, :obs, :subj; bl = 1.5, th = 5.0)

MetidaNCA.nca!(pd[1])

PD subject plotting


p = MetidaNCA.pkplot(pd[1], drawth = true, drawbl = true)

png(p, "plot6.png")