hi Jafar,
Is there any option in read_nca function for scaling PK parameters to compute them in right units instead of applying transformation to the dataset?
For example, concentration is the dataset is in “ng/mL”, time in “hr”, amt in “µg”. If I want my AUC in “µg h/mL" instead of "ng h/mL” is there option to scale the parameter instead of changing the concentration in dataset?
Let’s take an example dataset in the repository:
using Pumas, CSV
file = Pumas.example_data("nca_test_data/dapa_IV")
data = CSV.read(file)
timeu = u"hr"
concu = u"mg/L"
amtu = u"mg"
data.route = "iv"
pop = read_nca(data,id=:ID,time=:TIME,conc=:CObs,amt=:AMT_IV,route=:route, llq=0concu, timeu=timeu, concu=concu, amtu=amtu)
report = NCAReport(pop)
reportdf = NCA.to_dataframe(report)
These are the units of the report for example
julia> reportdf
24×49 DataFrame. Omitted printing of 42 columns
│ Row │ id │ doseamt │ lambda_z │ half_life │ tmax │ cmax │ c0 │
│ │ Int64 │ Quantity… │ Quantity… │ Quantity… │ Quantity… │ Quantity… │ Quantity… │
├─────┼───────┼───────────┼─────────────────┼────────────┼───────────┼─────────────────┼─────────────────┤
│ 1 │ 1 │ 5000.0 mg │ 0.0387671 hr^-1 │ 17.8798 hr │ 0.0 hr │ 157.021 mg L^-1 │ 157.021 mg L^-1 │
│ 2 │ 2 │ 5000.0 mg │ 0.0817121 hr^-1 │ 8.48279 hr │ 0.05 hr │ 66.354 mg L^-1 │ 59.7702 mg L^-1 │
│ 3 │ 3 │ 5000.0 mg │ 0.0397477 hr^-1 │ 17.4387 hr │ 0.0 hr │ 165.733 mg L^-1 │ 165.733 mg L^-1 │
│ 4 │ 4 │ 5000.0 mg │ 0.0581041 hr^-1 │ 11.9294 hr │ 0.0 hr │ 133.911 mg L^-1 │ 133.911 mg L^-1 │
⋮
│ 20 │ 20 │ 5000.0 mg │ 0.0534663 hr^-1 │ 12.9642 hr │ 0.0 hr │ 57.2367 mg L^-1 │ 57.2367 mg L^-1 │
│ 21 │ 21 │ 5000.0 mg │ 0.113931 hr^-1 │ 6.08392 hr │ 0.0 hr │ 47.1919 mg L^-1 │ 47.1919 mg L^-1 │
│ 22 │ 22 │ 5000.0 mg │ 0.0307751 hr^-1 │ 22.523 hr │ 0.05 hr │ 102.389 mg L^-1 │ 86.8349 mg L^-1 │
│ 23 │ 23 │ 5000.0 mg │ 0.0597314 hr^-1 │ 11.6044 hr │ 0.0 hr │ 77.3496 mg L^-1 │ 77.3496 mg L^-1 │
│ 24 │ 24 │ 5000.0 mg │ 0.0404818 hr^-1 │ 17.1224 hr │ 0.05 hr │ 74.3649 mg L^-1 │ 66.5963 mg L^-1 │
The units of AUC column are as below.
julia> reportdf.aucinf_obs
24-element Array{Quantity{Float64,𝐌*𝐓*𝐋^-3,Unitful.FreeUnits{(mg, hr, L^-1),𝐌*𝐓*𝐋^-3,nothing}},1}:
263.792662196049 mg hr L^-1
323.2533439613785 mg hr L^-1
339.84792808904837 mg hr L^-1
373.360946860749 mg hr L^-1
132.14481344725763 mg hr L^-1
303.8596881999132 mg hr L^-1
380.27460697024947 mg hr L^-1
⋮
433.44327448736294 mg hr L^-1
214.27036373424414 mg hr L^-1
232.53655710134987 mg hr L^-1
471.51535420553466 mg hr L^-1
292.41303501773064 mg hr L^-1
170.30517949572166 mg hr L^-1
You can change them to e.g. μg hr L^-1
like this
julia> uconvert.(u"μg*hr/L",reportdf.aucinf_obs)
24-element Array{Quantity{Float64,𝐌*𝐓*𝐋^-3,Unitful.FreeUnits{(μg, hr, L^-1),𝐌*𝐓*𝐋^-3,nothing}},1}:
263792.662196049 μg hr L^-1
323253.3439613785 μg hr L^-1
339847.92808904836 μg hr L^-1
373360.946860749 μg hr L^-1
132144.81344725762 μg hr L^-1
303859.6881999132 μg hr L^-1
380274.60697024944 μg hr L^-1
⋮
433443.27448736294 μg hr L^-1
214270.36373424414 μg hr L^-1
232536.55710134987 μg hr L^-1
471515.3542055347 μg hr L^-1
292413.0350177306 μg hr L^-1
170305.17949572165 μg hr L^-1
You can do this for any column in the report dataframe. We will provide a convenience function that will allow the user to specify preferred units as a global option in your session and the report will have those units. Thanks for bringing it up.
How to supply arguments to read_nca to specify what type of auc calculation I want? Can I use the arguments for NCA.auc and pass them directly to read_nca ?
You don’t supply this to the read_nca
whose main job is to do a data sanity check. All the arguments that are available for the individual NCA
function are readily available in the NCAReport
. So, e.g. if you are using this for your auc
computation,
dapa_auc = NCA.auc(pop,auctype=:inf, method=:linuplogdown,threshold=3)
you can pass those arguments directly into NCAReport
report_with_args = NCAReport(pop,auctype=:inf, method=:linuplogdown,threshold=3)
reportdf_with_args = NCA.to_dataframe(report_with_args)
When trying to save the NCAReport dataframe as a CSV file, I see that parameter units get appended to every cell value which makes it difficult to view/interpret. Is there any way to suppress addition of parameter units to the values in each column? If there’s no option to do directly, can you help parsing the numerical values from NCAReport dataframe in Julia?
Currently, we have no way of putting this into the header row. however, one option is to get the NCA with units and then run a subsequent run where you don’t pass the units into read_nca
. We understand this is cumbersome, but once we find a solution to have it only in the header row, we will bring that change in.
Further, we are also bringing in a change where the NCA parameters can be directly output in the CDISC format. This will be implemented in the upcoming few releases after it is tested.
Hope this helps.
Vijay