protected void selectEdgesByName(TreePath treePath) { java.util.List list = view.getEdgeViewsList(); Vector vector = new Vector(); for (Iterator i = list.iterator(); i.hasNext();) { EdgeView ev = (EdgeView) i.next(); String canonicalName = ev.getEdge().getIdentifier(); if (pathMatchesEdge(canonicalName, treePath, edgeAttributes)) vector.add(ev); } // for ec for (Iterator vi = vector.iterator(); vi.hasNext();) { EdgeView edge = (EdgeView) vi.next(); edge.setSelected(true); } } // selectEdgesByName //------------------------------------------------------------------------------
protected void hideEdgesByName(TreePath treePath) { java.util.List list = view.getEdgeViewsList(); for (Iterator i = list.iterator(); i.hasNext();) { EdgeView ev = (EdgeView) i.next(); String edgeName = ev.getEdge().getIdentifier(); if (pathMatchesEdge(edgeName, treePath, edgeAttributes)) view.hideGraphObject(ev); } // for ec } // hideEdgesByName //------------------------------------------------------------------------------
protected void inverseHideEdgesByName(TreePath treePath) { // this is the same as hideEdgesByName action ... Bug? java.util.List list = view.getEdgeViewsList(); for (Iterator i = list.iterator(); i.hasNext();) { EdgeView ev = (EdgeView) i.next(); String edgeName = ev.getEdge().getIdentifier(); if (!pathMatchesEdge(edgeName, treePath, edgeAttributes)) view.hideGraphObject(ev); } // for ec } // inverseHideEdgesByName //------------------------------------------------------------------------------
/** * Returns the interaction type of the given edge. Formally, gets from the * edge attributes the value for the "interaction" attribute". * * If either argument is null, returns null. */ public static String getInteractionType(final CyNetwork network, final Edge edge) { if ((network == null) || (edge == null)) { return null; } return Cytoscape.getEdgeAttributes() .getStringAttribute(edge.getIdentifier(), Semantics.INTERACTION); }
/** * {@inheritDoc} */ @Override public Edge mergeEdge(final Map<CyNetwork,Set<GraphObject>> mapNetEdge, final Node source, final Node target, final String interaction, final boolean directed) { //TODO: refactor in Cytoscape3 if (mapNetEdge==null||mapNetEdge.isEmpty()||source==null||target==null) { return null; } // Get the edge or create a new one // attribute confilict handling? final Edge edge = Cytoscape.getCyEdge(source, target, Semantics.INTERACTION, interaction, true, directed); // ID and canonicalName set when created final String id = edge.getIdentifier(); // set other attributes as indicated in attributeMapping setAttribute(id,mapNetEdge,edgeAttributeMapping); return edge; }
protected void selectOtherEdges() { Vector keepUnselectedList = new Vector(); java.util.List list = view.getEdgeViewsList(); for (Iterator i = list.iterator(); i.hasNext();) { EdgeView ev = (EdgeView) i.next(); String canonicalName = ev.getEdge().getIdentifier(); for (int p = 0; p < selectedTreePaths.length; p++) { TreePath treePath = selectedTreePaths[p]; if (pathMatchesEdge(canonicalName, treePath, edgeAttributes)) keepUnselectedList.add(ev); } // for p } // for ec Vector selectList = new Vector(); list = view.getEdgeViewsList(); for (Iterator i = list.iterator(); i.hasNext();) { EdgeView ev = (EdgeView) i.next(); ev.setSelected(!keepUnselectedList.contains(ev)); } } // selectOtherEdges //------------------------------------------------------------------------------
protected void hideOtherEdges() { Vector keepVisibleList = new Vector(); if (selectedTreePaths == null) return; java.util.List list = view.getEdgeViewsList(); for (Iterator i = list.iterator(); i.hasNext();) { EdgeView ev = (EdgeView) i.next(); String canonicalName = ev.getEdge().getIdentifier(); for (int p = 0; p < selectedTreePaths.length; p++) { TreePath treePath = selectedTreePaths[p]; if (pathMatchesEdge(canonicalName, treePath, edgeAttributes)) keepVisibleList.add(ev); } // for p } // for ec list = view.getEdgeViewsList(); for (Iterator i = list.iterator(); i.hasNext();) { EdgeView ev = (EdgeView) i.next(); if (!keepVisibleList.contains(ev)) view.hideGraphObject(ev); } } // hideOtherEdges //------------------------------------------------------------------------------
String edgeName = edge.getIdentifier(); String interactionName = edgeAtts.getStringAttribute(edge.getIdentifier(), Semantics.INTERACTION);
String sourceId = ed.getSource().getIdentifier(); String targetId = ed.getTarget().getIdentifier(); String edgeId = ed.getIdentifier(); generateExternalLinks(edgeAttributes, ed.getIdentifier(), top_menu);
id = ((Edge) it.next()).getIdentifier();
edgeAttributes.setAttribute(edge.getIdentifier(), BIOPAX_EDGE_TYPE, CONTAINS); edgeList.add(edge);
public void actionPerformed(final ActionEvent e) { final int idLocation = getIdColumn(); final Map<String, GraphObject> selectedMap = paintNodesAndEdges(idLocation); final CyNetwork curNet = Cytoscape.getCurrentNetwork(); final List<GraphObject> nonSelectedObjects = new ArrayList<GraphObject>(); GraphObject fromMap; if (objectType == NODES) { for (Object curNode : curNet.getSelectedNodes()) { fromMap = selectedMap.get(((Node) curNode).getIdentifier()); if (fromMap == null) { nonSelectedObjects.add((GraphObject) curNode); } } resetObjectColor(idLocation); curNet.setSelectedNodeState(nonSelectedObjects, false); } else { for (Object curEdge : curNet.getSelectedEdges()) { fromMap = selectedMap.get(((Edge) curEdge).getIdentifier()); if (fromMap == null) { nonSelectedObjects.add((GraphObject) curEdge); } } resetObjectColor(idLocation); curNet.setSelectedEdgeState(nonSelectedObjects, false); } if (Cytoscape.getCurrentNetworkView() != Cytoscape.getNullNetworkView()) { Cytoscape.getCurrentNetworkView().updateView(); } } });
ids.add(edge.getIdentifier());
} else { data = Cytoscape.getEdgeAttributes(); name = ((Edge) pObject).getIdentifier();
controlledNode, Semantics.INTERACTION, typeStr, true); Cytoscape.getEdgeAttributes().setAttribute( edge.getIdentifier(), BIOPAX_EDGE_TYPE, typeStr); edgeList.add(edge);
private static Object private_getEdgeAttributeValue(Edge edge, String attribute) { final CyAttributes edgeAttrs = Cytoscape.getEdgeAttributes(); final String canonName = edge.getIdentifier(); final byte cyType = edgeAttrs.getType(attribute); if (cyType == CyAttributes.TYPE_BOOLEAN) { return edgeAttrs.getBooleanAttribute(canonName, attribute); } else if (cyType == CyAttributes.TYPE_FLOATING) { return edgeAttrs.getDoubleAttribute(canonName, attribute); } else if (cyType == CyAttributes.TYPE_INTEGER) { return edgeAttrs.getIntegerAttribute(canonName, attribute); } else if (cyType == CyAttributes.TYPE_STRING) { return edgeAttrs.getStringAttribute(canonName, attribute); } else if (cyType == CyAttributes.TYPE_SIMPLE_LIST) { return edgeAttrs.getListAttribute(canonName, attribute); } else if (cyType == CyAttributes.TYPE_SIMPLE_MAP) { return edgeAttrs.getMapAttribute(canonName, attribute); } else { return null; } }
/** * Return the requested Attribute for the given Edge */ public boolean setEdgeAttributeValue(int edge, String attribute, Object value) { final String canonName = getEdge(edge).getIdentifier(); final CyAttributes attrs = Cytoscape.getEdgeAttributes(); if (value instanceof Boolean) { attrs.setAttribute(canonName, attribute, (Boolean) value); return true; } else if (value instanceof Integer) { attrs.setAttribute(canonName, attribute, (Integer) value); return true; } else if (value instanceof Double) { attrs.setAttribute(canonName, attribute, (Double) value); return true; } else if (value instanceof String) { attrs.setAttribute(canonName, attribute, (String) value); return true; } else if (value instanceof List) { attrs.setListAttribute(canonName, attribute, (List) value); return true; } else if (value instanceof Map) { attrs.setMapAttribute(canonName, attribute, (Map) value); return true; } else { return false; } }
/** * Return the requested Attribute for the given Edge */ public Object getEdgeAttributeValue(int edge, String attribute) { final String canonName = getEdge(edge).getIdentifier(); final CyAttributes attrs = Cytoscape.getEdgeAttributes(); final byte cyType = attrs.getType(attribute); if (cyType == CyAttributes.TYPE_BOOLEAN) { return attrs.getBooleanAttribute(canonName, attribute); } else if (cyType == CyAttributes.TYPE_FLOATING) { return attrs.getDoubleAttribute(canonName, attribute); } else if (cyType == CyAttributes.TYPE_INTEGER) { return attrs.getIntegerAttribute(canonName, attribute); } else if (cyType == CyAttributes.TYPE_STRING) { return attrs.getStringAttribute(canonName, attribute); } else if (cyType == CyAttributes.TYPE_SIMPLE_LIST) { return attrs.getListAttribute(canonName, attribute); } else if (cyType == CyAttributes.TYPE_SIMPLE_MAP) { return attrs.getMapAttribute(canonName, attribute); } else { return null; } }
Object i1 = attributes.getAttribute(e1.getIdentifier(),Semantics.INTERACTION); Object i2 = attributes.getAttribute(e2.getIdentifier(),Semantics.INTERACTION);
int[] edgeIndices = Cytoscape.getCurrentNetwork().getEdgeIndicesArray(); for (int i=0; i<edgeIndices.length; i++){ String edgeID = Cytoscape.getRootGraph().getEdge(edgeIndices[i]).getIdentifier(); Object valueObj = attributes.getAttribute(edgeID, attributeName); if (valueObj != null){