Package org.cytoscape.model

Examples of org.cytoscape.model.CyEdge


          });     
          Iterator edges=inputNetwork.getEdgeList().iterator();
          while(edges.hasNext()&&!cancelled){  //for each edge, cal the weight
            weight=0.0;
            int common=0;
            CyEdge e=(CyEdge)edges.next();
            Long nFrom=e.getSource().getSUID();
            Long nTo=e.getTarget().getSUID();
           
            //cal the edge weght
           
            List<CyNode> listneighbors1 = inputNetwork.getNeighborList(inputNetwork.getNode(nFrom), CyEdge.Type.ANY);
            List<CyNode> listneighbors2 = inputNetwork.getNeighborList(inputNetwork.getNode(nTo), CyEdge.Type.ANY);

           
           
            // Get neighborhood of this node (including the node)
/*           
            if (listneighbors1.size() < 2) {
              // If there are no neighbors or just one neighbor, nodeInfo calculation is trivial
              NodeInfo nodeInfo = new NodeInfo();

              if (listneighbors1.size() == 1) {
                nodeInfo.coreLevel = 1;
                nodeInfo.coreDensity = 1.0;
                nodeInfo.density = 1.0;
              }

              return nodeInfo;
            }*/

            Long[] neighbors1 = new Long[listneighbors1.size()];
            int i = 0;

            for (CyNode n : listneighbors1) {
              neighbors1[i++] = n.getSUID();
            }

            // Add original node to extract complete neighborhood
            Arrays.sort(neighbors1);
           
           
//           Long[] neighbors1=getNeighborArray(inputNetwork,nFrom);
//          Long[] neighbors2=getNeighborArray(inputNetwork,nTo);
            Arrays.sort(neighbors1);
            for(int j=0;j<listneighbors2.size();j++){
              Long key=listneighbors2.get(j).getSUID();
              if(Arrays.binarySearch(neighbors1, key)>=0)//exist a common neighbor of both nodes
                common++;
            }
            common++;
            degree1 = inputNetwork.getAdjacentEdgeList(e.getSource(), CyEdge.Type.ANY).size();
            degree2 = inputNetwork.getAdjacentEdgeList(e.getTarget(), CyEdge.Type.ANY).size();

//            degree1=super.getNodeDegree(inputNetwork,e.getSource().getSUID());
//            degree2=getNodeDegree(inputNetwork,e.getTarget().getSUID());
           
           
/*            degree1=inputNetwork.getDegree(e.getSource());
            degree2=inputNetwork.getDegree(e.getTarget());*/
            min=degree1<degree2 ? degree1:degree2;
            weight=(double)(common)/(double)min;
           
            //add to the edge weights map
            if(edgeWeightsMap.containsKey(new Double(weight))) {
              al=(ArrayList)edgeWeightsMap.get(new Double(weight));
              al.add(e.getSUID());
            }else{
              al=new ArrayList();
              al.add(e.getSUID());
              edgeWeightsMap.put(new Double(weight), al);
            }
          }        
          curEdgeWeights=edgeWeightsMap;
          edgeWeightNetworkMap.put(networkID, edgeWeightsMap);
View Full Code Here


      Then, Operation UNION:  according to different situation, in which the two nodes consisting
        this arc may belong to different Complexes or an identical Complex and that the
        attributes of the Complexes varies, we take on different action
         ***********************************************************************************************/
        ArrayList alEdgeWithSameWeight; 
        CyEdge curEdge;                                                                                                                         
        for (Iterator iterator = values.iterator(); iterator.hasNext();) {
            //each weight may be associated with multiple edges, iterate over these lists
          alEdgeWithSameWeight = (ArrayList) iterator.next();
            for (int j = 0; j < alEdgeWithSameWeight.size(); j++) {//for each edge
                Long edgeIndex = ((Long) alEdgeWithSameWeight.get(j)).longValue();
                curEdge=inputNetwork.getEdge(edgeIndex);               
            Long inFrom = curEdge.getSource().getSUID();
            Long inTo   = curEdge.getTarget().getSUID();
            NodeInfo fromNI=(NodeInfo)curNodeInfos.get(inFrom)//source node info
            NodeInfo toNI=(NodeInfo)curNodeInfos.get(inTo)//target node info
           
            int icFrom=fromNI.iComplex;  //complex that the source node belongs to
            int icTo=toNI.iComplex;    //complex that the target node belongs to
View Full Code Here

TOP

Related Classes of org.cytoscape.model.CyEdge

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.