Search in sources :

Example 61 with ReactionStep

use of cbit.vcell.model.ReactionStep in project vcell by virtualcell.

the class BioModelEditorReactionTableModel method computeData.

protected ArrayList<ModelProcess> computeData() {
    ArrayList<ModelProcess> processList = new ArrayList<ModelProcess>();
    if (getModel() != null) {
        ModelProcess[] modelProcesses = getModel().getModelProcesses();
        if (searchText == null || searchText.length() == 0) {
            processList.addAll(Arrays.asList(modelProcesses));
        } else {
            String lowerCaseSearchText = searchText.toLowerCase();
            for (ModelProcess process : modelProcesses) {
                boolean bMatchRelationshipObj = false;
                if (process instanceof ReactionStep) {
                    ReactionStep reactionStep = (ReactionStep) process;
                    HashSet<RelationshipObject> relObjsHash = bioModel.getRelationshipModel().getRelationshipObjects(reactionStep);
                    for (RelationshipObject relObj : relObjsHash) {
                        if (relObj.getBioPaxObject() instanceof Entity) {
                            if (((Entity) relObj.getBioPaxObject()).getName().get(0).toLowerCase().contains(lowerCaseSearchText)) {
                                bMatchRelationshipObj = true;
                                break;
                            }
                        }
                    }
                }
                if (bMatchRelationshipObj || process.containsSearchText(lowerCaseSearchText)) {
                    if (!processList.contains(process)) {
                        processList.add(process);
                    }
                }
                if (process instanceof ReactionStep) {
                    // we also search in reaction step expression, for strings like "s1 + s2" or s1 -> s2
                    ModelProcessEquation mpe = new ModelProcessEquation(process, bioModel.getModel());
                    if (mpe.toString().toLowerCase().contains(lowerCaseSearchText)) {
                        if (!processList.contains(process)) {
                            processList.add(process);
                        }
                    }
                }
            }
        }
    }
    return processList;
}
Also used : Entity(org.vcell.pathway.Entity) ReactionStep(cbit.vcell.model.ReactionStep) ArrayList(java.util.ArrayList) ModelProcessEquation(cbit.gui.ModelProcessEquation) ModelProcess(cbit.vcell.model.ModelProcess) RelationshipObject(org.vcell.relationship.RelationshipObject)

Example 62 with ReactionStep

use of cbit.vcell.model.ReactionStep in project vcell by virtualcell.

the class BioModelParametersTableModel method bioModelChange.

