0

I'm trying to extract parameter data from a COPASI-created XML file in Eclipse using a published executable .jar file (http://www.comp.nus.edu.sg/~rpsysbio/pada) that creates 3 files of ODEs(.txt), variables(.csv) and parameters(.csv). This works for a provided example XML file but a blank .csv par (paramater) file (column headers are printed) is created when I use my own data. No errors are shown and the ODE and variable files are written correctly. This is the code used to extract the parameter data:

void printPar(String outdir){
try{
    FileOutputStream outfile=new FileOutputStream(outdir+"./par.csv");
    PrintWriter out=new PrintWriter(outfile);
    // header
    out.println("NAME,INIT,LowerBound,UpperBound,BoundNum,BoundSize");
    for (int i=0;i<model.getNumParameters();i++){
    Parameter p=model.getParameter(i);
    //out.println(convert(p.getId())+","+p.getValue()+",,,");
    double x=p.getValue();
    if(x<1)
        out.println(convert(p.getId())+","+p.getValue()+",0,1,5");
    else if(x<100)
        out.println(convert(p.getId())+","+p.getValue()+",0,100,5");
    else
        out.println(convert(p.getId())+","+p.getValue()+",0,10000,5");
    }

    out.flush();
} catch(IOException e){
    e.printStackTrace();
}
} 

The only difference I can see between the example and my own XML file is that in the example file the parameters are listed separately from reactions like so:

    <listOfParameters>
        <parameter id="parameter_1" name="k1" value="0.1" />
        <parameter id="parameter_2" name="k2" value="0.1" />
        <parameter id="parameter_3" name="k3" value="0.3" />
    </listOfParameters>

whereas in my file the parameters are listed for each reaction e.g.:

</reaction>
...
      <listOfParameters>
        <parameter id="k1" name="k1" value="0.0008"/>
        <parameter id="k2" name="k2" value="1.05e-06"/>
      </listOfParameters>
    </kineticLaw>
  </reaction>

Does anyone have any suggestions as to fixing this?

Thank you for your time!

Laura
  • 89
  • 8
  • i read the testng.xml programmatically. maybe same scenario u have.http://stackoverflow.com/questions/35700078/how-to-run-testng-tests-pointed-to-a-jar – gihan-maduranga Jun 08 '16 at 16:42

1 Answers1

0

If the structure of the xml file is different you must use different XPath expressions to extract the data.

To process the example file you must use /listOfParameters, but for your xml you need to use /reaction/kineticLaw/listOfParameters

If you can't change the XPath expresion then you must build identical xml.