Search in sources :

Example 11 with RelationshipObject

use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.

the class BioModelEditorConversionTableModel method createTableRow.

private ConversionTableRow createTableRow(BioPaxObject bpObject, String interactionId, String interactionLabel, String participantType, double stoich, HashSet<RelationshipObject> relationshipObjects) {
    String location = "";
    ConversionTableRow conversionTableRow = new ConversionTableRow(bpObject);
    conversionTableRow.setInteractionId(interactionId);
    conversionTableRow.setInteractionLabel(interactionLabel);
    conversionTableRow.setParticipantType(participantType);
    // stoichiometry and location
    if (participantType.equals("Reactant") || participantType.equals("Product")) {
        // stoichiometry
        if (stoich != 0)
            conversionTableRow.setStoich(stoich);
        else
            conversionTableRow.setStoich(1.0);
        // location
        // if(((PhysicalEntity)bpObject).getCellularLocation() != null && ((PhysicalEntity)bpObject).getCellularLocation().getTerm().size()>0)
        // location = ((PhysicalEntity)bpObject).getCellularLocation().getTerm().get(0);
        // else
        location = bioModel.getModel().getStructures()[0].getName();
        conversionTableRow.setLocation(location);
    } else {
        conversionTableRow.setStoich(1.0);
        // else
        if (bpObject instanceof Transport) {
            if (bioModel.getModel().getMembranes().size() > 0)
                location = bioModel.getModel().getMembranes().get(0).getName();
            else
                location = bioModel.getModel().getStructures()[0].getName();
        } else
            location = bioModel.getModel().getStructures()[0].getName();
        conversionTableRow.setLocation(location);
    }
    // id
    if (relationshipObjects == null) {
        if (bpObject instanceof Entity) {
            String id = (BioPAXUtil.getName((Entity) bpObject) + "_" + location).trim();
            if (isValid(id))
                conversionTableRow.setId(id);
            else
                conversionTableRow.setId(changeID(id));
        }
    } else {
        String id = null;
        for (RelationshipObject relationshipObject : relationshipObjects) {
            if (relationshipObject.getBioModelEntityObject() instanceof MolecularType) {
                id = relationshipObject.getBioModelEntityObject().getName();
                location = "";
            } else if (relationshipObject.getBioModelEntityObject().getStructure().getName().equalsIgnoreCase(location)) {
                id = relationshipObject.getBioModelEntityObject().getName();
            }
        }
        if (id != null) {
            // the linked bmObject with the same location will be used
            conversionTableRow.setId(id);
        } else {
            // a new bmObject will be created if no linked bmObject in the same location
            if (bpObject instanceof Entity) {
                id = (BioPAXUtil.getName((Entity) bpObject) + "_" + location).trim();
                if (isValid(id))
                    conversionTableRow.setId(id);
                else
                    conversionTableRow.setId(changeID(id));
            }
        }
    }
    return conversionTableRow;
}
Also used : MolecularType(org.vcell.model.rbm.MolecularType) Entity(org.vcell.pathway.Entity) PhysicalEntity(org.vcell.pathway.PhysicalEntity) ConversionTableRow(org.vcell.relationship.ConversionTableRow) Transport(org.vcell.pathway.Transport) RelationshipObject(org.vcell.relationship.RelationshipObject)

Example 12 with RelationshipObject

use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.

the class PathwayGraphModel method refreshRelationshipInfo.

protected void refreshRelationshipInfo(Shape shape) {
    if (shape instanceof BioPaxShape) {
        BioPaxShape bpShape = (BioPaxShape) shape;
        BioPaxObject bpObject = bpShape.getBioPaxObject();
        boolean hasRelationships = false;
        if (bioModel != null) {
            HashSet<RelationshipObject> relationships = bioModel.getRelationshipModel().getRelationshipObjects(bpObject);
            if (relationships.size() > 0) {
                hasRelationships = true;
            }
        }
        bpShape.setHasRelationships(hasRelationships);
    }
}
Also used : BioPaxObject(org.vcell.pathway.BioPaxObject) RelationshipObject(org.vcell.relationship.RelationshipObject)

Example 13 with RelationshipObject

use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.

the class BioModelEditorPathwayDiagramPanel method showPhysiologyLinks.

private void showPhysiologyLinks() {
    BioPaxObject selectedBioPaxObject = getSelectedBioPaxObject();
    if (selectedBioPaxObject != null) {
        Set<RelationshipObject> relationshipSet = bioModel.getRelationshipModel().getRelationshipObjects(selectedBioPaxObject);
        if (relationshipSet.size() > 0) {
            ArrayList<BioModelEntityObject> selectedBioModelEntityObjects = new ArrayList<BioModelEntityObject>();
            for (RelationshipObject re : relationshipSet) {
                BioModelEntityObject bioModelEntityObject = re.getBioModelEntityObject();
                selectedBioModelEntityObjects.add(bioModelEntityObject);
            }
            // if (selectedBioPaxObjects.get(0) instanceof ReactionStep) {
            // selectionManager.setActiveView(new ActiveView(null,DocumentEditorTreeFolderClass.REACTIONS_NODE, ActiveViewID.reactions));
            // } else if (selectedBioPaxObjects.get(0) instanceof SpeciesContext) {
            // selectionManager.setActiveView(new ActiveView(null,DocumentEditorTreeFolderClass.SPECIES_NODE, ActiveViewID.species));
            // }
            selectionManager.followHyperlink(new ActiveView(null, DocumentEditorTreeFolderClass.REACTION_DIAGRAM_NODE, ActiveViewID.reaction_diagram), selectedBioModelEntityObjects.toArray(new BioModelEntityObject[0]));
        }
    }
}
Also used : BioPaxObject(org.vcell.pathway.BioPaxObject) ArrayList(java.util.ArrayList) BioModelEntityObject(cbit.vcell.model.BioModelEntityObject) ActiveView(cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView) RelationshipObject(org.vcell.relationship.RelationshipObject)

Example 14 with RelationshipObject

use of org.vcell.relationship.RelationshipObject 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 15 with RelationshipObject

use of org.vcell.relationship.RelationshipObject in project vcell by virtualcell.

the class BioModelEditorSpeciesTableModel method computeData.

protected ArrayList<SpeciesContext> computeData() {
    ArrayList<SpeciesContext> speciesContextList = new ArrayList<SpeciesContext>();
    if (getModel() != null) {
        if (searchText == null || searchText.length() == 0) {
            speciesContextList.addAll(Arrays.asList(getModel().getSpeciesContexts()));
        } else {
            String lowerCaseSearchText = searchText.toLowerCase();
            for (SpeciesContext s : getModel().getSpeciesContexts()) {
                boolean bMatchRelationshipObj = false;
                HashSet<RelationshipObject> relObjsHash = bioModel.getRelationshipModel().getRelationshipObjects(s);
                for (RelationshipObject relObj : relObjsHash) {
                    if (relObj.getBioPaxObject() instanceof Entity) {
                        if (((Entity) relObj.getBioPaxObject()).getName().get(0).toLowerCase().contains(lowerCaseSearchText)) {
                            bMatchRelationshipObj = true;
                            break;
                        }
                    }
                }
                if (bMatchRelationshipObj || s.getName().toLowerCase().contains(lowerCaseSearchText) || s.getStructure().getName().toLowerCase().contains(lowerCaseSearchText)) {
                    speciesContextList.add(s);
                }
            }
        }
    }
    return speciesContextList;
}
Also used : Entity(org.vcell.pathway.Entity) ArrayList(java.util.ArrayList) SpeciesContext(cbit.vcell.model.SpeciesContext) RelationshipObject(org.vcell.relationship.RelationshipObject)

Aggregations

RelationshipObject (org.vcell.relationship.RelationshipObject)24 ArrayList (java.util.ArrayList)11 BioPaxObject (org.vcell.pathway.BioPaxObject)11 Entity (org.vcell.pathway.Entity)10 ActiveView (cbit.vcell.client.desktop.biomodel.SelectionManager.ActiveView)7 BioModelEntityObject (cbit.vcell.model.BioModelEntityObject)6 PhysicalEntity (org.vcell.pathway.PhysicalEntity)6 JLabel (javax.swing.JLabel)5 JPanel (javax.swing.JPanel)5 MolecularType (org.vcell.model.rbm.MolecularType)5 SpeciesContext (cbit.vcell.model.SpeciesContext)4 Dimension (java.awt.Dimension)4 MouseAdapter (java.awt.event.MouseAdapter)4 MouseEvent (java.awt.event.MouseEvent)4 BoxLayout (javax.swing.BoxLayout)4 Conversion (org.vcell.pathway.Conversion)4 ReactionStep (cbit.vcell.model.ReactionStep)3 ModelProcessEquation (cbit.gui.ModelProcessEquation)2 Shape (cbit.gui.graph.Shape)2 ModelProcess (cbit.vcell.model.ModelProcess)2