@Override
protected void bioModelChange(PropertyChangeEvent evt) {
    super.bioModelChange(evt);
    BioModel oldValue = (BioModel) evt.getOldValue();
    if (oldValue != null) {
        for (EditableSymbolTableEntry parameter : oldValue.getModel().getModelParameters()) {
            parameter.removePropertyChangeListener(this);
        }
        for (SpeciesContext sc : oldValue.getModel().getSpeciesContexts()) {
            sc.removePropertyChangeListener(this);
        }
        for (ReactionStep reactionStep : oldValue.getModel().getReactionSteps()) {
            reactionStep.removePropertyChangeListener(this);
            Kinetics kinetics = reactionStep.getKinetics();
            kinetics.removePropertyChangeListener(this);
            for (KineticsParameter kineticsEditableSymbolTableEntry : kinetics.getKineticsParameters()) {
                kineticsEditableSymbolTableEntry.removePropertyChangeListener(this);
            }
            for (ProxyParameter proxyEditableSymbolTableEntry : kinetics.getProxyParameters()) {
                proxyEditableSymbolTableEntry.removePropertyChangeListener(this);
            }
            for (UnresolvedParameter unresolvedEditableSymbolTableEntry : kinetics.getUnresolvedParameters()) {
                unresolvedEditableSymbolTableEntry.removePropertyChangeListener(this);
            }
        }
        for (SimulationContext simulationContext : oldValue.getSimulationContexts()) {
            simulationContext.removePropertyChangeListener(this);
            simulationContext.getGeometryContext().removePropertyChangeListener(this);
            for (StructureMapping mapping : simulationContext.getGeometryContext().getStructureMappings()) {
                mapping.removePropertyChangeListener(this);
                for (EditableSymbolTableEntry parameter : mapping.getParameters()) {
                    parameter.removePropertyChangeListener(this);
                }
            }
            simulationContext.getReactionContext().removePropertyChangeListener(this);
            for (SpeciesContextSpec spec : simulationContext.getReactionContext().getSpeciesContextSpecs()) {
                spec.removePropertyChangeListener(this);
                for (EditableSymbolTableEntry parameter : spec.getParameters()) {
                    parameter.removePropertyChangeListener(this);
                }
            }
            for (ElectricalStimulus elect : simulationContext.getElectricalStimuli()) {
                elect.removePropertyChangeListener(this);
                for (EditableSymbolTableEntry parameter : elect.getParameters()) {
                    parameter.removePropertyChangeListener(this);
                }
            }
            for (SpatialObject spatialObject : simulationContext.getSpatialObjects()) {
                spatialObject.removePropertyChangeListener(this);
            }
            for (SpatialProcess spatialProcess : simulationContext.getSpatialProcesses()) {
                spatialProcess.removePropertyChangeListener(this);
                for (LocalParameter p : spatialProcess.getParameters()) {
                    p.removePropertyChangeListener(this);
                }
            }
            for (SimulationContextParameter p : simulationContext.getSimulationContextParameters()) {
                p.removePropertyChangeListener(this);
            }
        }
    }
    BioModel newValue = (BioModel) evt.getNewValue();
    if (newValue != null) {
        for (ModelParameter modelEditableSymbolTableEntry : newValue.getModel().getModelParameters()) {
            modelEditableSymbolTableEntry.addPropertyChangeListener(this);
        }
        for (SpeciesContext sc : newValue.getModel().getSpeciesContexts()) {
            sc.addPropertyChangeListener(this);
        }
        for (ReactionStep reactionStep : newValue.getModel().getReactionSteps()) {
            reactionStep.addPropertyChangeListener(this);
            Kinetics kinetics = reactionStep.getKinetics();
            kinetics.addPropertyChangeListener(this);
            for (KineticsParameter kineticsEditableSymbolTableEntry : kinetics.getKineticsParameters()) {
                kineticsEditableSymbolTableEntry.addPropertyChangeListener(this);
            }
            for (ProxyParameter proxyEditableSymbolTableEntry : kinetics.getProxyParameters()) {
                proxyEditableSymbolTableEntry.addPropertyChangeListener(this);
            }
            for (UnresolvedParameter unresolvedEditableSymbolTableEntry : kinetics.getUnresolvedParameters()) {
                unresolvedEditableSymbolTableEntry.addPropertyChangeListener(this);
            }
        }
        for (SimulationContext simulationContext : newValue.getSimulationContexts()) {
            simulationContext.addPropertyChangeListener(this);
            simulationContext.getGeometryContext().addPropertyChangeListener(this);
            for (StructureMapping mapping : simulationContext.getGeometryContext().getStructureMappings()) {
                mapping.addPropertyChangeListener(this);
                for (EditableSymbolTableEntry parameter : mapping.getParameters()) {
                    parameter.addPropertyChangeListener(this);
                }
            }
            simulationContext.getReactionContext().addPropertyChangeListener(this);
            for (SpeciesContextSpec spec : simulationContext.getReactionContext().getSpeciesContextSpecs()) {
                spec.addPropertyChangeListener(this);
                for (EditableSymbolTableEntry parameter : spec.getParameters()) {
                    parameter.addPropertyChangeListener(this);
                }
            }
            for (ElectricalStimulus elect : simulationContext.getElectricalStimuli()) {
                elect.addPropertyChangeListener(this);
                for (EditableSymbolTableEntry parameter : elect.getParameters()) {
                    parameter.addPropertyChangeListener(this);
                }
            }
            for (SpatialObject spatialObject : simulationContext.getSpatialObjects()) {
                spatialObject.addPropertyChangeListener(this);
            }
            for (SpatialProcess spatialProcess : simulationContext.getSpatialProcesses()) {
                spatialProcess.addPropertyChangeListener(this);
                for (LocalParameter p : spatialProcess.getParameters()) {
                    p.addPropertyChangeListener(this);
                }
            }
            for (SimulationContextParameter p : simulationContext.getSimulationContextParameters()) {
                p.addPropertyChangeListener(this);
            }
        }
    }
}
Also used : UnresolvedParameter(cbit.vcell.model.Kinetics.UnresolvedParameter) SpeciesContext(cbit.vcell.model.SpeciesContext) SimulationContext(cbit.vcell.mapping.SimulationContext) SpeciesContextSpec(cbit.vcell.mapping.SpeciesContextSpec) SimulationContextParameter(cbit.vcell.mapping.SimulationContext.SimulationContextParameter) StructureMapping(cbit.vcell.mapping.StructureMapping) SpatialObject(cbit.vcell.mapping.spatial.SpatialObject) LocalParameter(cbit.vcell.mapping.ParameterContext.LocalParameter) ElectricalStimulus(cbit.vcell.mapping.ElectricalStimulus) ModelParameter(cbit.vcell.model.Model.ModelParameter) ProxyParameter(cbit.vcell.model.ProxyParameter) KineticsParameter(cbit.vcell.model.Kinetics.KineticsParameter) SpatialProcess(cbit.vcell.mapping.spatial.processes.SpatialProcess) BioModel(cbit.vcell.biomodel.BioModel) ReactionStep(cbit.vcell.model.ReactionStep) Kinetics(cbit.vcell.model.Kinetics) EditableSymbolTableEntry(cbit.vcell.model.EditableSymbolTableEntry)

Example 63 with ReactionStep

use of cbit.vcell.model.ReactionStep in project vcell by virtualcell.

the class AnnotationsPanel method changeTextAnnotation.

private void changeTextAnnotation() {
    try {
        if (bioModel == null || selectedObject == null) {
            return;
        }
        Identifiable entity = getIdentifiable(selectedObject);
        String textAreaStr = (annotationTextArea.getText() == null || annotationTextArea.getText().length() == 0 ? null : annotationTextArea.getText());
        String oldText = bioModel.getVCMetaData().getFreeTextAnnotation(entity);
        if (textAreaStr == null || textAreaStr.isEmpty() || emptyHtmlText.equals(textAreaStr)) {
            // no annotation now, the field is empty
            // delete, if there's something previously saved
            bioModel.getVCMetaData().deleteFreeTextAnnotation(entity);
            if (selectedObject instanceof ReactionStep) {
                // we tell ReactionPropertiesPanel to refresh the annotation icon
                ((ReactionStep) selectedObject).firePropertyChange("addIdentifier", false, true);
            }
        } else if (!Compare.isEqualOrNull(oldText, textAreaStr)) {
            // some text annotation different from what's already saved
            // overwrite
            bioModel.getVCMetaData().setFreeTextAnnotation(entity, textAreaStr);
            if (selectedObject instanceof ReactionStep) {
                // we tell ReactionPropertiesPanel to refresh the text annotation icon
                ((ReactionStep) selectedObject).firePropertyChange("addIdentifier", false, true);
            }
        }
    } catch (Exception e) {
        e.printStackTrace(System.out);
        PopupGenerator.showErrorDialog(this, "Annotation Error\n" + e.getMessage(), e);
    }
}
Also used : ReactionStep(cbit.vcell.model.ReactionStep) URNParseFailureException(org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException) Identifiable(org.vcell.util.document.Identifiable)

Example 64 with ReactionStep

use of cbit.vcell.model.ReactionStep in project vcell by virtualcell.

the class AnnotationsPanel method removeIdentifier.

