Author: jgao Date: 2010-01-29 11:25:15 -0800 (Fri, 29 Jan 2010) New Revision: 19070
Modified: coreplugins/trunk/AdvancedNetworkMerge/plugin.props coreplugins/trunk/AdvancedNetworkMerge/src/csplugins/network/merge/AbstractNetworkMerge.java Log: AdvancedNetworkMerge: intersection and difference operation for edges. Modified: coreplugins/trunk/AdvancedNetworkMerge/plugin.props =================================================================== --- coreplugins/trunk/AdvancedNetworkMerge/plugin.props 2010-01-29 18:30:48 UTC (rev 19069) +++ coreplugins/trunk/AdvancedNetworkMerge/plugin.props 2010-01-29 19:25:15 UTC (rev 19070) @@ -13,7 +13,7 @@ pluginDescription=Provides utilities for mapping attributes of source ID types to new attributes of destination ID types. <a href="http://www.cytoscape.org/cgi-bin/moin.cgi/CyThesaurus_Plugin/ID_Mapping_Examples">Click for tutorial</a>. # Plugin version number, this must be two numbers separated by a decimlal. Ex. 0.2, 14.03 -pluginVersion=1.14 +pluginVersion=1.15 # Compatible Cytoscape version. If there are more than one version, seperate by ",". cytoscapeVersion=2.6,2.7 Modified: coreplugins/trunk/AdvancedNetworkMerge/src/csplugins/network/merge/AbstractNetworkMerge.java =================================================================== --- coreplugins/trunk/AdvancedNetworkMerge/src/csplugins/network/merge/AbstractNetworkMerge.java 2010-01-29 18:30:48 UTC (rev 19069) +++ coreplugins/trunk/AdvancedNetworkMerge/src/csplugins/network/merge/AbstractNetworkMerge.java 2010-01-29 19:25:15 UTC (rev 19070) @@ -175,7 +175,7 @@ // get node matching list List<Map<CyNetwork,Set<GraphObject>>> matchedNodeList = getMatchedList(networks,true); - matchedNodeList = selectMatchedNodeList(matchedNodeList, op, networks); + matchedNodeList = selectMatchedGOList(matchedNodeList, op, networks); final Map<Node,Node> mapNN = new HashMap<Node,Node>(); // save information on mapping from original nodes to merged nodes // to use when merge edges @@ -205,6 +205,8 @@ // match edges List<Map<CyNetwork,Set<GraphObject>>> matchedEdgeList = getMatchedList(networks,false); + + matchedEdgeList = selectMatchedGOList(matchedEdgeList, op, networks); // merge edges final int nEdge = matchedEdgeList.size(); @@ -357,39 +359,41 @@ * * @return list of matched nodes */ - protected List<Map<CyNetwork,Set<GraphObject>>> selectMatchedNodeList(final List<Map<CyNetwork,Set<GraphObject>>> matchedNodeList, + protected List<Map<CyNetwork,Set<GraphObject>>> selectMatchedGOList(final List<Map<CyNetwork,Set<GraphObject>>> matchedGOList, final Operation op, final List<CyNetwork> networks) { - if (matchedNodeList==null || op==null) { + if (matchedGOList==null || op==null) { throw new java.lang.NullPointerException(); - } + } - List<Map<CyNetwork,Set<GraphObject>>> list = new Vector<Map<CyNetwork,Set<GraphObject>>>(); - int nnet = networks.size(); if (op==Operation.UNION) { - list.addAll(matchedNodeList); + return matchedGOList; } else if (op==Operation.INTERSECTION) { - for (Map<CyNetwork,Set<GraphObject>> map:matchedNodeList) { + List<Map<CyNetwork,Set<GraphObject>>> list = new Vector<Map<CyNetwork,Set<GraphObject>>>(); + for (Map<CyNetwork,Set<GraphObject>> map:matchedGOList) { if (map.size()==nnet) {// if contained in all the networks list.add(map); } } + + return list; } else { //if (op==Operation.DIFFERENCE) + List<Map<CyNetwork,Set<GraphObject>>> list = new Vector<Map<CyNetwork,Set<GraphObject>>>(); if (nnet<2) return list; CyNetwork net1 = networks.get(0); CyNetwork net2 = networks.get(1); - for (Map<CyNetwork,Set<GraphObject>> map:matchedNodeList) { + for (Map<CyNetwork,Set<GraphObject>> map:matchedGOList) { if (map.containsKey(net1)&&!map.containsKey(net2)) { list.add(map); } } - } - - return list; + + return list; + } } private void updateTaskMonitor(String status, int percentage) { -- You received this message because you are subscribed to the Google Groups "cytoscape-cvs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cytoscape-cvs?hl=en.
