Examples of CyNetwork


Examples of cytoscape.CyNetwork

        selectReversibleReactionNodes();
      }
  }
   
  public void selectReversibleReactionNodes(){
    CyNetwork network = Cytoscape.getCurrentNetwork();
    network.unselectAllNodes();
    Collection<CyNode> reversibleReactionNodes = getReversibleReactionNodes();
    network.setSelectedNodeState(reversibleReactionNodes, true);   
    Cytoscape.getCurrentNetworkView().updateView();
   
    String text = String.format("%s reversible reactions", reversibleReactionNodes.size());
    JOptionPane.showMessageDialog(
        Cytoscape.getDesktop(),
View Full Code Here

Examples of cytoscape.CyNetwork

    }
    updateCurrentDocument();
  }
 
  public void updateCurrentDocument() {
    CyNetwork network = Cytoscape.getCurrentNetwork();
    if (network != null){
      String key = network.getIdentifier();
      if (documentMap.containsKey(key)){
        currentDocument = documentMap.get(key);
        currentNSBToNodeMapping = NSBToNodeMappingMap.get(key);
        currentNodeToNSBMapping = nodeToNSBMappingMap.get(key);
      } else {
View Full Code Here

Examples of org.cytoscape.model.CyNetwork

     */
    public void actionPerformed(ActionEvent event) {
        resultFound = false;
        CurrentParameters resultParaSet=null;
        //get the network object, this contains the graph
        final CyNetwork network = applicationManager.getCurrentNetwork();
        final CyNetworkView networkView = this.applicationManager.getCurrentNetworkView();
       
        ParameterSet currentParamsCopy = getMainPanel().getCurrentParamsCopy();
//       curParams.setNetworkID(network.getSUID());
        if (network == null) {
            System.err.println("Can't get a network.");
            return;
        }
        if (network.getNodeCount() < 1) {
            JOptionPane.showMessageDialog(null/*Cytoscape.getDesktop()*/,
                    "Network has not been loaded!", "Error", JOptionPane.WARNING_MESSAGE);
            return;
        }
       
       
        //get selected node
        List<CyNode> nodes = network.getNodeList();
        Set<Long> selectedNodes = new HashSet<Long>();
    for (Iterator iterator = nodes.iterator(); iterator.hasNext();)
    {
      CyNode n = (CyNode)iterator.next();
      if (((Boolean)network.getRow(n).get("selected", java.lang.Boolean.class)).booleanValue())
        selectedNodes.add(n.getSUID());
    }
   
   
//        Set selectedNodes = network.getSelectedNodes();
        Long[] selectedNodesRGI = new Long[selectedNodes.size()];
        int c = 0;
        for(Iterator i = selectedNodes.iterator(); i.hasNext();)
          {
          Long nodeID = (Long) i.next();
          selectedNodesRGI[c++]=nodeID;
          }
       
       /* for (Iterator i = selectedNodes.iterator(); i.hasNext();) {
            CyNode node = (CyNode) i.next();
            selectedNodesRGI[c] = node.getSUID();
            c++;
        }*/
        //notice, here we set the selected nodes

        currentParamsCopy.setSelectedNodes(selectedNodesRGI);

        Algorithm alg1 = null;
        boolean newNet=isDirty(network);//judge new network
       
        

       

        ParameterSet savedParamsCopy;
        if (this.clusterUtil.containsNetworkAlgorithm(network.getSUID().longValue())) {
//          alg1 = this.clusterUtil.getNetworkAlgorithm(network.getSUID().longValue());

         
         
          savedParamsCopy = this.clusterUtil.getCurrentParameters().getParamsCopy(network.getSUID());
         
          analyze=checkParams(currentParamsCopy, newNet);
         
         
        } else {
          //clusterUtil.getNetworkAlgorithm(network.getSUID().longValue())
         
         
         
          savedParamsCopy = this.clusterUtil.getCurrentParameters().getParamsCopy(null);
        
                 
          this.analyze = 0;
        }
       

       
       

       
        if (analyze == INTERRUPTED || analyze == EXISTS)
          JOptionPane.showMessageDialog(AnalyzeAction.this.swingApplication.getJFrame(),
                interruptedMessage, "Interrupted", JOptionPane.WARNING_MESSAGE);
        else
        final int resultId = this.clusterUtil.getCurrentResultId();

        if ((this.analyze == 0) || (isDirty(network)) || (!currentParamsCopy.getAlgorithm().equals(savedParamsCopy.getAlgorithm())) ||
          (currentParamsCopy.isIncludeLoops() != savedParamsCopy.isIncludeLoops()) ||
          (currentParamsCopy.getDegreeCutoff() != savedParamsCopy.getDegreeCutoff())) {
          this.analyze = 1;
//         logger.debug("Analysis: score network, find clusters");
          this.clusterUtil.getCurrentParameters().setParams(currentParamsCopy, resultId, network.getSUID());
        } else if (!checkEqual(savedParamsCopy, currentParamsCopy)) {
          this.analyze = 2;
  //        logger.debug("Analysis: find clusters");
          this.clusterUtil.getCurrentParameters().setParams(currentParamsCopy, resultId, network.getSUID());
        } else {
          this.analyze = 3;
          interruptedMessage = "The parameters you specified have not changed.";
          this.clusterUtil.getCurrentParameters().setParams(currentParamsCopy, resultId, network.getSUID());
        }

        if(currentParamsCopy.getAlgorithm().equals(ParameterSet.MCODE ))
            alg1 = new MCODE(network.getSUID(), this.clusterUtil);
        if(currentParamsCopy.getAlgorithm().equals(ParameterSet.EAGLE ))
            alg1 = new EAGLE(network.getSUID(), this.clusterUtil);
        if(currentParamsCopy.getAlgorithm().equals(ParameterSet.FAGEC ))
            alg1 = new FAGEC(network.getSUID(), this.clusterUtil);
        this.clusterUtil.addNetworkAlgorithm(network.getSUID().longValue(), alg1);
       
/*      
        //if (!networkManager.containsKey(network.getIdentifier())){
          newNet=true;
      alg = curParams.getAlg();
            //alg = new Algorithm(null);
            networkManager.put(network.getSUID(), alg);
        //}
        //else alg = (Algorithm) networkManager.get(network.getIdentifier());
        //check the validation the input parameters
        analyze=checkParams(curParams, newNet);
       
       
        resultId = this.clusterUtil.getCurrentResultId();
       
        if (analyze == INTERRUPTED || analyze == EXISTS)
            JOptionPane.showMessageDialog(nullCytoscape.getDesktop(),
                interruptedMessage, "Interrupted", JOptionPane.WARNING_MESSAGE);
        else{           
            //update the parameter set with this result title
          clusterUtil.getCurrentParameters().setParams(curParams,  (resultCounter + 1),
                network.getSUID());*/
         

        if ((currentParamsCopy.getScope().equals(ParameterSet.SELECTION)) &&
          (currentParamsCopy.getSelectedNodes().length < 1)) {
          this.analyze = 3;
          interruptedMessage = "You must select ONE OR MORE NODES\nfor this scope.";
        }

        if (this.analyze == 3) {
          JOptionPane.showMessageDialog(this.swingApplication.getJFrame(),
            interruptedMessage,
            "Analysis Interrupted",
            2);
        }
        else {
         
            
         final  Algorithm alg2=alg1;
          AnalysisCompletedListener listener = new AnalysisCompletedListener()
            {
              public void handleEvent(AnalysisCompletedEvent e)
              {
                ResultPanel resultsPanel = null;
                boolean resultFound = false;
                AnalyzeAction.this.setDirty(network, false);

                if (e.isSuccessful()) {
                  if ((e.getClusters() != null) && (!e.getClusters().isEmpty())) {
                   
                   
               
                     
//                      CyAttributes cyAttributes = Cytoscape.getNodeAttributes();
                      /*int length=0;
                      for(int i=0; i < e.getClusters().size(); i++){
                        Cluster c = (Cluster)e.getClusters().get(i);
                        CyNetwork clusterNetwork = c.getNetwork();
                       
                        length = length + clusterNetwork.getNodeCount();
                        //length = length + complexes[i].getGPCluster().getNodeIndicesArray().length;
                      }
                      int[] clusteredNodes;
                      clusteredNodes = new int[length];
                      int index=0;
                      for(int i=0; i < e.getClusters().size(); i++){
                        Cluster c = (Cluster)e.getClusters().get(i);
                        CyNetwork clusterNetwork = c.getNetwork();
                        Iterator itr = clusterNetwork.getNodeList().iterator();
                       
                        //Iterator itr = complexes[i].getGPCluster().nodesIterator();
                        while(itr.hasNext()){
                         
                          CyNode node = (CyNode) itr.next();
                          System.out.println(node.getSUID());
                          CyRow nodeRow = clusterNetwork.getRow(node);
                          nodeRow.set("Cluster", Integer.valueOf(i) );
                          //cyAttributes.setAttribute(node.getSUID(), "Cluster", i);
                        }
                      }*/
                   
                   
                   
                    resultFound = true;
                    AnalyzeAction.this.clusterUtil.addNetworkResult(network.getSUID().longValue());

                    DiscardResultAction discardResultAction = new DiscardResultAction(
                      "Discard Result",
                      resultId,
                      AnalyzeAction.this.applicationManager,
View Full Code Here

Examples of org.cytoscape.model.CyNetwork

    public void actionPerformed(ActionEvent evt)
    {
      NumberFormat nf = NumberFormat.getInstance();
      nf.setMaximumFractionDigits(3);
      final Cluster cluster = (Cluster)ResultPanel.this.clusters.get(this.selectedRow);
      final CyNetwork clusterNetwork = cluster.getNetwork();
      final String title = this.trigger.getResultId() + ": " + cluster.getName() + " (Score: " +
        nf.format(cluster.getScore()) + ")";

      SwingWorker worker = new SwingWorker()
      {
        protected CyNetworkView doInBackground() throws Exception
        {
          CySubNetwork newNetwork = ResultPanel.this.mcodeUtil.createSubNetwork(clusterNetwork, clusterNetwork.getNodeList(),
            SavePolicy.SESSION_FILE);
          newNetwork.getRow(newNetwork).set("name", title);

          VisualStyle vs = ResultPanel.this.mcodeUtil.getNetworkViewStyle(ResultPanel.this.networkView);
          CyNetworkView newNetworkView = ResultPanel.this.mcodeUtil.createNetworkView(newNetwork, vs);
View Full Code Here

Examples of org.cytoscape.model.CyNetwork

      String attributeName = (String)((JComboBox)e.getSource()).getSelectedItem();
      int selectionIndex = ((JComboBox)e.getSource()).getSelectedIndex();

      if (!attributeName.equals("Please Select")) {
        CyNetwork net = ((Cluster)ResultPanel.this.clusters.get(this.selectedRow)).getNetwork();
        Object value;
        for (Iterator localIterator1 = net.getNodeList().iterator(); localIterator1.hasNext();
          )
        {
          CyNode node = (CyNode)localIterator1.next();

          ArrayList attributeValues = new ArrayList();
          CyRow row = net.getRow(node);
          Class type = row.getTable().getColumn(attributeName).getType();

          if (Collection.class.isAssignableFrom(type)) {
            Collection valueList = (Collection)row.get(attributeName, type);
View Full Code Here

Examples of org.cytoscape.model.CyNetwork

                  final int height,
                  final int width,
                  SpringEmbeddedLayouter layouter,
                  boolean layoutNecessary,
                  final Loader loader) {
    final CyNetwork net = cluster.getNetwork();
   
    // Progress reporters.
    // There are three basic tasks, the progress of each is calculated and then combined
    // using the respective weighting to get an overall progress global progress
    int weightSetupNodes = 20; // setting up the nodes and edges is deemed as 25% of the whole task
View Full Code Here

Examples of org.cytoscape.model.CyNetwork

        // Get sub-networks for all clusters, score and rank them
        // convert the ArrayList to an array of CyNetworks and sort it by cluster score
        for (int i = 0; i < clusters.size(); i++) {
          final Cluster c = clusters.get(i);
          final CyNetwork clusterNetwork = c.getNetwork();
          fout.write((i + 1) + "\t"); //rank
          NumberFormat nf = NumberFormat.getInstance();
          nf.setMaximumFractionDigits(3);
          fout.write(nf.format(c.getScore()) + "\t");
          // cluster size - format: (# prot, # intx)
          fout.write(clusterNetwork.getNodeCount() + "\t");
          fout.write(clusterNetwork.getEdgeCount() + "\t");
          // create a string of node names - this can be long
          fout.write(getNodeNameList(clusterNetwork) + lineSep);
        }
        return true;
      }
View Full Code Here

Examples of org.cytoscape.model.CyNetwork

      ListSelectionModel lsm = (ListSelectionModel)e.getSource();

      if (!lsm.isSelectionEmpty()) {
        int selectedRow = lsm.getMinSelectionIndex();
        Cluster c = (Cluster)ResultPanel.this.clusters.get(selectedRow);
        CyNetwork gpCluster = c.getNetwork();//���µĽ�����Ի��ֵ���������½�����ܻ��ֵ
        ResultPanel.this.selectCluster(gpCluster);

        if (ResultPanel.this.exploreContent[selectedRow] == null) {
          ResultPanel.this.exploreContent[selectedRow] = ResultPanel.this.createExploreContent(selectedRow);
        }
View Full Code Here

Examples of org.cytoscape.model.CyNetwork

  }

  public void handleEvent(NetworkAboutToBeDestroyedEvent e)
  {
    if (this.mcodeUtil.isOpened()) {
      CyNetwork network = e.getNetwork();
      Set resultIds = this.mcodeUtil.getNetworkResults(network.getSUID().longValue());

      for (Iterator localIterator = resultIds.iterator(); localIterator.hasNext(); ) { int id = ((Integer)localIterator.next()).intValue();
       ResultPanel panel = this.mcodeUtil.getResultPanel(id);
        if (panel != null) panel.discard(false);
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.