COPASI API  4.16.103
Public Member Functions | Protected Attributes | List of all members
QFluxModeAnimation Class Reference
Inheritance diagram for QFluxModeAnimation:
Inheritance graph
[legend]
Collaboration diagram for QFluxModeAnimation:
Collaboration graph
[legend]

Public Member Functions

virtual void getScales (std::vector< qreal > &scales, int step)
 
virtual void initialize (const CCopasiDataModel &dataModel)
 
- Public Member Functions inherited from CQCopasiAnimation
virtual void applyToScene (CQLayoutScene &scene, int step)
 
 CQCopasiAnimation ()
 
std::vector
< CQEffectDescription * > & 
getEntries ()
 
virtual int getNumSteps ()
 
ScaleMode getScaleMode () const
 
virtual void removeFromScene (CQLayoutScene &scene)
 
void setScaleMode (ScaleMode mode)
 
virtual ~CQCopasiAnimation ()
 

Protected Attributes

std::map< size_t, std::string > indexMap
 
- Protected Attributes inherited from CQCopasiAnimation
std::vector
< CQEffectDescription * > 
mEntries
 
ScaleMode mMode
 
int mNumSteps
 
const CCopasiDataModelmpDataModel
 

Additional Inherited Members

- Public Types inherited from CQCopasiAnimation
enum  ScaleMode { Global, Individual }
 

Detailed Description

Animation, that displays one fluxmode per frame

Definition at line 84 of file CQAnimationWindow.cpp.

Member Function Documentation

virtual void QFluxModeAnimation::getScales ( std::vector< qreal > &  scales,
int  step 
)
inlinevirtual

Reimplemented from CQCopasiAnimation.

Definition at line 115 of file CQAnimationWindow.cpp.

References CFluxMode::begin(), CFluxMode::end(), CEFMProblem::getFluxModes(), CCopasiTask::getProblem(), CEFMProblem::getReorderedReactions(), CCopasiDataModel::getTaskList(), CQCopasiAnimation::mEntries, CQCopasiAnimation::mNumSteps, and CQCopasiAnimation::mpDataModel.

116  {
117  if (mpDataModel == NULL) return;
118 
119  CEFMTask *task = dynamic_cast< CEFMTask * >((*mpDataModel->getTaskList())["Elementary Flux Modes"]);
120 
121  if (task == NULL) return;
122 
123  const CEFMProblem* problem = dynamic_cast<const CEFMProblem*>(task->getProblem());
124 
125  if (problem == NULL) return;
126 
127  const std::vector< CFluxMode >& fluxModes = problem->getFluxModes();
128  mNumSteps = fluxModes.size();
129 
130  if (fluxModes.size() <= (size_t)step) return;
131 
132  const CFluxMode& mode = fluxModes[step];
133 
134  const std::vector< const CReaction * > &reordered = problem->getReorderedReactions();
135  std::map<std::string, double> cnValueMap;
136 
137  CFluxMode::const_iterator modeIt = mode.begin();
138 
139  while (modeIt != mode.end())
140  {
141  const size_t reactionIndex = (*modeIt).first;
142  const double coefficient = (*modeIt).second;
143  cnValueMap[reordered[reactionIndex]->getCN()] = qAbs(coefficient);
144  ++modeIt;
145  }
146 
147  for (size_t i = 0; i < mEntries.size(); ++i)
148  scales.push_back(cnValueMap[mEntries[i]->getCN()]);
149  }
CCopasiProblem * getProblem()
const std::vector< CFluxMode > & getFluxModes() const
Definition: CEFMProblem.cpp:80
CCopasiVectorN< CCopasiTask > * getTaskList()
const_iterator begin() const
Definition: CFluxMode.cpp:69
const std::vector< const CReaction * > & getReorderedReactions() const
Definition: CEFMProblem.cpp:86
std::vector< CQEffectDescription * > mEntries
std::map< size_t, C_FLOAT64 >::const_iterator const_iterator
Definition: CFluxMode.h:43
const CCopasiDataModel * mpDataModel
const_iterator end() const
Definition: CFluxMode.cpp:74
virtual void QFluxModeAnimation::initialize ( const CCopasiDataModel dataModel)
inlinevirtual

Implements CQCopasiAnimation.

Definition at line 87 of file CQAnimationWindow.cpp.

References CCopasiVector< T >::begin(), CQEffectDescription::Colorize, CCopasiVector< T >::end(), CEFMProblem::getFluxModes(), CCopasiDataModel::getModel(), CCopasiTask::getProblem(), CModel::getReactions(), CCopasiDataModel::getTaskList(), indexMap, CQCopasiAnimation::mEntries, CQCopasiAnimation::mNumSteps, and CQCopasiAnimation::mpDataModel.

88  {
89  mpDataModel = &dataModel;
90  const CModel& model = *dataModel.getModel();
91  const CCopasiVector< CReaction > & reactions = model.getReactions();
93  size_t count = 0;
94 
95  while (it != reactions.end())
96  {
97  mEntries.push_back(new CQEffectDescription((*it)->getCN(), CQEffectDescription::Colorize, Qt::black, Qt::red));
98  indexMap[count] = (*it)->getCN();
99  ++it;
100  ++count;
101  }
102 
103  // initialize number of steps
104  CEFMTask *task = dynamic_cast< CEFMTask * >((*mpDataModel->getTaskList())["Elementary Flux Modes"]);
105 
106  if (task == NULL) return;
107 
108  const CEFMProblem* problem = dynamic_cast<const CEFMProblem*>(task->getProblem());
109 
110  if (problem == NULL) return;
111 
112  const std::vector< CFluxMode >& fluxModes = problem->getFluxModes();
113  mNumSteps = fluxModes.size();
114  }
CCopasiProblem * getProblem()
iterator begin()
iterator end()
std::vector< CType * >::const_iterator const_iterator
Definition: CCopasiVector.h:57
const std::vector< CFluxMode > & getFluxModes() const
Definition: CEFMProblem.cpp:80
CCopasiVectorN< CCopasiTask > * getTaskList()
std::map< size_t, std::string > indexMap
std::vector< CQEffectDescription * > mEntries
CCopasiVectorNS< CReaction > & getReactions()
Definition: CModel.cpp:1039
const CCopasiDataModel * mpDataModel
Definition: CModel.h:50

Member Data Documentation

std::map<size_t, std::string> QFluxModeAnimation::indexMap
protected

Definition at line 152 of file CQAnimationWindow.cpp.

Referenced by initialize().


The documentation for this class was generated from the following file: