metrumresearchgroup / bbi

Next generation modeling platform
https://metrumresearchgroup.github.io/bbi/docs
12 stars 2 forks source link

Add flags to support not using files #36

Open david-lyder opened 5 years ago

david-lyder commented 5 years ago

Summary

In the case that only a subset of files are available, for example only the lst file, a summary file can be generated that still has reasonable outputs. For example, the lst file does contain all parameter estimates. They don't have as many significant digits as the ext file, however historically, only the lst file is often shared/captured and the ext file is not always available in modeling archives.

In addition, certain files are only produced under certain conditions, so we must delineate between when a user wants to override the default behavior, vs if we cannot get valid output without that file. For example, we could get reasonable parameter estimates only from the lst file, hence a user may want to just pull from the lst file and ignore the ext even if its available.

Currently the following files are used in addition to the lst file to capture NONMEM data: ext grd cov cor

Add flags to allow the file to not be used and not throw a panic:

--no-ext-file --no-grd-file --no-cov-file --no-cor-file

To exercise summary: from: github.com/metrumresearchgroup/babylon/testdata/example-models/nonmem/BQL bbi summary --json 2

Tests

david-lyder commented 5 years ago

Before change:

bbi summary --json 2 panic: open /Users/davidl/go/src/github.com/metrumresearchgroup/babylon/testdata/example-models/nonmem/BQL/2.ext: no such file or directory

goroutine 1 [running]: github.com/metrumresearchgroup/babylon/parsers/nmparser.GetModelOutput(0x7ffeefbffb7b, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...) /Users/davidl/go/src/github.com/metrumresearchgroup/babylon/parsers/nmparser/get_model_output.go:34 +0x1132 github.com/metrumresearchgroup/babylon/cmd.summary(0x193b500, 0xc0000b4940, 0x1, 0x2) /Users/davidl/go/src/github.com/metrumresearchgroup/babylon/cmd/summary.go:44 +0xa4 github.com/spf13/cobra.(Command).execute(0x193b500, 0xc0000b48e0, 0x2, 0x2, 0x193b500, 0xc0000b48e0) /Users/davidl/go/src/github.com/metrumresearchgroup/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830 +0x2aa github.com/spf13/cobra.(Command).ExecuteC(0x193ad80, 0x12, 0xc000145f00, 0x1) /Users/davidl/go/src/github.com/metrumresearchgroup/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x2fb github.com/spf13/cobra.(*Command).Execute(...) /Users/davidl/go/src/github.com/metrumresearchgroup/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864 github.com/metrumresearchgroup/babylon/cmd.Execute(0x1600f40, 0x18) /Users/davidl/go/src/github.com/metrumresearchgroup/babylon/cmd/root.go:58 +0xe5 main.main() /Users/davidl/go/src/github.com/metrumresearchgroup/babylon/cmd/bbi/main.go:17 +0x39

david-lyder commented 5 years ago

After change:

bbi summary --no-ext --json 2

{ "run_details": { "version": "7.4.3", "run_start": "Wed Sep 11 10:19:21 EDT 2019", "run_end": "Wed Sep 11 10:19:35 EDT 2019", "estimation_time": 4.04, "covariance_time": 0.06, "function_evaluations": 189, "significant_digits": 3.4, "problem_text": "LEM RUN# 2 - 2cmpt model - no BQLs", "estimation_method": [ "First Order Conditional Estimation with Interaction" ], "data_set": "../nobqldata.csv", "number_of_patients": 193, "number_of_obs": 2702, "number_of_data_records": 2895, "output_files_used": [ "/Users/davidl/go/src/github.com/metrumresearchgroup/babylon/testdata/example-models/nonmem/BQL/2.lst", "/Users/davidl/go/src/github.com/metrumresearchgroup/babylon/testdata/example-models/nonmem/BQL/2.grd" ] }, "run_heuristics": { "large_condition_number": "HeuristicFalse", "correlations_ok": "HeuristicTrue", "has_final_zero_gradient": "HeuristicFalse", "minimization_successful": "HeuristicTrue" }, "parameters_data": [ { "estimates": { "theta": [ 26.5, 283, 297, 58.7, 1.51, 0.75, 1, 1, 0.75 ], "omega": [ 0.101, 0, 0.036, 0, 0, 0.0112 ], "sigma": [ 0.00245, 0.317, 0, 0.19, 0, 0, 0.106, 0.0495 ] }, "std_err": { "theta": [ 0.609, 4.41, 2.33, 1.01, 0.0213, 0, 0, 0, 0 ], "omega": [ 0.00959, 0, 0.00353, 0, 0, 0.00186 ], "sigma": [ 0.0000734, 0.0151, 0, 0.00931, 0, 0, 0.00882, 0.000741 ] }, "random_effect_sd": {}, "random_effect_sdse": {}, "fixed": {} } ], "parameter_structures": { "Theta": 9, "Omega": [ 1, 0, 1, 0, 0, 1 ], "Sigma": [ 1 ] }, "parameter_names": { "theta": [ "1 CLF", "2 V2F", "3 V3F", "4 QF", "5 KA", "6 POW_CL", "7 POW_V2", "8 POW_V3", "9 POW_Q" ] }, "ofv": { "ofv": 4965.943833438051, "ofv_no_constant": -14346.006, "ofv_with_constant": -9380.062196247563 }, "shrinkage_details": { "eta": { "sd": [ 0.40632, 2.0606, 18.484 ], "vr": [ 0.81099, 4.0787, 33.551 ] }, "ebv": { "sd": [ 0.49256, 2.1487, 18.703 ], "vr": [ 0.98269, 4.2512, 33.908 ] }, "eps": { "sd": [ 9.7026 ], "vr": [ 18.464 ] } }, "covariance_theta": [ { "Values": [ 0.370979, -0.214341, -0.150899, -0.0241113, 0.00104312, 0, 0, 0, 0, -0.214341, 19.4116, -3.53392, -1.9927, 0.0364529, 0, 0, 0, 0, -0.150899, -3.53392, 5.42576, 1.44045, -0.0283908, 0, 0, 0, 0, -0.0241113, -1.9927, 1.44045, 1.02609, -0.0157357, 0, 0, 0, 0, 0.00104312, 0.0364529, -0.0283908, -0.0157357, 0.000452737, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], "Dim": 9 } ], "correlation_theta": [ { "Values": [ 0.60908, -0.079873, -0.10636, -0.0390799, 0.0804893, 0, 0, 0, 0, -0.079873, 4.40586, -0.344346, -0.446497, 0.388847, 0, 0, 0, 0, -0.10636, -0.344346, 2.32933, 0.610485, -0.572828, 0, 0, 0, 0, -0.0390799, -0.446497, 0.610485, 1.01296, -0.730081, 0, 0, 0, 0, 0.0804893, 0.388847, -0.572828, -0.730081, 0.0212776, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ], "Dim": 9 } ] }