def generateLongNameReport(self,fluxModel): report = Report() for name in fluxModel.getMetabolicNetwork().getOrderedReactionNames(): reaction = fluxModel.getMetabolicNetwork().getReaction(name) longName = reaction.getName() equation = reaction.getEquation() report.addElement(name,"LongName",longName) report.addElement(name,"Equation",equation) return report
def writeReport(self,ltReport,fluxModel, oPredVal,sPredVal,s2PredVal,neighborhood,iterations,fObjective,resultDir): if self.verbose: print "Preparing report ..." report = Report() reactionNames = fluxModel.network.getOrderedReactionNames() reactionMap = fluxModel.network.getReactionMap() for reactionName in reactionNames: reaction = reactionMap[reactionName] equation = reaction.getEquation() pathway = reaction.getAnnotation("Subsystem") name = reaction.getName()#Currently sensitivity values can be too large for control factors. report.addElement(reactionName,"name",name) report.addElement(reactionName,"equation", equation) report.addElement(reactionName,"Subsystem", pathway) #-------------------- #Analysis in report #-------------------- report.addColumnHash("Original", oPredVal) report.addColumnHash("Synthetic", sPredVal) report.addColumnHash("Synthetic mBio", s2PredVal) report.extend(ltReport) report.addColumnHash("Final Objective", fObjective) #-------------------- #Write Report #-------------------- if self.verbose: print "Writing report ..." outputFileName = resultDir + "RD_" + self.resultTag + "_" + self.modelName + "_" + self.syntheticObjectiveName + "_" + str(neighborhood) + "_" + str(iterations) + "_" + strftime('%Y%m%dT%H%M%S') + ".txt" writer = ReportWriter() writer.setFile(outputFileName) writer.write(report) writer.closeFile() if self.verbose: print "Report Written [%s]" % (outputFileName) return report