Package cytoscape.data

Examples of cytoscape.data.CyAttributes


  }
 
  /** Sets the bounding box attributes to the network */
  public void setNetworkAttributesFromBoundingBoxes(CyNetwork network){
   
    CyAttributes nodeAttributes = Cytoscape.getNodeAttributes();
    setCyNodeAttributesForMap(nodeAttributes, speciesBoundingBoxes);
    setCyNodeAttributesForMap(nodeAttributes, reactionBoundingBoxes);
    setCyNodeAttributesForMap(nodeAttributes, speciesGlyphBoundingBoxes);
    setCyNodeAttributesForMap(nodeAttributes, reactionGlyphBoundingBoxes);   
  }
View Full Code Here


    layout.setName(layoutId);
   
    CyNetwork network = view.getNetwork();
      @SuppressWarnings("unchecked")
    List<CyNode> nodes = network.nodesList();
      CyAttributes nodeAttributes = Cytoscape.getNodeAttributes();
     
      for (CyNode node : nodes){
        NodeView nodeView = view.getNodeView(node);
        // Test if reaction or species node
        String nodeId = node.getIdentifier();
        String nodeType = (String) nodeAttributes.getAttribute(nodeId, CySBMLConstants.ATT_TYPE);
        if (nodeType!=null){
          if (nodeType.equals(CySBMLConstants.NODETYPE_REACTION) || nodeType.equals(CySBMLConstants.NODETYPE_SPECIES)){
           
            double xpos = nodeView.getXPosition();
          double ypos = nodeView.getYPosition();
View Full Code Here

    Model model = document.getModel();
    networkName = getAvailableNetworkName(model.getId());
    model.setId(networkName);
   
    // Handle the node and edge information
    CyAttributes nodeAttributes = Cytoscape.getNodeAttributes();
    CyAttributes edgeAttributes = Cytoscape.getEdgeAttributes();
    CyAttributes netAttributes = Cytoscape.getNetworkAttributes();
   
    nodeIds = new ArrayList<Integer>();
    edgeIds = new ArrayList<Integer>();
   
    // Model
    String id = networkName;
    netAttributes.setAttribute(id, CySBMLConstants.ATT_ID, model.getId());
    if (model.isSetName()){
      netAttributes.setAttribute(id, CySBMLConstants.ATT_NAME, model.getName());
    } else {
      netAttributes.setAttribute(id, CySBMLConstants.ATT_NAME, model.getId());
    }
    if (model.isSetMetaId()){
      netAttributes.setAttribute(id, CySBMLConstants.ATT_METAID, model.getMetaId());
    }
    if (model.isSetSBOTerm()){
      netAttributes.setAttribute(id, CySBMLConstants.ATT_SBOTERM, model.getSBOTermID());
    }
   
    // Species
    for (Species species : model.getListOfSpecies()) {
      id = species.getId();
View Full Code Here

   * Identical function used for different types. */
  public static Set<Object> getValueSet(String attributeName){
    Set<Object> valueSet = new HashSet<Object>();
      if (attributeName == null){ return valueSet;}
   
    CyAttributes nodeAttrs = Cytoscape.getNodeAttributes();
    @SuppressWarnings("unchecked")
    List<CyNode> nodeList = Cytoscape.getCyNodesList();
    for (CyNode node: nodeList){
      if (nodeAttrs.getAttribute(node.getIdentifier(), attributeName) != null){
        valueSet.add(nodeAttrs.getAttribute(node.getIdentifier(), attributeName));
      }
    }
    return valueSet;
  }
View Full Code Here

    return rrNodes;
  }
 
  private boolean isReversibleReactionNode(CyNode n){
    boolean result = false;
    CyAttributes nodeAttributes = Cytoscape.getNodeAttributes();
    String id = n.getIdentifier();
   
    // Get the SBMLType
    Object tmp = nodeAttributes.getAttribute(id, CySBMLConstants.ATT_TYPE);
    if (tmp == null){
      return false;
    }
    String sbmlType = (String) tmp;
   
    // Get the reversibility information
    tmp = nodeAttributes.getAttribute(id, CySBMLConstants.ATT_REVERSIBLE);
    if (tmp == null){
      return false;
    }
    boolean reversible = (Boolean) tmp;
   
View Full Code Here

    assertEquals(2, network.getEdgeCount());
  }

  @Test
  public void speciesAttributeTest() throws IOException {
    CyAttributes nAtt = Cytoscape.getNodeAttributes();
    assertEquals("s1", (String) nAtt.getAttribute("s1", CySBMLConstants.ATT_ID));
    assertEquals("s1", (String) nAtt.getAttribute("s1", CySBMLConstants.ATT_NAME));
    assertEquals("c1", (String) nAtt.getAttribute("s1", CySBMLConstants.ATT_COMPARTMENT));
    assertEquals(false, (Boolean) nAtt.getAttribute("s1", CySBMLConstants.ATT_BOUNDARY_CONDITION));
    assertEquals(false, (Boolean) nAtt.getAttribute("s1", CySBMLConstants.ATT_CONSTANT));
    assertEquals(false, (Boolean) nAtt.getAttribute("s1", CySBMLConstants.ATT_HAS_ONLY_SUBSTANCE_UNITS));
   
    assertEquals("s2", (String) nAtt.getAttribute("s2", CySBMLConstants.ATT_ID));
    assertEquals("s2", (String) nAtt.getAttribute("s2", CySBMLConstants.ATT_NAME));
    assertEquals("c1", (String) nAtt.getAttribute("s2", CySBMLConstants.ATT_COMPARTMENT));
    assertEquals(false, (Boolean) nAtt.getAttribute("s2", CySBMLConstants.ATT_BOUNDARY_CONDITION));
    assertEquals(false, (Boolean) nAtt.getAttribute("s2", CySBMLConstants.ATT_CONSTANT));
    assertEquals(false, (Boolean) nAtt.getAttribute("s2", CySBMLConstants.ATT_HAS_ONLY_SUBSTANCE_UNITS))
  }
View Full Code Here

    String name = netId + "_GRN";
    return name;
  }
 
  public void addNodesToGRN() {
    CyAttributes nAtts = Cytoscape.getNodeAttributes();
    for (Object obj: sbmlNetwork.nodesList()){
      CyNode node = (CyNode) obj;
      String type = (String) nAtts.getAttribute(node.getIdentifier(), CySBMLConstants.ATT_SBOTERM);
      if (GeneRegulatoryNetwork.speciesSBOforGRN.contains(type)){
        nodeIds.add(node.getRootGraphIndex());
      }
    } 
  }
View Full Code Here

      // Destroy the edges
      for (Object edge : Cytoscape.getCyEdgesList()) {
          Cytoscape.getRootGraph().removeEdge((Edge) edge)
      }
      // Destroy the network attributes
      CyAttributes nodeAttributes = Cytoscape.getNodeAttributes();
      for (String name: nodeAttributes.getAttributeNames()){
        nodeAttributes.deleteAttribute(name);
      }
      CyAttributes edgeAttributes = Cytoscape.getEdgeAttributes();
      for (String name: edgeAttributes.getAttributeNames()){
        edgeAttributes.deleteAttribute(name);
      }
     
      success = true;
      System.out.println("--> Number of nodes:" + Cytoscape.getCyNodesList().size());
      System.out.println("--> Number of edges:" + Cytoscape.getCyEdgesList().size());
View Full Code Here

TOP

Related Classes of cytoscape.data.CyAttributes

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.