tensfeldt / openNCA

openNCA computation engine is an R package that provides for generation of pharmacokinetic parameter estimates using non-compartmental (NCA) pharmacokinetic analysis methods.
MIT License
27 stars 5 forks source link

Partial AUCs fail to compute if missing concentration values appear in the "middle" of the profile #283

Open tensfeldt opened 3 years ago

tensfeldt commented 3 years ago

testcase tc1922_M1SD

An example profile would be:

> d %>% filter(SDEID==3270315933) %>% select(SDEID, SUBJID, PKPTMS, PKATPD, PKCNC, PKCNCN)
        SDEID   SUBJID     PKPTMS PKATPD  PKCNC PKCNCN
1  3270315933 10011004 0.00000000  0.000 < 40.0  0.000
2  3270315933 10011004 0.05000000  0.050            NA
3  3270315933 10011004 0.08333333  0.117   2290  2.290
4  3270315933 10011004 0.16666667  0.167   2920  2.920
5  3270315933 10011004 0.25000000  0.350   6420  6.420
6  3270315933 10011004 0.50000000  0.567   5530  5.530
7  3270315933 10011004 0.75000000  0.750   4960  4.960
8  3270315933 10011004 1.00000000  1.000   4820  4.820
9  3270315933 10011004 1.50000000  1.500   3540  3.540
10 3270315933 10011004 2.00000000  2.000   3640  3.640
11 3270315933 10011004 3.00000000  3.000   2980  2.980
12 3270315933 10011004 4.00000000  4.000   2930  2.930
13 3270315933 10011004 6.00000000  6.000   1210  1.210
14 3270315933 10011004 8.00000000  8.050    555  0.555

When requesting partial AUCs for AUC0_0.0417, AUC_0.083, AUC0_0.25, AUC0_0.5 with commit f5bfc3a an error message indicates that there is an error in interpolate_lin routine.

