Open-Systems-Pharmacology / Matlab-Toolbox

Collection of Matlab® functions for the processing of PK-Sim® or MoBi® models
Other
3 stars 2 forks source link

Matlab toolbox generateMatlabCodeForXML error " Variable Parameter" is missing #97

Open PriKalra opened 5 years ago

PriKalra commented 5 years ago

Hi,

I am using Matlab 2018b and OSP version 7.4.0. Recently, on one of my exports I got the error raised in the issue #96 and I executed the required steps:

StephanSchaller commented 5 years ago

I am using the R-Toolbox, but should you not provide the list of variable parameters. sth. like: whichInitParam = "none" or whichInitParam = "AllNonFormula" ?

Open initSimulation.m and check the mandatory inputs.

Hope this helps, Stephan

PriKalra commented 5 years ago

Hi Stephan,

Thank you for the comment. However, I have the following confusion (probably because of my not being well acquainted with the function and not running into this problem before):

  1. My first and basic question is: How is this mandatory input defined in PKSim? Because in the past I didn't have to modify the InitSimulation.m function so I am wondering if there is anything missing in the structure of my PKSim file for this error?

  2. I tried to open the initSimulation.m but I am a bit lost at what section should I change the function? attached is the snippet of code where the error is thrown.

if ~exist('variableParameters','var') error('input "variableParameters" is missing'); else iniAllParameters=false; iniAllNonFormulaParameters=false; iniNoneParameters=false; iniStructure=false;

Thank you! :)

Priyata

PriKalra commented 5 years ago

Also, Further information on some of my XML files. This might help debugging. I have the following possibilites depending on the xml file (Hence, I wonder if I am overlooking something in the Basic structure definition in PKSim?)

  1. Some models initialise smoothly: image

  2. Some models throw the Error and the generateMatlabCodeForXML window has the following two differences along with the error of variableParameter missing when executing theinitSimulation.m independently in the command window :

Case 1: Despite the error shown in #96 screenshots #93 sometimes, some of my xml do get imported and then I have the following error: image

Case 2: The rest of the time, there is no import of my xml file in the generateMatlabCodeForXML image

One thing consistent to both the cases is the following: When I run the files in the command window of Matlab, the following is seen

`initSimulation('C:\Simulation_Error.xml',[]) Initialisation of C:\Simulation_Error.xml Error using initSimulation (line 194) Error in Configure: Validate of XML file "" failed: At element: Error code: -1072897535 Url: Source Text: At line: 0 At line Pos: 0 Reason: Error parsing 'Infinity' as double datatype.

The attribute 'value' with value 'Infinity' failed to parse.`

I attach the two cases here. files.zip

Best, Priyata

PriKalra commented 5 years ago

Dear All,

In the past days, I tried various different model structures in PK Sim and figured out what gives the error in Matlab. I have defined Total hepatic clearance in the Compound but I did not define the measuring time of the assay (simply because typically, I do not have that information for the data). This leads to Matlab tree structures going into error.

However, I have not been able to identify how can I ask initSimulation to still continue the simulation despite the definition of the measure time of the experiment as Infinity as the default value in PKSim.

My work around has been that if the data doesn't have the time of the assay not reported, I change infinity to a large number to be able to run the xml in matlab. Checking the results of the same in PK Sim doesnot give a difference whether the measured time is infinity or very high time in this particular case. But, the simulation doesn't initialise if the measurement time parameter is set as default from PKSim.

When the time is defined as a high number instead of the default value image

but at default value:

image

Overall, this raises another question for me w.r.t. the IVIVE approach, for which I will open a new thread.

Best, Priyata

msevestre commented 5 years ago

@PriKalra Great detective work here! Wow So this is an issue with handling of infinity in the Matlab Toolbox

@PavelBal Do you know if we have the same issue in the R Toolbox?

PavelBal commented 5 years ago

Values that are defined as "Infinity" in the XML are transformed to 0 in R, see discussion https://github.com/Open-Systems-Pharmacology/R-Toolbox/issues/77

I am surprised that it's different in Matlab, as I thought it's because how SimModel reads the "inf"-value... Will have to look into it, or we have to avoid "inf" in the XML.

msevestre commented 5 years ago

Inf should be allowed in the XML. The processor (Matlab or R) should be able to deal with it. Why inf is read as 0 in R is beyond my understanding ;-)

PriKalra commented 5 years ago

So when I run the same files in R: directory <- "C:/PBPK" dci_info <- initSimulation(XML = file.path(directory, "absorption_new.xml"), whichInitParam = "allNonFormula") `

This is the Error I get

Error in initSimulation(XML = file.path(directory, "absorption_new.xml"),  : 
  Validate of XML file "" failed:
At element: 
Error code: -1072897535
Url: 
Source Text: 
At line: 0
At line Pos: 0
Reason: Error parsing 'Infinity' as double datatype.
The attribute 'value' with value 'Infinity' failed to parse.
PavelBal commented 5 years ago

@PriKalra Could you upload an example of a model that has the "Infinity"-entry? Or @msevestre do you have such an XML-model? So far, I never had something like this.

PriKalra commented 5 years ago

Sure, these are the two files, one has infinity (default definition) and the other one has a higher number. files.zip

Hope this helps! If you find any error of definitions on my behalf too, please let me know. :)

PavelBal commented 5 years ago

@PriKalra thanks!

Which version of the toolbox do you use? I don't have any errors initializing the model file.


> library("MoBiToolboxForR", lib.loc="C:/Program Files/R/R-3.5.2/library")
> xmlPath = "..\\timeinfinity.xml"
> myDCI = initSimulation(xmlPath, whichInitParam = "allNonFormula")
>
PriKalra commented 5 years ago

Interesting.. Do you think it has something to do with my library definitions? library("MoBiToolboxForR", lib.loc="~/R/R-3.5.2/library")

PavelBal commented 5 years ago

Indeed, the current version (7.4) produces such an error!

With the "development"-versions of SimModel, I do not get an error. I don't know what has been changed, but unfortunately you either have to wait until a new version is released, or manually replace some .dll-libraries (I can assist you with it, if needed).

PriKalra commented 5 years ago

Thank you @PavelBal . Currently, I found the work around to this. However, if replacing those .dll libraries, can help run the toolbox well (Preferably in MATLAB, but I can also find my way with R) Then probably it would be the best for me to do so to avoid running into such a problem with complex models. :) I would be glad if you could guide me with the needful.