COPASI API
4.40.278
|
#include <CCopasiSpringLayout.h>
Classes | |
struct | CoordinateRelation |
class | Parameters |
struct | UpdateAction |
this describes one update action that has to be performed during setState() More... | |
Public Member Functions | |
CCopasiSpringLayout (CLayout *layout, Parameters *ppp=NULL) | |
bool | createVariables () |
void | finalizeState () |
CLCompartmentGlyph * | findCompartmentForReactionNode (CLReactionGlyph &r) |
virtual const std::vector< double > & | getInitialValues () const |
virtual double | getPotential () |
virtual const std::vector< UpdateAction > & | getUpdateActions () const |
void | randomize () |
virtual bool | setState (const std::vector< double > &vars) |
void | updateFixedRelations () |
Public Member Functions inherited from CAbstractLayoutInterface | |
CAbstractLayoutInterface () | |
virtual const std::vector< double > & | getMassVector () const |
std::vector< double >::size_type | getNumVariables () const |
const std::vector< VariableDescription > & | getVariablesDescription () const |
virtual | ~CAbstractLayoutInterface () |
Static Public Member Functions | |
static CLayout * | createLayout (CDataContainer *parent, const std::set< const CCompartment * > &compartments, const std::set< const CReaction * > &reactions, const std::set< const CMetab * > &metabs, const std::set< const CMetab * > &sideMetabs, Parameters *mParams=NULL) |
Protected Member Functions | |
void | addCompartmentVariables (CLCompartmentGlyph *cg) |
create variables for size and position of a compartment glyph More... | |
void | addPositionVariables (CLGraphicalObject *pGO) |
create variables for the position of a species glyph More... | |
void | addReactionVariables (CLReactionGlyph *rg) |
create variables for the position of a reaction glyph More... | |
CLPoint | borderProjection (CLGraphicalObject *go, const CLPoint &p, double d) |
bool | initFromLayout (CLayout *layout, Parameters *ppp) |
performs all initializations that are later needed to calculate the potential More... | |
double | potEdge (const CLMetabReferenceGlyph &e, const CLReactionGlyph &r) const |
double | potGeneralEdge (const CLReferenceGlyph &e, const CLGeneralGlyph &r) const |
double | potReactionCompartment (const CLReactionGlyph &r, const CLCompartmentGlyph &c) const |
double | potReactionReaction (const CLReactionGlyph &a, const CLReactionGlyph &b) const |
double | potSecondOrderEdge (const CLMetabReferenceGlyph &e1, const CLMetabReferenceGlyph &e2, double &dist) const |
double | potSpeciesCompartment (const CLMetabGlyph &s, const CLCompartmentGlyph &c) const |
double | potSpeciesReaction (const CLMetabGlyph &a, const CLReactionGlyph &b) const |
double | potSpeciesSpecies (const CLMetabGlyph &a, const CLMetabGlyph &b) const |
Static Protected Member Functions | |
static double | bound_distance (const double &x1, const double &y1, const double &x2, const double &y2, const double &max) |
static double | distance (const double &x1, const double &y1, const double &x2, const double &y2) |
Protected Attributes | |
std::map< CLBase *, CLCompartmentGlyph * > | mCompartmentMap |
this map contains information about the compartment glyph a given glyph is located in More... | |
std::vector< CoordinateRelation > | mFixedRelations |
a list of fixed positon relations between objects. Should be constructed in initFromLayout() More... | |
std::vector< double > | mInitialState |
CLayout * | mpLayout |
Parameters * | mpPar |
std::vector< UpdateAction > | mUpdateActions |
this is the list of all update actions that have to be performed during setState(); More... | |
Protected Attributes inherited from CAbstractLayoutInterface | |
std::vector< double > | mMassVector |
std::vector< VariableDescription > | mVarDescription |
This class defines how a layout optimization algorithm will see a COPASI layout, using a spring approach. No copy of the layout will be generated, meaning that setState() will change the layout.
CCopasiSpringLayout::CCopasiSpringLayout | ( | CLayout * | layout, |
Parameters * | ppp = NULL |
||
) |
generate a spring layout view of a COPASI layout.
References initFromLayout().
|
protected |
create variables for size and position of a compartment glyph
References CCopasiSpringLayout::UpdateAction::COMPARTMENT_4V, CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), CLGraphicalObject::getY(), CAbstractLayoutInterface::VariableDescription::isAngle, mInitialState, CAbstractLayoutInterface::mMassVector, mUpdateActions, and CAbstractLayoutInterface::mVarDescription.
|
protected |
create variables for the position of a species glyph
References CLGraphicalObject::getX(), CLGraphicalObject::getY(), CAbstractLayoutInterface::VariableDescription::isAngle, mInitialState, CAbstractLayoutInterface::mMassVector, mUpdateActions, CAbstractLayoutInterface::mVarDescription, and CCopasiSpringLayout::UpdateAction::POSITION_2V.
Referenced by createVariables().
|
protected |
create variables for the position of a reaction glyph
References C_FLOAT64, CLGlyphWithCurve::getCurve(), CLCurve::getCurveSegments(), CLGraphicalObject::getHeight(), CLCurve::getNumCurveSegments(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), CLGraphicalObject::getY(), CAbstractLayoutInterface::VariableDescription::isAngle, mInitialState, CAbstractLayoutInterface::mMassVector, mUpdateActions, CAbstractLayoutInterface::mVarDescription, and CCopasiSpringLayout::UpdateAction::REACTION_2V.
Referenced by createVariables().
|
protected |
calculate a point just outside the bounding box of a given graphical object on the line between the center of the object and the point p. d specifies the distance from the border of the object.
References CLGraphicalObject::getBoundingBox(), CLBoundingBox::getCenter(), CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLPoint::getX(), and CLPoint::getY().
Referenced by finalizeState().
|
inlinestaticprotected |
References max.
Referenced by potReactionReaction(), potSpeciesReaction(), and potSpeciesSpecies().
|
static |
This method creates a random layout using the elements in the compartments, reactions, species and side species containers.
References CDataContainer::add(), CLayout::addCompartmentGlyph(), CLayout::addGeneralGlyph(), CLayout::addMetaboliteGlyph(), CLReactionGlyph::addMetabReferenceGlyph(), CLayout::addReactionGlyph(), CLGeneralGlyph::addReferenceGlyph(), CLayout::addTextGlyph(), CModelEntity::ASSIGNMENT, CDataVector< CType >::begin(), CLayout::calculateBoundingBox(), CDataVector< CType >::end(), CMetab::getCompartment(), CLBoundingBox::getDimensions(), CLDimensions::getHeight(), CLGraphicalObject::getKey(), CModelEntity::getKey(), CLayout::getListOfMetaboliteGlyphs(), CLGraphicalObject::getModelObject(), CModelEntity::getStatus(), CLDimensions::getWidth(), CLMetabReferenceGlyph::MODIFIER, CModelEntity::ODE, CLMetabReferenceGlyph::PRODUCT, randomize(), CLayout::setDimensions(), CLGraphicalObject::setDimensions(), CLMetabReferenceGlyph::setFunctionalRole(), CLTextGlyph::setGraphicalObjectKey(), CLMetabReferenceGlyph::setMetabGlyphKey(), CLGraphicalObject::setModelObjectKey(), CLGraphicalObject::setObjectRole(), CLGraphicalObject::setPosition(), CLReferenceGlyph::setRole(), CLMetabReferenceGlyph::setRole(), CLReferenceGlyph::setTargetGlyphKey(), CLMetabReferenceGlyph::SIDEPRODUCT, CLMetabReferenceGlyph::SIDESUBSTRATE, CDataVector< CType >::size(), and CLMetabReferenceGlyph::SUBSTRATE.
bool CCopasiSpringLayout::createVariables | ( | ) |
generates the list of variables from the layout. This method will generate variables for the coordinates of all the nodes in the layout. TODO: make it possible to only auto-layout a subset of the graph
References addPositionVariables(), addReactionVariables(), CLayout::getListOfGeneralGlyphs(), CLayout::getListOfMetaboliteGlyphs(), CLayout::getListOfReactionGlyphs(), mInitialState, CAbstractLayoutInterface::mMassVector, mpLayout, and CAbstractLayoutInterface::mVarDescription.
|
inlinestaticprotected |
Referenced by potEdge(), potGeneralEdge(), and potSecondOrderEdge().
void CCopasiSpringLayout::finalizeState | ( | ) |
complete the update of the layout. This updates the things that are not needed for the calculation of the potential. After calling this method the layout should be ready for drawing or storing
References CLCurve::addCurveSegment(), borderProjection(), CLayout::calculateAndAssignBounds(), CLCurve::clear(), CLPoint::dot(), CLGraphicalObject::getBoundingBox(), CLBoundingBox::getCenter(), CLGlyphWithCurve::getCurve(), CLCurve::getCurveSegments(), CLGraphicalObject::getDimensions(), CLMetabReferenceGlyph::getFunctionalRole(), CLDimensions::getHeight(), CLayout::getListOfGeneralGlyphs(), CLReactionGlyph::getListOfMetabReferenceGlyphs(), CLayout::getListOfReactionGlyphs(), CLGeneralGlyph::getListOfReferenceGlyphs(), CLMetabReferenceGlyph::getMetabGlyph(), CLCurve::getNumCurveSegments(), CLGraphicalObject::getPosition(), CLReferenceGlyph::getTargetGlyph(), CLDimensions::getWidth(), CLPoint::getX(), CLPoint::getY(), mpLayout, CLMetabReferenceGlyph::PRODUCT, CLPoint::scale(), CLGraphicalObject::setPosition(), CLMetabReferenceGlyph::SIDEPRODUCT, CLMetabReferenceGlyph::SIDESUBSTRATE, CDataVector< CType >::size(), CLMetabReferenceGlyph::SUBSTRATE, and updateFixedRelations().
Referenced by randomize().
CLCompartmentGlyph * CCopasiSpringLayout::findCompartmentForReactionNode | ( | CLReactionGlyph & | r | ) |
if all participants of a reaction are in a single compartment return the compartment glyph, otherwise return NULL
References CLReactionGlyph::getListOfMetabReferenceGlyphs(), and mCompartmentMap.
Referenced by initFromLayout().
|
virtual |
Implements CAbstractLayoutInterface.
References mInitialState.
|
virtual |
Implements CAbstractLayoutInterface.
References CLayout::getListOfGeneralGlyphs(), CLayout::getListOfMetaboliteGlyphs(), CLReactionGlyph::getListOfMetabReferenceGlyphs(), CLayout::getListOfReactionGlyphs(), CLGeneralGlyph::getListOfReferenceGlyphs(), mCompartmentMap, mpLayout, mpPar, potEdge(), potGeneralEdge(), potReactionCompartment(), potReactionReaction(), potSecondOrderEdge(), potSpeciesCompartment(), potSpeciesReaction(), potSpeciesSpecies(), CLMetabReferenceGlyph::PRODUCT, CLMetabReferenceGlyph::SIDEPRODUCT, CLMetabReferenceGlyph::SIDESUBSTRATE, CDataVector< CType >::size(), CLMetabReferenceGlyph::SUBSTRATE, and CCopasiSpringLayout::Parameters::values.
|
virtual |
References mUpdateActions.
|
protected |
performs all initializations that are later needed to calculate the potential
References CCopasiSpringLayout::CoordinateRelation::diff, findCompartmentForReactionNode(), CMetab::getCompartment(), CModelEntity::getKey(), CLayout::getListOfCompartmentGlyphs(), CLayout::getListOfMetaboliteGlyphs(), CLayout::getListOfReactionGlyphs(), CLayout::getListOfTextGlyphs(), CLGraphicalObject::getPosition(), mCompartmentMap, mFixedRelations, mpLayout, mpPar, CDataVector< CType >::size(), CCopasiSpringLayout::CoordinateRelation::source, and CCopasiSpringLayout::CoordinateRelation::target.
Referenced by CCopasiSpringLayout().
|
protected |
References distance(), CLGraphicalObject::getHeight(), CLMetabReferenceGlyph::getMetabGlyph(), CLMetabReferenceGlyph::getRole(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), CLGraphicalObject::getY(), CLMetabReferenceGlyph::MODIFIER, mpPar, CLMetabReferenceGlyph::SIDEPRODUCT, CLMetabReferenceGlyph::SIDESUBSTRATE, and CCopasiSpringLayout::Parameters::values.
Referenced by getPotential().
|
protected |
References distance(), CLGraphicalObject::getHeight(), CLReferenceGlyph::getTargetGlyph(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), and CLGraphicalObject::getY().
Referenced by getPotential().
|
protected |
s.charge
References CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), and CLGraphicalObject::getY().
Referenced by getPotential().
|
protected |
References bound_distance(), CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), and CLGraphicalObject::getY().
Referenced by getPotential().
|
protected |
|
protected |
s.charge
References CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), and CLGraphicalObject::getY().
Referenced by getPotential().
|
protected |
References bound_distance(), CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), and CLGraphicalObject::getY().
Referenced by getPotential().
|
protected |
References bound_distance(), CLGraphicalObject::getHeight(), CLGraphicalObject::getWidth(), CLGraphicalObject::getX(), and CLGraphicalObject::getY().
Referenced by getPotential().
void CCopasiSpringLayout::randomize | ( | ) |
Randomizes the layout
This function produces a random layout. It first shufles around metab glyphs and reaction centers, and finally corrects all ars
References CRandom::createGenerator(), finalizeState(), CLGraphicalObject::getBoundingBox(), CLBoundingBox::getCenter(), CMetab::getCompartment(), CLayout::getDimensions(), CModelEntity::getKey(), CLayout::getListOfCompartmentGlyphs(), CLayout::getListOfMetaboliteGlyphs(), CLReactionGlyph::getListOfMetabReferenceGlyphs(), CLayout::getListOfReactionGlyphs(), CLGraphicalObject::getModelObject(), CRandom::getRandomCC(), CRandom::getSystemSeed(), mpLayout, CRandom::mt19937, placeTextGlyphs(), randomlyPlaceGlyphInCompartmentGlyph(), randomlyPlaceGlyphInDimensions(), CLGraphicalObject::setPosition(), and CDataVector< CType >::size().
Referenced by createLayout().
|
virtual |
updates the COPASI layout from the state vector. Only the updates that are needed for the calculation of the potential (or for a rough on the fly drawing) are done.
Implements CAbstractLayoutInterface.
References CCopasiSpringLayout::UpdateAction::COMPARTMENT_4V, mUpdateActions, CAbstractLayoutInterface::mVarDescription, CCopasiSpringLayout::UpdateAction::POSITION_2V, and CCopasiSpringLayout::UpdateAction::REACTION_2V.
void CCopasiSpringLayout::updateFixedRelations | ( | ) |
References mFixedRelations.
Referenced by finalizeState().
|
protected |
this map contains information about the compartment glyph a given glyph is located in
Referenced by findCompartmentForReactionNode(), getPotential(), and initFromLayout().
|
protected |
a list of fixed positon relations between objects. Should be constructed in initFromLayout()
Referenced by initFromLayout(), and updateFixedRelations().
|
protected |
Referenced by addCompartmentVariables(), addPositionVariables(), addReactionVariables(), createVariables(), and getInitialValues().
|
protected |
Referenced by createVariables(), finalizeState(), getPotential(), initFromLayout(), and randomize().
|
protected |
Referenced by getPotential(), initFromLayout(), and potEdge().
|
protected |
this is the list of all update actions that have to be performed during setState();
Referenced by addCompartmentVariables(), addPositionVariables(), addReactionVariables(), getUpdateActions(), and setState().