> results_list <- run_computation(data=d, map=mct, flag=flags, parameterset=parameterset)
Error in value[[3L]](cond) : 
  Error in interpolate_lin(conc1 = orig_conc[idx], time1 = orig_time[idx], : Error in interpolate_lin: 'conc1' value is NULL or NA
For SDEID 3270315933
In addition: Warning messages:
1: In validate_timeconc_data(map, data, flag, verbose = verbose) :
  No tau information provided in 'map'.
2: In validate_timeconc_data(map, data, flag, verbose = verbose) :
  No told information provided in 'map'.
3: In run_computation(data = d, map = mct, flag = flags, parameterset = parameterset) :
  'TAUs and TOLDs values are not provided via 'flag'! Using values provided via 'data' instead (if present)!

and no results appear for AUC0_0.083, AUC0_0.417

> r %>% filter(SDEID==3270315933) %>% select(SUBJID, SDEID, matches("^AUC[0-9]+?_[0-9.]+?$"))
    SUBJID      SDEID AUC0_0.083 AUC0_0.0417 AUC0_0.25 AUC0_0.5
1 10011004 3270315933         NA          NA 0.4246567 1.899856

When requesting partial AUCs for AUC0_0.0417, AUC0_0.083, AUC0_0.25, AUC0_0.5 with commit c3d3f48 no error message appears:

> results_list <- run_computation(data=d, map=mct, flag=flags, parameterset=parameterset)
openNCA computation engine version 3.0.0
Computation Run Date/Time: 2021-01-28 10:53:24
unit_conversion : Unit Class 1 (Time) time_col:  TMAX TMIN TLAST TLAG KELTMLO KELTMHI THALF LASTTIME MRTLAST MRTEVIFO MRTEVIFP  parameters are scaled from  HR  to  HR  via scaling factor:  1 
unit_conversion : Unit Class 3 (Dose) dose_col:  DOSE  parameters are scaled from  MG  to  MG  via scaling factor:  1 
unit_conversion : Unit Class 4 (Volume) volume_col:  VZFO VZFP  parameters are scaled from  ML  to  L  via scaling factor:  0.001 
unit_conversion : Unit Class 5 (Amount/Volume) conc_col:  CMAX CMIN CLAST CEST KELC0  parameters are scaled from  NG/ML  to  NG/ML  via scaling factor:  1 
unit_conversion : Unit Class 6 (1/Time) kel_col:  KEL  parameters are scaled from  1/HR  to  1/HR  via scaling factor:  1 
unit_conversion : Unit Class 7 (Volume/Time) cl_col:  CLFO CLFP  parameters are scaled from  ML/HR  to  L/HR  via scaling factor:  0.001 
unit_conversion : Unit Class 8: (Amount.Time/Volume) auc_col:  AUCALL AUCLAST AUCLASTC AUC1 AUC2 AUC3 AUC4 AUC5 AUC6 AUC7 AUC8 AUC9 AUC10 AUC11 AUC12 AUC13 AUCINFO AUCINFP AUCINFOC AUCINFPC  parameters are scaled from  NG.HR/ML  to  NG.HR/ML  via scaling factor:  1 
unit_conversion : Unit Class 9: (Amount.Time.Time/Volume) aumc_col:  AUMCLAST AUMCINFO AUMCINFP  parameters are scaled from  NG.HR.HR/ML  to  NG.HR.HR/ML  via scaling factor:  1 
unit_conversion : Unit Class 10: ([Amount.Time/Volume]/Amount) aucdn_col:  AUCALLDN AUCLASTDN AUC1DN AUC2DN AUC3DN AUC4DN AUC5DN AUC6DN AUC7DN AUC8DN AUC9DN AUC10DN AUC11DN AUC12DN AUC13DN AUCINFODN AUCINFPDN  parameters are scaled from  NG.HR/ML/MG  to  NG.HR/ML/MG  via scaling factor:  1 
unit_conversion : Unit Class 12: ([Amount/Volume]/Amount) concdn_col:  CMAXDN CMINDN  parameters are scaled from  NG/ML/MG  to  NG/ML/MG  via scaling factor:  1 
unit_conversion : Unit Class 14: (Volume/Body Weight) volumew_col:  VZFOW VZFPW  parameters are scaled from  ML/KG  to  L/KG  via scaling factor:  0.001 
unit_conversion : Unit Class 15: (Volume/Time/Body Weight) clw_col:  CLFOW CLFPW  parameters are scaled from  ML/HR/KG  to  L/HR/KG  via scaling factor:  0.001 
Warning messages:
1: In validate_timeconc_data(map, data, flag, verbose = verbose) :
  No tau information provided in 'map'.
2: In validate_timeconc_data(map, data, flag, verbose = verbose) :
  No told information provided in 'map'.
3: In run_computation(data = d, map = mct, flag = flags, parameterset = parameterset) :
  'TAUs and TOLDs values are not provided via 'flag'! Using values provided via 'data' instead (if present)!
4: In run_M1_SD_computation(data = merged_data, map = map_data, method = method,  :
  Flag 'FLGACCEPTTMAXCRIT' is not provided via 'map' does not have a proper format! 'FLGACCEPTTMAX' will not be generated!
5: In unit_conversion(data = data_data, map = map_data, result = computation_df,  :
  'AMOUNTU' #2# is not present in the dataset provided via 'map'
6: In unit_conversion(data = data_data, map = map_data, result = computation_df,  :
  'PKATPDU' and 'PKCONCU' #10# are not present in the dataset provided via 'map'

However, again, there are no results for AUC0_0.083 nor AUC0_0.417:

> r %>% filter(SDEID==3270315933) %>% select(SUBJID, SDEID, matches("^AUC[0-9]+?_[0-9.]+?$"))
    SUBJID      SDEID AUC0_0.083 AUC0_0.0417 AUC0_0.25 AUC0_0.5
1 10011004 3270315933         NA          NA 0.4246567 1.899856