Author: scooter
Date: 2010-09-16 16:37:59 -0700 (Thu, 16 Sep 2010)
New Revision: 21908
Modified:
cytoscape/trunk/coreplugins/QuickFind/src/main/java/csplugins/quickfind/util/QuickFindImpl.java
Log:
We can't import cytoscape.data.CyAttributesUtils because it clashes with our own
CyAttributesUtils. Also, we need to be careful when we call isNullAttribute
since
this will always return true when our controllingAttribute is "Unique
Identifier"
Modified:
cytoscape/trunk/coreplugins/QuickFind/src/main/java/csplugins/quickfind/util/QuickFindImpl.java
===================================================================
---
cytoscape/trunk/coreplugins/QuickFind/src/main/java/csplugins/quickfind/util/QuickFindImpl.java
2010-09-16 22:59:32 UTC (rev 21907)
+++
cytoscape/trunk/coreplugins/QuickFind/src/main/java/csplugins/quickfind/util/QuickFindImpl.java
2010-09-16 23:37:59 UTC (rev 21908)
@@ -54,7 +54,7 @@
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
-import cytoscape.data.CyAttributesUtils;
+// import cytoscape.data.CyAttributesUtils;
/**
@@ -90,12 +90,15 @@
* @param taskMonitor DOCUMENT ME!
*/
public synchronized void addNetwork(CyNetwork network, TaskMonitor
taskMonitor) {
-
// check args - short circuit if necessary
if (network.getNodeCount() == 0) {
return;
}
+ // We need to update our node and edge attributes if the
network changes
+ nodeAttributes = Cytoscape.getNodeAttributes();
+ edgeAttributes = Cytoscape.getEdgeAttributes();
+
// Use default index specified by network, if available.
// Otherwise, index by UNIQUE_IDENTIFIER.
String controllingAttribute = null;
@@ -107,22 +110,31 @@
}
if (controllingAttribute == null) {
- // Small hack to index BioPAX Networks by default with node_label.
-
- Iterator nodesIterator = network.nodesIterator();
- if (nodesIterator.hasNext())
- {
- CyNode node = (CyNode) nodesIterator.next();
- String bioPaxFlag =
Cytoscape.getNodeAttributes().getStringAttribute
- (node.getIdentifier(), "biopax.node_label");
- if (bioPaxFlag != null) {
- controllingAttribute = "biopax.node_label";
- } else {
- controllingAttribute = QuickFind.UNIQUE_IDENTIFIER;
- }
- }
- }
+ // Small hack to index BioPAX Networks by default with
node_label.
+ Iterator nodesIterator = network.nodesIterator();
+ if (nodesIterator.hasNext())
+ {
+ CyNode node = (CyNode) nodesIterator.next();
+ String bioPaxFlag =
nodeAttributes.getStringAttribute
+
(node.getIdentifier(), "biopax.node_label");
+ if (bioPaxFlag != null) {
+ controllingAttribute =
"biopax.node_label";
+ } else {
+ controllingAttribute =
QuickFind.UNIQUE_IDENTIFIER;
+ }
+ }
+ }
+
+ if
(controllingAttribute.equalsIgnoreCase(QuickFind.UNIQUE_IDENTIFIER)||
+
controllingAttribute.equalsIgnoreCase(QuickFind.INDEX_ALL_ATTRIBUTES)||
+ controllingAttribute.equalsIgnoreCase("biopax.node_label")){
+ // do nothing
+ }
+ else if
(cytoscape.data.CyAttributesUtils.isNullAttribute("node",
controllingAttribute)){
+ return;
+ }
+
// Determine maxProgress
currentProgress = 0;
maxProgress = getGraphObjectCount(network,
QuickFind.INDEX_NODES);
@@ -203,7 +215,7 @@
if (indexType == QuickFind.INDEX_EDGES){
_type = "edge";
}
-
+
if
(controllingAttribute.equalsIgnoreCase(QuickFind.UNIQUE_IDENTIFIER)||
controllingAttribute.equalsIgnoreCase(QuickFind.INDEX_ALL_ATTRIBUTES)||
controllingAttribute.equalsIgnoreCase("biopax.node_label")){
@@ -355,16 +367,6 @@
int attributeType, String
controllingAttribute, GenericIndex index,
TaskMonitor taskMonitor) {
- // If all the values for the controllingAttribute are NULL, add
a null index
- String _type = "node";
- if (indexType == QuickFind.INDEX_EDGES){
- _type = "edge";
- }
- if (cytoscape.data.CyAttributesUtils.isNullAttribute(_type,
controllingAttribute)){
- networkMap.put(network, null);
- return;
- }
-
//
Date start = new Date();
Iterator iterator;
@@ -417,11 +419,6 @@
if (indexType == QuickFind.INDEX_EDGES){
_type = "edge";
}
- if
(!controllingAttribute.equalsIgnoreCase(QuickFind.INDEX_ALL_ATTRIBUTES) &&
- cytoscape.data.CyAttributesUtils.isNullAttribute(_type,
controllingAttribute)){
- return null;
- }
-
//
if ((attributeType == CyAttributes.TYPE_INTEGER)
|| (attributeType == CyAttributes.TYPE_FLOATING)) {
--
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.