Creating a Report

 

# This page gives examples of  including data to a report. Most of the content is taken from COPASI-Python API manual

 

      reports = dataModel.getReportDefinitionList()

      report = reports.createReportDefinition("Report", "Output for timecourse")

      report.setTaskType(CCopasiTask.timeCourse)

      report.setIsTable(False)

      # the entries in the output should be seperated by tab

      report.setSeparator(CCopasiReportSeparator("\t"))

 

      body.push_back(CRegisteredObjectName(CCopasiObjectName(dataModel.getModel().getCN().getString() +",Reference=Time").getString()))

      body.push_back(CRegisteredObjectName(report.getSeparator().getCN().getString()))

      header.push_back(CRegisteredObjectName(CCopasiStaticString("time").getCN().getString()))

      header.push_back(CRegisteredObjectName(report.getSeparator().getCN().getString()))

 

      header = report.getHeaderAddr()

      body = report.getBodyAddr()

 

iMax = model.getMetabolites().size()

for i in range (0, iMax)

             metab = model.getMetabolite(i)

             body.push_back(CRegisteredObjectName(metab.getObject(CCopasiObjectName("Reference=Concentration")).getCN().getString()))

             header.push_back(CRegisteredObjectName(CCopasiStaticString(metab.getSBMLId()).getCN().getString()))

# following two lines are for the separator (tab, comma, space ..)

             body.push_back(CRegisteredObjectName(report.getSeparator().getCN().getString()))

             header.push_back(CRegisteredObjectName(report.getSeparator().getCN().getString()))

 

# Above example can be extended to Reaction Fluxes and Global Variables (Model Values)

 

iMax = model.getModelValues().size()

for i in range (0, iMax)

             globalvar = model.getModelValue(i)

             body.push_back(CRegisteredObjectName(globalvar.getObject(CCopasiObjectName("Reference=Value")).getCN().getString()))

             header.push_back(CRegisteredObjectName(CCopasiStaticString(globalvar.getSBMLId()).getCN().getString()))

# following two lines are for the separator (tab, comma, space ..)

             body.push_back(CRegisteredObjectName(report.getSeparator().getCN().getString()))

             header.push_back(CRegisteredObjectName(report.getSeparator().getCN().getString()))

 

 

iMax = model.getReactions().size()

for i in range (0, iMax)

          rxn=model.getReaction(i-iMax-iMaxV)

          body.push_back(CRegisteredObjectName(metab.getObject(CCopasiObjectName("Reference=Flux")).getCN().getString()))

          header.push_back(CRegisteredObjectName(CCopasiStaticString(metab.getSBMLId()).getCN().getString()))

# following two lines are for the separator (tab, comma, space ..)

          body.push_back(CRegisteredObjectName(report.getSeparator().getCN().getString()))

          header.push_back(CRegisteredObjectName(report.getSeparator().getCN().getString()))