private void removeIdentifier() {
    Object treeNode = jTreeMIRIAM.getLastSelectedPathComponent();
    if (treeNode instanceof LinkNode) {
        LinkNode linkNode = (LinkNode) treeNode;
        MiriamResource resourceToDelete = linkNode.getMiriamResource();
        Identifiable entity = getIdentifiable(selectedObject);
        // Map<MiriamRefGroup, MIRIAMQualifier> refGroupsToRemove = vcMetaData.getMiriamManager().getAllMiriamRefGroups(entity);
        MiriamManager mm = vcMetaData.getMiriamManager();
        Map<MiriamRefGroup, MIRIAMQualifier> refGroupsToRemove = mm.getMiriamTreeMap().get(entity);
        boolean found = false;
        for (MiriamRefGroup refGroup : refGroupsToRemove.keySet()) {
            MIRIAMQualifier qualifier = refGroupsToRemove.get(refGroup);
            for (MiriamResource miriamResource : refGroup.getMiriamRefs()) {
                if (!isEqual(miriamResource, resourceToDelete)) {
                    continue;
                }
                try {
                    // remove the ref group for this resource
                    mm.remove2(entity, qualifier, refGroup);
                    System.out.println(vcMetaData.printRdfStatements());
                    found = true;
                    break;
                } catch (URNParseFailureException e) {
                    e.printStackTrace(System.out);
                }
            }
            if (found == true) {
                updateInterface();
                if (selectedObject instanceof ReactionStep) {
                    ((ReactionStep) selectedObject).firePropertyChange("addIdentifier", true, false);
                }
                break;
            }
        }
    }
}
Also used : MiriamManager(cbit.vcell.biomodel.meta.MiriamManager) VCMetaDataMiriamManager(cbit.vcell.biomodel.meta.VCMetaDataMiriamManager) MiriamResource(cbit.vcell.biomodel.meta.MiriamManager.MiriamResource) ReactionStep(cbit.vcell.model.ReactionStep) LinkNode(cbit.vcell.xml.gui.MiriamTreeModel.LinkNode) BioPaxObject(org.vcell.pathway.BioPaxObject) MIRIAMQualifier(org.vcell.sybil.models.miriam.MIRIAMQualifier) URNParseFailureException(org.vcell.sybil.models.miriam.MIRIAMRef.URNParseFailureException) MiriamRefGroup(cbit.vcell.biomodel.meta.MiriamManager.MiriamRefGroup) Identifiable(org.vcell.util.document.Identifiable)

Example 65 with ReactionStep

use of cbit.vcell.model.ReactionStep in project vcell by virtualcell.

the class AnnotationsPanel method removeText.

private void removeText() {
    if (bioModel == null || selectedObject == null) {
        return;
    }
    Identifiable entity = getIdentifiable(selectedObject);
    annotationTextArea.setText(null);
    // delete, if there's something previously saved
    bioModel.getVCMetaData().deleteFreeTextAnnotation(entity);
    if (selectedObject instanceof ReactionStep) {
        ((ReactionStep) selectedObject).firePropertyChange("addIdentifier", false, true);
    }
}
Also used : ReactionStep(cbit.vcell.model.ReactionStep) Identifiable(org.vcell.util.document.Identifiable)

Aggregations

ReactionStep (cbit.vcell.model.ReactionStep)111 SpeciesContext (cbit.vcell.model.SpeciesContext)55 Structure (cbit.vcell.model.Structure)37 ReactionParticipant (cbit.vcell.model.ReactionParticipant)33 Expression (cbit.vcell.parser.Expression)33 Model (cbit.vcell.model.Model)32 KineticsParameter (cbit.vcell.model.Kinetics.KineticsParameter)30 ArrayList (java.util.ArrayList)29 ReactionRule (cbit.vcell.model.ReactionRule)26 ModelParameter (cbit.vcell.model.Model.ModelParameter)25 Reactant (cbit.vcell.model.Reactant)25 Kinetics (cbit.vcell.model.Kinetics)24 Product (cbit.vcell.model.Product)23 PropertyVetoException (java.beans.PropertyVetoException)23 SimpleReaction (cbit.vcell.model.SimpleReaction)20 ExpressionException (cbit.vcell.parser.ExpressionException)20 Vector (java.util.Vector)19 SimulationContext (cbit.vcell.mapping.SimulationContext)18 Membrane (cbit.vcell.model.Membrane)18 BioModel (cbit.vcell.biomodel.BioModel)17