Author: mes
Date: 2010-12-08 17:18:07 -0800 (Wed, 08 Dec 2010)
New Revision: 23142
Added:
core3/network-analyzer-impl/trunk/src/main/resources/META-INF/
core3/network-analyzer-impl/trunk/src/main/resources/META-INF/spring/
core3/network-analyzer-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
core3/network-analyzer-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AboutAction.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalyzeNetworkAction.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalyzeSubsetAction.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/BatchAnalysisAction.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/CompareAction.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ConnComponentAction.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/CyNetworkUtils.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/DirNetworkAnalyzer.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/LoadNetstatsAction.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/MapParameterAction.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/NetAnalyzerAction.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/PlotParameterAction.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/Plugin.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/RemDupEdgesAction.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/RemoveSelfLoopsAction.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/SettingsAction.java
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/UndirNetworkAnalyzer.java
Log:
some fixes
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AboutAction.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AboutAction.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AboutAction.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -20,7 +20,7 @@
import java.awt.event.ActionEvent;
import cytoscape.Cytoscape;
-import cytoscape.util.CytoscapeAction;
+import org.cytoscape.application.swing.AbstractCyAction;
import de.mpg.mpi_inf.bioinf.netanalyzer.data.Messages;
import de.mpg.mpi_inf.bioinf.netanalyzer.ui.AboutDialog;
@@ -29,13 +29,14 @@
*
* @author Yassen Assenov
*/
-public final class AboutAction extends CytoscapeAction {
+public final class AboutAction extends AbstractCyAction {
/**
* Initializes a new instance of <code>AboutAction</code>.
*/
- public AboutAction() {
- super(Messages.AC_ABOUT);
+ public AboutAction(CyApplicationManager appMgr,CySwingApplication
swingApp) {
+ super(Messages.AC_ABOUT,appMgr,swingApp);
+ setPreferredMenu("Plugins." + Messages.AC_MENU_ANALYSIS);
}
/*
@@ -45,8 +46,8 @@
*/
@Override
public void actionPerformed(ActionEvent e) {
- AboutDialog d = new AboutDialog(Cytoscape.getDesktop());
- d.setLocationRelativeTo(Cytoscape.getDesktop());
+ AboutDialog d = new AboutDialog(swingApp.getJFrame());
+ d.setLocationRelativeTo(swingApp.getJFrame());
d.setVisible(true);
}
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalyzeNetworkAction.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalyzeNetworkAction.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalyzeNetworkAction.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -45,8 +45,9 @@
/**
* Initializes a new instance of <code>AnalyzeNetworkAction</code>.
*/
- public AnalyzeNetworkAction() {
- super(Messages.AC_ANALYZE);
+ public AnalyzeNetworkAction(CyApplicationManager
appMgr,CySwingApplication swingApp) {
+ super(Messages.AC_ANALYZE,appMgr,swingApp);
+ setPreferredMenu("Plugins." + Messages.AC_MENU_ANALYSIS);
}
/*
@@ -97,7 +98,7 @@
} else {
analyzer = new UndirNetworkAnalyzer(aNetwork,
aNodeSet, interpr);
}
- return new AnalysisExecutor(Cytoscape.getDesktop(),
analyzer);
+ return new AnalysisExecutor(swingApp.getJFrame(),
analyzer);
} catch (IllegalArgumentException ex) {
Utils.showInfoBox(Messages.DT_INFO,
Messages.SM_NETWORKEMPTY);
return null;
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalyzeSubsetAction.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalyzeSubsetAction.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/AnalyzeSubsetAction.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -45,8 +45,9 @@
/**
* Initializes a new instance of <code>NetSubsetAction</code>.
*/
- public AnalyzeSubsetAction() {
- super(Messages.AC_ANALYZE_SUBSET);
+ public AnalyzeSubsetAction(CyApplicationManager appMgr) {
+ super(Messages.AC_ANALYZE_SUBSET,appMgr,swingApp);
+ setPreferredMenu("Plugins." + Messages.AC_MENU_ANALYSIS);
selected = null;
}
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/BatchAnalysisAction.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/BatchAnalysisAction.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/BatchAnalysisAction.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -50,8 +50,9 @@
/**
* Constructs a new batch analysis action.
*/
- protected BatchAnalysisAction() {
- super(Messages.AC_BATCH_ANALYSIS);
+ protected BatchAnalysisAction(CyApplicationManager
appMgr,CySwingApplication swingApp) {
+ super(Messages.AC_BATCH_ANALYSIS,appMgr,swingApp);
+ setPreferredMenu("Plugins." + Messages.AC_MENU_ANALYSIS);
}
/*
@@ -62,7 +63,7 @@
@Override
public void actionPerformed(ActionEvent e) {
try {
- final CytoscapeDesktop desktop = Cytoscape.getDesktop();
+ final Frame desktop = swingApp.getJFrame();
// Step 1 - Adjust settings
BatchSettingsDialog d1 = new
BatchSettingsDialog(desktop);
d1.setVisible(true);
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/CompareAction.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/CompareAction.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/CompareAction.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -22,7 +22,7 @@
import cytoscape.Cytoscape;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import cytoscape.util.CytoscapeAction;
+import org.cytoscape.application.swing.AbstractCyAction;
import de.mpg.mpi_inf.bioinf.netanalyzer.data.Messages;
import de.mpg.mpi_inf.bioinf.netanalyzer.ui.CompareDialog;
@@ -31,15 +31,16 @@
*
* @author Yassen Assenov
*/
-public class CompareAction extends CytoscapeAction {
+public class CompareAction extends AbstractCyAction {
private static final Logger logger =
LoggerFactory.getLogger(CompareAction.class);
/**
* Initializes a new instance of <code>GOPTRunAlgorithm</code>.
*/
- public CompareAction() {
- super(Messages.AC_COMPARE);
+ public CompareAction(CyApplicationManager appMgr,CySwingApplication
swingApp) {
+ super(Messages.AC_COMPARE,appMgr,swingApp);
+ setPreferredMenu("Plugins." + Messages.AC_MENU_MODIFICATION);
}
/*
@@ -50,7 +51,7 @@
@Override
public void actionPerformed(ActionEvent event) {
try {
- CompareDialog d = new
CompareDialog(Cytoscape.getDesktop());
+ CompareDialog d = new
CompareDialog(swingApp.getJFrame());
d.setVisible(true);
} catch (InnerException ex) {
// NetworkAnalyzer internal error
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ConnComponentAction.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ConnComponentAction.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/ConnComponentAction.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -42,8 +42,9 @@
/**
* Initializes a new instance of <code>ConnComponentAction</code>.
*/
- public ConnComponentAction() {
- super(Messages.AC_CONNCOMP);
+ public ConnComponentAction(CyApplicationManager
appMgr,CySwingApplication swingApp) {
+ super(Messages.AC_CONNCOMP,appMgr,swingApp);
+ setPreferredMenu("Plugins." + Messages.AC_MENU_MODIFICATION);
}
/*
@@ -70,7 +71,7 @@
Utils.showInfoBox(Messages.DT_CONNCOMP, msg);
} else {
Arrays.sort(comps, new CCInfoInvComparator());
- ConnComponentsDialog d = new
ConnComponentsDialog(Cytoscape.getDesktop(), network, comps);
+ ConnComponentsDialog d = new
ConnComponentsDialog(swingApp.getJFrame(), network, comps);
d.setVisible(true);
}
} catch (InnerException ex) {
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/CyNetworkUtils.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/CyNetworkUtils.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/CyNetworkUtils.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -31,15 +31,13 @@
import java.util.Map;
import java.util.Set;
-import cytoscape.CyNetwork;
-import cytoscape.Cytoscape;
-import cytoscape.data.CyAttributes;
+import org.cytoscape.model.CyNetwork;
import de.mpg.mpi_inf.bioinf.netanalyzer.data.Messages;
import de.mpg.mpi_inf.bioinf.netanalyzer.data.MutInteger;
import de.mpg.mpi_inf.bioinf.netanalyzer.data.NetworkInspection;
/**
- * Utility class providing network functionality absent or deprecated in
{...@link cytoscape.CyNetwork} .
+ * Utility class providing network functionality absent or deprecated in
{...@link org.cytoscape.model.CyNetwork} .
*
* @author Yassen Assenov
* @author Sven-Eric Schelhorn
@@ -62,11 +60,12 @@
* array in alphabetical order.
*/
private static String[][] keepAvailableAttributes(CyNetwork aNetwork,
Set<String> computedAttr,
- CyAttributes cyAttr, Set<String> netAnalyzerAttr) {
+ CyTable table, Set<String> netAnalyzerAttr) {
final List<String> visualizeAttr = new
ArrayList<String>(computedAttr.size() + 1);
+ final Map<String,Class<?>> columnTypeMap =
table.getColumnTypeMap();
for (final String attr : computedAttr) {
- if (cyAttr.getType(attr) == CyAttributes.TYPE_FLOATING
- || cyAttr.getType(attr) ==
CyAttributes.TYPE_INTEGER) {
+ if (columnTypeMap.get(attr) == Double.class ||
+ columnTypeMap.get(attr) == Integer.class) {
visualizeAttr.add(attr);
}
}
@@ -91,20 +90,15 @@
* set if no such attributes are found.
*/
public static String[][] getComputedEdgeAttributes(CyNetwork aNetwork) {
- final CyAttributes edgeAttributes =
Cytoscape.getEdgeAttributes();
- final Collection<String> allAttrs =
Arrays.asList(edgeAttributes.getAttributeNames());
- final Set<String> computedAttr = new HashSet<String>(allAttrs);
- // TODO: [Cytoscape 2.8] Check if the returned iterator is
parameterized
- final Iterator<?> itn = aNetwork.edgesIterator();
- while (itn.hasNext()) {
- final String id = ((Edge) itn.next()).getIdentifier();
- for (final String attr : allAttrs) {
- if (!hasAttr(id, edgeAttributes, attr)) {
- computedAttr.remove(attr);
- }
- }
+ final CyTable table =
tableMgr.getTableMap(CyEdge.class,aNetwork).get(CyNetwork.DEFAULT_ATTRS);
+ final Map<String,Class<?>> columnTypeMap =
table.getColumnTypeMap();
+ final Set<String> computedAttr = new
HashSet<String>(columnTypeMap.keySet());
+ for (final CyEdge n : aNetwork.getEdgeList()) {
+ for ( final Map.Entry<String,Class<?> e :
columnTypeMap.entrySet() )
+ if (!n.getCyRow().isSet(e.getKey(),e.getValue())
+ computedAttr.remove(e.getKey());
}
- return keepAvailableAttributes(aNetwork, computedAttr,
edgeAttributes, Messages.getEdgeAttributes());
+ return keepAvailableAttributes(aNetwork, computedAttr, table,
Messages.getEdgeAttributes());
}
/**
@@ -116,75 +110,18 @@
* set if no such attributes are found.
*/
public static String[][] getComputedNodeAttributes(CyNetwork aNetwork) {
- final CyAttributes nodeAttributes =
Cytoscape.getNodeAttributes();
- final Collection<String> allAttrs =
Arrays.asList(nodeAttributes.getAttributeNames());
- final Set<String> computedAttr = new HashSet<String>(allAttrs);
- // TODO: [Cytoscape 2.8] Check if the returned iterator is
parameterized
- final Iterator<?> itn = aNetwork.nodesIterator();
- while (itn.hasNext()) {
- final String id = ((Node) itn.next()).getIdentifier();
- for (final String attr : allAttrs) {
- if (!hasAttr(id, nodeAttributes, attr)) {
- computedAttr.remove(attr);
- }
- }
+ final CyTable table =
tableMgr.getTableMap(CyNode.class,aNetwork).get(CyNetwork.DEFAULT_ATTRS);
+ final Map<String,Class<?>> columnTypeMap =
table.getColumnTypeMap();
+ final Set<String> computedAttr = new
HashSet<String>(columnTypeMap.keySet());
+ for (final CyNode n : aNetwork.getNodeList()) {
+ for ( final Map.Entry<String,Class<?> e :
columnTypeMap.entrySet() )
+ if (!n.getCyRow().isSet(e.getKey(),e.getValue())
+ computedAttr.remove(e.getKey());
}
- return keepAvailableAttributes(aNetwork, computedAttr,
nodeAttributes, Messages.getNodeAttributes());
+ return keepAvailableAttributes(aNetwork, computedAttr, table,
Messages.getNodeAttributes());
}
/**
- * Checks if the attribute of a node with current id has a computed
value.
- *
- * @param id
- * Id of a node of interest.
- * @param cyAttr
- * Set of node/edge attributes in Cytoscape.
- * @param attr
- * An attribute shown in Cytoscape.
- * @return <code>true</code> when there are computed values for the
given attribute; <code>false</code>
- * otherwise.
- */
- private static boolean hasAttr(String id, CyAttributes cyAttr, String
attr) {
- final byte attrType = cyAttr.getType(attr);
- if (attrType == CyAttributes.TYPE_FLOATING) {
- if (cyAttr.getDoubleAttribute(id, attr) != null) {
- return true;
- }
- }
- if (attrType == CyAttributes.TYPE_INTEGER) {
- if (cyAttr.getIntegerAttribute(id, attr) != null) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns the edges connecting two nodes.
- *
- * @param aNode1
- * Node that has an edge with aNode2
- * @param aNode2
- * Node that has an edge with aNode1
- * @return Edges connecting aNode1 and aNode2
- */
- protected static List<Edge> getConnEdge(CyNetwork aNetwork, Node
aNode1, Node aNode2) {
- final List<Node> nodes = new ArrayList<Node>(2);
- nodes.add(aNode1);
- nodes.add(aNode2);
- // TODO: [Cytoscape 2.8] Check if the returned iterator is
parameterized
- final List<?> allEdges = aNetwork.getConnectingEdges(nodes);
- final List<Edge> connEdges = new ArrayList<Edge>();
- for (int i = 0; i < allEdges.size(); i++) {
- final Edge e = (Edge) allEdges.get(i);
- if (!e.getSource().equals(e.getTarget())) {
- connEdges.add(e);
- }
- }
- return connEdges;
- }
-
- /**
* Gets the number of pair connections between the given set of nodes.
* <p>
* This method effectively counts the number of edges between nodes in
the given set, ignoring self-loops
@@ -202,24 +139,39 @@
* <code>aIgnoreDir == true</code>) and <code>[0,
n(n-1)]</code> for directed networks (
* <code>aIgnoreDir == true</code>).
*/
- public static int getPairConnCount(CyNetwork aNetwork, int[]
aNodeIndices, boolean aIgnoreDir) {
- int[] connEdges =
aNetwork.getConnectingEdgeIndicesArray(aNodeIndices);
- int edgeCount = connEdges.length;
+ public static int getPairConnCount(CyNetwork aNetwork,
Collection<CyNode> aNodeIndices, boolean aIgnoreDir) {
- for (int i = 0; i < connEdges.length; ++i) {
- int edgeIndex = connEdges[i];
- int sourceNodeIndex =
aNetwork.getEdgeSourceIndex(edgeIndex);
- int targetNodeIndex =
aNetwork.getEdgeTargetIndex(edgeIndex);
- if (sourceNodeIndex == targetNodeIndex) {
- // Ignore self-loops
+ Set<CyEdge> connEdgeSet = new HashSet<CyEdge>();
+ for ( CyNode n1 : aNodeIndices )
+ for ( CyNode n2 : aNodeIndices )
+ connEdges.addAll(
aNetwork.getConnectingEdgeList(n1,n2,CyEdge.Type.ANY) );
+
+ int edgeCount = connEdges.size();
+
+ List<CyEdge> connEdges = new ArrayList<CyEdge>(connEdgeSet);
+
+ for (int i = 0; i < connEdges.size; ++i) {
+ CyEdge e = connEdges.get(i);
+
+ // Ignore self-loops
+ if ( e.getSource() == e.getTarget() ) {
edgeCount--;
} else {
- for (int j = i + 1; j < connEdges.length; j++) {
- if (edgeMatches(aNetwork, connEdges[j],
sourceNodeIndex, targetNodeIndex, aIgnoreDir)) {
- // Ignore multiple edges
+ // Ignore multiple edges
+ for (int j = i + 1; j < connEdges.size; ++j) {
+ CyEdge ee = connEdges.get(j);
+ if ( // directed edges have same source
+ target
+ ( e.getSource() == ee.getSource()
&&
+ e.getTarget() == ee.getTarget()
) ||
+ // or undirected edges have
same source + target (if we care)
+ ( aIgnoreDir &&
+ ( e.getSource() ==
ee.getTarget() &&
+ e.getTarget() ==
ee.getSource() ) ) ) {
+
edgeCount--;
+ // TODO I think this break is
wrong!
+ // What if there are more than
two edges?
break;
- }
}
}
}
@@ -243,8 +195,7 @@
* @see #getNeighbors(CyNetwork, Node, int[])
*/
public static Set<Node> getNeighbors(CyNetwork aNetwork, Node aNode) {
- return getNeighbors(aNetwork, aNode,
aNetwork.getAdjacentEdgeIndicesArray(aNode.getRootGraphIndex(),
- true, true, true));
+ return getNeighbors(aNetwork, aNode,
aNetwork.getAdjacentEdgeList(aNode));
}
/**
@@ -262,15 +213,14 @@
* @return <code>Set</code> of <code>Node</code> instances, containing
all the neighbors of
* <code>aNode</code>; empty set if the node specified is an
isolated vertex.
*/
- public static Set<Node> getNeighbors(CyNetwork aNetwork, Node aNode,
int[] aIncEdges) {
- Set<Node> neighborsSet = new HashSet<Node>();
- for (int i = 0; i < aIncEdges.length; ++i) {
- Edge e = aNetwork.getEdge(aIncEdges[i]);
- Node sourceNode = e.getSource();
+ public static Set<Node> getNeighbors(CyNetwork aNetwork, Node aNode,
List<CyEdge> aIncEdges) {
+ Set<CyNode> neighborsSet = new HashSet<CyNode>();
+ for ( CyEdge e : aIncEdges ) {
+ CyNode sourceNode = e.getSource();
if (sourceNode != aNode) {
neighborsSet.add(sourceNode);
} else {
- Node targetNode = e.getTarget();
+ CyNode targetNode = e.getTarget();
if (targetNode != aNode) {
neighborsSet.add(targetNode);
}
@@ -357,30 +307,6 @@
}
/**
- * Checks if two edges match.
- *
- * @param aNetwork
- * Network containing the edges.
- * @param aEdgeIndex
- * Index of the first edge.
- * @param aSourceIndex
- * Source node of the second edge.
- * @param aTargetIndex
- * Target node of the second edge.
- * @param aIgnoreDir
- * Flag indicating if the direction of the edges is to be
ignored.
- * @return <code>true</code> if the edges connect the same pair of
nodes (and have same direction, when
- * <code>aIgnoreDir</code> is <code>false</code>);
<code>false</code> otherwise.
- */
- private static boolean edgeMatches(CyNetwork aNetwork, int aEdgeIndex,
int aSourceIndex,
- int aTargetIndex, boolean aIgnoreDir) {
- int eSource = aNetwork.getEdgeSourceIndex(aEdgeIndex);
- int eTarget = aNetwork.getEdgeTargetIndex(aEdgeIndex);
- return (eSource == aSourceIndex && eTarget == aTargetIndex)
- || (aIgnoreDir && eSource == aTargetIndex &&
eTarget == aSourceIndex);
- }
-
- /**
* Performs an inspection on what kind of edges the given network
contains.
*
* @param aNetwork
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/DirNetworkAnalyzer.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/DirNetworkAnalyzer.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/DirNetworkAnalyzer.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -198,8 +198,7 @@
// Clustering coefficients calculation
// -----------------------------------
- int[] neighborInd =
CyNetworkUtils.getIndices(neighbors);
- final double nodeCCp =
computeCC(neighborInd);
+ final double nodeCCp =
computeCC(neighbors);
accumulate(CCps, neighborCount,
nodeCCp);
if (useNodeAttributes) {
setAttr(nodeID, "cco",
Utils.roundTo(nodeCCp, roundingDigits));
@@ -546,7 +545,7 @@
* @return Clustering coefficient of <code>aNode</code> as a value in
the range
* <code>[0,1]</code>.
*/
- private double computeCC(int[] aNeighborIndices) {
+ private double computeCC(Collection<CyNode> aNeighborIndices) {
int edgeCount = CyNetworkUtils.getPairConnCount(network,
aNeighborIndices, false);
int neighborsCount = aNeighborIndices.length;
return (double) edgeCount / (neighborsCount * (neighborsCount -
1));
@@ -589,7 +588,7 @@
final Set<Node> neighbors = getOutNeighbors(current);
for (Node neighbor : neighbors) {
final NodeBetweenInfo neighborNBInfo =
nodeBetweenness.get(neighbor);
- final List<Edge> edges =
CyNetworkUtils.getConnEdge(network, current, neighbor);
+ final List<Edge> edges =
network.getConnectingEdgeList(current,neighbor,CyEdge.Type.ANY);
final int expectSPLength =
currentNBInfo.getSPLength() + 1;
if (neighborNBInfo.getSPLength() < 0) {
@@ -634,7 +633,7 @@
final long oldStress =
stressDependency.get(predecessor).longValue();
stressDependency.put(predecessor, new
Long(oldStress + 1 + currentStress));
// accumulate edge betweenness
- final List<Edge> edges =
CyNetworkUtils.getConnEdge(network, predecessor, current);
+ final List<Edge> edges =
network.getConnectingEdgeList(predecessor,current, CyEdge.Type.ANY);
if (edges.size() != 0) {
final Edge compEdge =
edges.get(0);
final LinkedList<Edge>
currentedges = currentNBInfo.getOutEdges();
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/LoadNetstatsAction.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/LoadNetstatsAction.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/LoadNetstatsAction.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -26,7 +26,7 @@
import cytoscape.Cytoscape;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import cytoscape.util.CytoscapeAction;
+import org.cytoscape.application.swing.AbstractCyAction;
import cytoscape.view.CytoscapeDesktop;
import de.mpg.mpi_inf.bioinf.netanalyzer.data.Messages;
import de.mpg.mpi_inf.bioinf.netanalyzer.data.NetworkStats;
@@ -39,15 +39,16 @@
*
* @author Yassen Assenov
*/
-public class LoadNetstatsAction extends CytoscapeAction {
+public class LoadNetstatsAction extends AbstractCyAction {
private static final Logger logger =
LoggerFactory.getLogger(LoadNetstatsAction.class);
/**
* Initializes a new instance of <code>LoadNetstatsAction</code>.
*/
- public LoadNetstatsAction() {
- super(Messages.AC_LOAD);
+ public LoadNetstatsAction(CyApplicationManager
appMgr,CySwingApplication swingApp) {
+ super(Messages.AC_LOAD,appMgr,swingApp);
+ setPreferredMenu("Plugins." + Messages.AC_MENU_ANALYSIS);
}
/*
@@ -58,7 +59,7 @@
@Override
public void actionPerformed(ActionEvent e) {
try {
- final CytoscapeDesktop desktop = Cytoscape.getDesktop();
+ final Frame desktop = swingApp.getJFrame();
final JFileChooser dialog =
AnalysisDialog.netstatsDialog;
final int openIt = dialog.showOpenDialog(desktop);
if (openIt == JFileChooser.APPROVE_OPTION) {
@@ -85,7 +86,7 @@
* Network statistics file to be open.
*/
public static void openNetstats(File aFile) {
- final CytoscapeDesktop desktop = Cytoscape.getDesktop();
+ final Frame desktop = swingApp.getJFrame();
try {
final NetworkStats stats = StatsSerializer.load(aFile);
final AnalysisDialog d = new AnalysisDialog(desktop,
stats, null);
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/MapParameterAction.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/MapParameterAction.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/MapParameterAction.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -41,8 +41,9 @@
/**
* Initializes a new instance of <code>MapParameterAction</code>.
*/
- public MapParameterAction() {
- super(Messages.AC_MAPPARAM);
+ public MapParameterAction(CyApplicationManager
appMgr,CySwingApplication swingApp) {
+ super(Messages.AC_MAPPARAM,appMgr,swingApp);
+ setPreferredMenu("Plugins."+Messages.AC_MENU_ANALYSIS);
}
/*
@@ -68,7 +69,7 @@
openMapParameterDialog();
} else if (!settings.getUseNodeAttributes() &&
!settings.getUseEdgeAttributes()) {
// Network does not contain computed parameters
stored as attributes
- if
(JOptionPane.showConfirmDialog(Cytoscape.getDesktop(),
Messages.SM_LOADPARAMETERS,
+ if
(JOptionPane.showConfirmDialog(swingApp.getJFrame(), Messages.SM_LOADPARAMETERS,
Messages.DT_ANALYSISNEEDED,
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
settings.setUseNodeAttributes(true);
settings.setUseEdgeAttributes(true);
@@ -76,7 +77,7 @@
}
} else {
// Network does not contain computed parameters
stored as attributes
- if
(JOptionPane.showConfirmDialog(Cytoscape.getDesktop(),
Messages.SM_RUNNETWORKANALYZER,
+ if
(JOptionPane.showConfirmDialog(swingApp.getJFrame(),
Messages.SM_RUNNETWORKANALYZER,
Messages.DT_ANALYSISNEEDED,
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
runNetworkAnalyzer();
}
@@ -125,7 +126,7 @@
private void openMapParameterDialog() {
nodeAttr = CyNetworkUtils.getComputedNodeAttributes(network);
edgeAttr = CyNetworkUtils.getComputedEdgeAttributes(network);
- final MapParameterDialog d = new
MapParameterDialog(Cytoscape.getDesktop(), network, nodeAttr,
+ final MapParameterDialog d = new
MapParameterDialog(swingApp.getJFrame(), network, nodeAttr,
edgeAttr);
d.setVisible(true);
}
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/NetAnalyzerAction.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/NetAnalyzerAction.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/NetAnalyzerAction.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -20,9 +20,9 @@
import java.util.List;
import java.util.Set;
-import cytoscape.CyNetwork;
-import cytoscape.Cytoscape;
-import cytoscape.util.CytoscapeAction;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.session.CyApplicationManager;
+import org.cytoscape.application.swing.AbstractCyAction;
import de.mpg.mpi_inf.bioinf.netanalyzer.data.Messages;
import de.mpg.mpi_inf.bioinf.netanalyzer.ui.Utils;
@@ -31,16 +31,19 @@
*
* @author Yassen Assenov
*/
-public abstract class NetAnalyzerAction extends CytoscapeAction {
+public abstract class NetAnalyzerAction extends AbstractCyAction {
+ protected final CySwingApplication swingApp;
+
/**
* Constructs an action with the given name.
*
* @param aName
* Name of the action as it will appear in a menu.
*/
- protected NetAnalyzerAction(String aName) {
- super(aName);
+ protected NetAnalyzerAction(final String aName, final
CyApplicationManager appMgr, final CySwingApplication swingApp) {
+ super(aName,appMgr);
+ this.swingApp = swingApp;
network = null;
}
@@ -60,34 +63,9 @@
*/
@SuppressWarnings("fallthrough")
protected boolean selectNetwork() {
- network = null;
- String error = null;
- final Set<CyNetwork> networksSet = Cytoscape.getNetworkSet();
- switch (networksSet.size()) {
- case 0: // no network is loaded
- error = Messages.SM_LOADNET;
- break;
- case 1: // single network is available
- network = networksSet.iterator().next();
- break;
- default:
- final List<CyNetwork> networks =
Cytoscape.getSelectedNetworks();
- switch (networks.size()) {
- case 1:
- network = networks.get(0);
- if (network != null && network
!= Cytoscape.getNullNetwork()) {
- // single network is
selected
- break;
- }
- case 0: // no network is selected
- error = Messages.SM_SELECTNET;
- break;
- default: // multiple networks are
selected
- error =
Messages.SM_SELECTONENET;
- }
- }
- if (error != null) {
- Utils.showErrorBox(Messages.DT_WRONGDATA, error);
+ network = applicationManager.getCurrentNetwork();
+ if ( network == null ) {
+ Utils.showErrorBox(Messages.DT_WRONGDATA,
Messages.SM_LOADNET);
return false;
}
return true;
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/PlotParameterAction.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/PlotParameterAction.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/PlotParameterAction.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -41,8 +41,9 @@
/**
* Initializes a new instance of <code>PlotParameterAction</code>.
*/
- public PlotParameterAction() {
- super(Messages.AC_PLOTPARAM);
+ public PlotParameterAction(CyApplicationManager
appMgr,CySwingApplication swingApp) {
+ super(Messages.AC_PLOTPARAM,appMgr,swingApp);
+ setPreferredMenu("Plugins." + Messages.AC_MENU_ANALYSIS);
}
/*
@@ -67,7 +68,7 @@
openDialog();
} else if (!settings.getUseNodeAttributes() &&
!settings.getUseEdgeAttributes()) {
// Network does not contain computed parameters
stored as attributes
- if
(JOptionPane.showConfirmDialog(Cytoscape.getDesktop(),
Messages.SM_LOADPARAMETERS,
+ if
(JOptionPane.showConfirmDialog(swingApp.getJFrame(), Messages.SM_LOADPARAMETERS,
Messages.DT_ANALYSISNEEDED,
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
settings.setUseNodeAttributes(true);
settings.setUseEdgeAttributes(true);
@@ -75,7 +76,7 @@
}
} else {
// Network does not contain computed parameters
stored as attributes
- if
(JOptionPane.showConfirmDialog(Cytoscape.getDesktop(),
Messages.SM_RUNNETWORKANALYZER,
+ if
(JOptionPane.showConfirmDialog(swingApp.getJFrame(),
Messages.SM_RUNNETWORKANALYZER,
Messages.DT_ANALYSISNEEDED,
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
runNetworkAnalyzer();
}
@@ -110,7 +111,7 @@
*/
private void openDialog() {
nodeAttr = CyNetworkUtils.getComputedNodeAttributes(network);
- final PlotParameterDialog d = new
PlotParameterDialog(Cytoscape.getDesktop(), network, nodeAttr);
+ final PlotParameterDialog d = new
PlotParameterDialog(swingApp.getJFrame(), network, nodeAttr);
d.setVisible(true);
}
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/Plugin.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/Plugin.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/Plugin.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -24,12 +24,8 @@
import javax.swing.JMenu;
-import cytoscape.Cytoscape;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import cytoscape.plugin.CytoscapePlugin;
-import cytoscape.util.CytoscapeAction;
-import cytoscape.view.CyMenus;
import de.mpg.mpi_inf.bioinf.netanalyzer.data.Messages;
import de.mpg.mpi_inf.bioinf.netanalyzer.data.io.SettingsSerializer;
import de.mpg.mpi_inf.bioinf.netanalyzer.ui.Utils;
@@ -39,7 +35,7 @@
*
* @author Yassen Assenov
*/
-public class Plugin extends CytoscapePlugin {
+public class Plugin {
private static final Logger logger =
LoggerFactory.getLogger(Plugin.class);
@@ -184,58 +180,11 @@
* Initializes a new instance of <code>Plugin</code>.
*/
public Plugin() {
- // loadLibraries();
- CyMenus menus = Cytoscape.getDesktop().getCyMenus();
-
- new JMenu("Hello");
try {
// Initiate default visual settings
SettingsSerializer.initVisualSettings();
// If initialization fails, the following lines are not
executed:
- // Add "Analyze Network" action
- addAction(menus, Messages.AC_MENU_ANALYSIS, new
AnalyzeNetworkAction());
- // Add "Analyze subset" action
- addAction(menus, Messages.AC_MENU_ANALYSIS, new
AnalyzeSubsetAction());
- // Add "Batch Analysis" action
- addAction(menus, Messages.AC_MENU_ANALYSIS, new
BatchAnalysisAction());
- // Add "Load Network Statistics" action
- addAction(menus, Messages.AC_MENU_ANALYSIS, new
LoadNetstatsAction());
-
- // Add separators
- JMenu analysis = null;
- for (final Component cmp :
menus.getOperationsMenu().getMenuComponents()) {
- if (cmp instanceof JMenu &&
Messages.AC_MENU_ANALYSIS.equals(((JMenu) cmp).getText())) {
- analysis = (JMenu) cmp;
- break;
- }
- }
- if (analysis != null) {
- analysis.addSeparator();
- }
- // Add "Plot Parameters" action
- addAction(menus, Messages.AC_MENU_ANALYSIS, new
PlotParameterAction());
- // Add "Map To Visual Style" action
- addAction(menus, Messages.AC_MENU_ANALYSIS, new
MapParameterAction());
- if (analysis != null) {
- analysis.addSeparator();
- }
- // Add "NetworkAnalyzer Settings" action
- addAction(menus, Messages.AC_MENU_ANALYSIS, new
SettingsAction());
-
- // Add "Compare Two Networks" action
- addAction(menus, Messages.AC_MENU_MODIFICATION, new
CompareAction());
- // Add "Connected Components" action
- addAction(menus, Messages.AC_MENU_MODIFICATION, new
ConnComponentAction());
- // Add "Clear multiple edges" action
- addAction(menus, Messages.AC_MENU_MODIFICATION, new
RemDupEdgesAction());
- // Add "Remove Self-Loops" action
- addAction(menus, Messages.AC_MENU_MODIFICATION, new
RemoveSelfLoopsAction());
-
- // Add "About" action
- addAction(menus, Messages.AC_MENU_ANALYSIS, new
AboutAction());
- addAction(menus, Messages.AC_MENU_MODIFICATION, new
AboutAction());
-
} catch (SecurityException ex) {
Utils.showErrorBox(Messages.DT_SECERROR,
Messages.SM_SECERROR1);
System.err.println(Messages.SM_SECERROR1);
@@ -253,19 +202,4 @@
}
}
}
-
- /**
- * Adds a new action to the given submenu.
- *
- * @param aMenus
- * Cytoscape menus instance.
- * @param aSubMenu
- * Name of the submenu that will contain the action.
- * @param aAction
- * Action to be added.
- */
- private static void addAction(CyMenus aMenus, String aSubMenu,
CytoscapeAction aAction) {
- aAction.setPreferredMenu("Plugins." + aSubMenu);
- aMenus.addCytoscapeAction(aAction);
- }
}
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/RemDupEdgesAction.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/RemDupEdgesAction.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/RemDupEdgesAction.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -40,8 +40,9 @@
/**
* Initializes a new instance of <code>ReDupEdgesAction</code>.
*/
- public RemDupEdgesAction() {
- super(Messages.AC_REMDUPEDGES);
+ public RemDupEdgesAction(CyApplicationManager appMgr,CySwingApplication
swingApp) {
+ super(Messages.AC_REMDUPEDGES,appMgr,swingApp);
+ setPreferredMenu("Plugins." + Messages.AC_MENU_MODIFICATION);
}
/*
@@ -56,7 +57,7 @@
return;
}
- final Frame desktop = Cytoscape.getDesktop();
+ final Frame desktop = swingApp.getJFrame();
final ClearMultEdgesDialog d = new
ClearMultEdgesDialog(desktop);
d.setVisible(true);
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/RemoveSelfLoopsAction.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/RemoveSelfLoopsAction.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/RemoveSelfLoopsAction.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -42,8 +42,9 @@
/**
* Initializes a new instance of <code>RemoveSelfLoopsAction</code>.
*/
- public RemoveSelfLoopsAction() {
- super(Messages.AC_REMSELFLOOPS);
+ public RemoveSelfLoopsAction(CyApplicationManager
appMgr,CySwingApplication swingApp) {
+ super(Messages.AC_REMSELFLOOPS,appMgr,swingApp);
+ setPreferredMenu("Plugins." + Messages.AC_MENU_MODIFICATION);
}
/*
@@ -58,7 +59,7 @@
return;
}
- final Frame desktop = Cytoscape.getDesktop();
+ final Frame desktop = swingApp.getJFrame();
final String helpURL =
HelpConnector.getRemSelfloopsURL();
final NetModificationDialog d = new
NetModificationDialog(desktop, Messages.DT_REMSELFLOOPS,
Messages.DI_REMOVESL, helpURL);
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/SettingsAction.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/SettingsAction.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/SettingsAction.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -22,7 +22,7 @@
import cytoscape.Cytoscape;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import cytoscape.util.CytoscapeAction;
+import org.cytoscape.application.swing.AbstractCyAction;
import de.mpg.mpi_inf.bioinf.netanalyzer.data.Messages;
import de.mpg.mpi_inf.bioinf.netanalyzer.ui.PluginSettingsDialog;
@@ -31,15 +31,16 @@
*
* @author Yassen Assenov
*/
-public class SettingsAction extends CytoscapeAction {
+public class SettingsAction extends AbstractCyAction {
private static final Logger logger =
LoggerFactory.getLogger(SettingsAction.class);
/**
* Initializes a new instance of <code>SettingsAction</code>.
*/
- public SettingsAction() {
- super(Messages.AC_SETTINGS);
+ public SettingsAction(CyApplicationManager appMgr,CySwingApplication
swingApp) {
+ super(Messages.AC_SETTINGS,appMgr,swingApp);
+ setPreferredMenu("Plugins." + Messages.AC_MENU_ANALYSIS);
}
/*
@@ -51,7 +52,7 @@
public void actionPerformed(ActionEvent e) {
try {
// Display settings dialog
- PluginSettingsDialog d = new
PluginSettingsDialog(Cytoscape.getDesktop());
+ PluginSettingsDialog d = new
PluginSettingsDialog(swingApp.getJFrame());
d.setVisible(true);
} catch (InnerException ex) {
// NetworkAnalyzer internal error
Modified:
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/UndirNetworkAnalyzer.java
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/UndirNetworkAnalyzer.java
2010-12-09 01:06:54 UTC (rev 23141)
+++
core3/network-analyzer-impl/trunk/src/main/java/de/mpg/mpi_inf/bioinf/netanalyzer/UndirNetworkAnalyzer.java
2010-12-09 01:18:07 UTC (rev 23142)
@@ -162,7 +162,6 @@
final Set<Node> neighbors =
neighborMap.keySet();
// Neighborhood connectivity computation
- int[] neighborInd =
CyNetworkUtils.getIndices(neighbors);
final double neighborConnect =
averageNeighbors(neighbors);
accumulate(NCps, neighborCount,
neighborConnect);
@@ -177,7 +176,7 @@
}
// Clustering coefficients
computation
- final double nodeCCp =
computeCC(neighborInd);
+ final double nodeCCp =
computeCC(neighbors);
accumulate(CCps, neighborCount,
nodeCCp);
if (useNodeAttributes) {
setAttr(nodeID, "cco",
Utils.roundTo(nodeCCp, roundingDigits));
@@ -466,7 +465,7 @@
* @return Clustering coefficient of <code>aNode</code> as a value in
the range
* <code>[0,1]</code>.
*/
- private double computeCC(int[] aNeighborIndices) {
+ private double computeCC(Collection<CyNode> aNeighborIndices) {
int edgeCount = CyNetworkUtils.getPairConnCount(network,
aNeighborIndices, true);
int neighborsCount = aNeighborIndices.length;
return (double) 2 * edgeCount / (neighborsCount *
(neighborsCount - 1));
@@ -568,7 +567,7 @@
final Set<Node> neighbors = getNeighbors(current);
for (Node neighbor : neighbors) {
final NodeBetweenInfo neighborNBInfo =
nodeBetweenness.get(neighbor);
- final List<Edge> edges =
CyNetworkUtils.getConnEdge(network, current, neighbor);
+ final List<Edge> edges =
network.getConnectionEdgeList(current,neighbor,CyEdge.Type.ANY);
final int expectSPLength =
currentNBInfo.getSPLength() + 1;
if (neighborNBInfo.getSPLength() < 0) {
// Neighbor traversed for the first time
@@ -615,8 +614,7 @@
final long oldStress =
stressDependency.get(predecessor).longValue();
stressDependency.put(predecessor, new
Long(oldStress + 1 + currentStress));
// accumulate edge betweenness
- final List<Edge> edges =
CyNetworkUtils.getConnEdge(network, predecessor,
- current);
+ final List<Edge> edges =
network.getConnectingEdgeList(predecessor,current,CyEdge.Type.ANY);
if (edges.size() != 0) {
final Edge compEdge =
edges.get(0);
final LinkedList<Edge>
currentedges = currentNBInfo.getOutEdges();
Added:
core3/network-analyzer-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
(rev 0)
+++
core3/network-analyzer-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2010-12-09 01:18:07 UTC (rev 23142)
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:osgi="http://www.springframework.org/schema/osgi"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/osgi
http://www.springframework.org/schema/osgi/spring-osgi-1.0.xsd"
+ default-lazy-init="false">
+
+ <osgi:reference id="cySwingApplicationServiceRef"
+
interface="org.cytoscape.application.swing.CySwingApplication"/>
+
+ <osgi:reference id="cyApplicationManagerServiceRef"
+ interface="org.cytoscape.session.CyApplicationManager"/>
+
+ <osgi:reference id="cyNetworkManagerServiceRef"
+ interface="org.cytoscape.model.CyNetworkManager"/>
+
+ <osgi:service id="analyzeNetworkActionService"
ref="analyzeNetworkAction"
+
interface="de.mpg.mpi_inf.bioinf.netanalyzer.AnalyzeNetworkAction"/>
+ <osgi:service id="analyzeSubsetActionService" ref="analyzeSubsetAction"
+
interface="de.mpg.mpi_inf.bioinf.netanalyzer.AnalyzeSubsetAction"/>
+ <osgi:service id="batchAnalysisActionService" ref="batchAnalysisAction"
+
interface="de.mpg.mpi_inf.bioinf.netanalyzer.BatchAnalysisAction"/>
+ <osgi:service id="loadNetstatsActionService" ref="loadNetstatsAction"
+
interface="de.mpg.mpi_inf.bioinf.netanalyzer.LoadNetstatsAction"/>
+ <osgi:service id="plotParameterActionService" ref="plotParameterAction"
+
interface="de.mpg.mpi_inf.bioinf.netanalyzer.PlotParameterAction"/>
+ <osgi:service id="mapParameterActionService" ref="mapParameterAction"
+
interface="de.mpg.mpi_inf.bioinf.netanalyzer.MapParameterAction"/>
+ <osgi:service id="settingsActionService" ref="settingsAction"
+ interface="de.mpg.mpi_inf.bioinf.netanalyzer.SettingsAction"/>
+ <osgi:service id="compareActionService" ref="compareAction"
+ interface="de.mpg.mpi_inf.bioinf.netanalyzer.CompareAction"/>
+ <osgi:service id="connComponentActionService" ref="connComponentAction"
+
interface="de.mpg.mpi_inf.bioinf.netanalyzer.ConnComponentAction"/>
+ <osgi:service id="remDupEdgesActionService" ref="remDupEdgesAction"
+
interface="de.mpg.mpi_inf.bioinf.netanalyzer.RemDupEdgesAction"/>
+ <osgi:service id="removeSelfLoopsActionService"
ref="removeSelfLoopsAction"
+
interface="de.mpg.mpi_inf.bioinf.netanalyzer.RemoveSelfLoopsAction"/>
+ <osgi:service id="aboutActionService" ref="aboutAction"
+ interface="de.mpg.mpi_inf.bioinf.netanalyzer.AboutAction"/>
+
+</beans>
+
+
+
+
+</beans>
Added:
core3/network-analyzer-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
---
core3/network-analyzer-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
(rev 0)
+++
core3/network-analyzer-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2010-12-09 01:18:07 UTC (rev 23142)
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
+ http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://www.springframework.org/schema/context
+ http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
+ <context:annotation-config />
+
+ <bean id="plugin" class="de.mpg.mpi_inf.bioinf.netanalyzer.Plugin">
+ </bean>
+
+ <bean id="analyzeNetworkAction"
class="de.mpg.mpi_inf.bioinf.netanalyzer.AnalyzeNetworkAction">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ </bean>
+ <bean id="analyzeSubsetAction"
class="de.mpg.mpi_inf.bioinf.netanalyzer.AnalyzeSubsetAction">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ </bean>
+ <bean id="batchAnalysisAction"
class="de.mpg.mpi_inf.bioinf.netanalyzer.BatchAnalysisAction">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ </bean>
+ <bean id="loadNetstatsAction"
class="de.mpg.mpi_inf.bioinf.netanalyzer.LoadNetstatsAction">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ </bean>
+ <bean id="plotParameterAction"
class="de.mpg.mpi_inf.bioinf.netanalyzer.PlotParameterAction">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ </bean>
+ <bean id="mapParameterAction"
class="de.mpg.mpi_inf.bioinf.netanalyzer.MapParameterAction">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ </bean>
+ <bean id="settingsAction"
class="de.mpg.mpi_inf.bioinf.netanalyzer.SettingsAction">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ </bean>
+ <bean id="compareAction"
class="de.mpg.mpi_inf.bioinf.netanalyzer.CompareAction">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ </bean>
+ <bean id="connComponentAction"
class="de.mpg.mpi_inf.bioinf.netanalyzer.ConnComponentAction">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ </bean>
+ <bean id="remDupEdgesAction"
class="de.mpg.mpi_inf.bioinf.netanalyzer.RemDupEdgesAction">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ </bean>
+ <bean id="removeSelfLoopsAction"
class="de.mpg.mpi_inf.bioinf.netanalyzer.RemoveSelfLoopsAction">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ </bean>
+ <bean id="aboutAction"
class="de.mpg.mpi_inf.bioinf.netanalyzer.AboutAction">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ </bean>
+
+</beans>
--
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.