Skip to content

Commit 7b5e433

Browse files
committed
Fix the property pane.
1 parent 9ea7671 commit 7b5e433

2 files changed

Lines changed: 7 additions & 11 deletions

File tree

dnainator-core/src/main/java/nl/tudelft/dnainator/graph/impl/Neo4jSequenceNode.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,9 @@ public Neo4jSequenceNode(GraphDatabaseService service, Node node) {
5959
this.scores = new HashMap<>();
6060

6161
try (Transaction tx = service.beginTx()) {
62-
this.id = (String) node.getProperty(SequenceProperties.ID.name());
63-
basedist = (int) node.getProperty(SequenceProperties.BASE_DIST.name());
62+
this.id = (String) node.getProperty(SequenceProperties.ID.name());
63+
basedist = (int) node.getProperty(SequenceProperties.BASE_DIST.name());
64+
interestingness = (int) node.getProperty(SequenceProperties.INTERESTINGNESS.name(), 0);
6465

6566
node.getRelationships(RelTypes.NEXT, Direction.OUTGOING).forEach(e -> {
6667
outgoing.add((String) e.getEndNode().getProperty(SequenceProperties.ID.name()));
@@ -137,7 +138,6 @@ public Map<ScoreIdentifier, Integer> getScores() {
137138

138139
@Override
139140
public int getInterestingnessScore() {
140-
load();
141141
return interestingness;
142142
}
143143

@@ -159,7 +159,6 @@ private void load() {
159159
for (ScoreIdentifier id : Scores.values()) {
160160
scores.put(id, (Integer) node.getProperty(id.name(), 0));
161161
}
162-
interestingness = (int) node.getProperty(SequenceProperties.INTERESTINGNESS.name(), 0);
163162
tx.success();
164163
}
165164

dnainator-javafx/src/main/java/nl/tudelft/dnainator/javafx/drawables/strains/ClusterDrawable.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
import javafx.collections.MapChangeListener;
1919
import javafx.scene.Group;
2020
import javafx.scene.shape.Circle;
21-
import javafx.scene.text.Text;
2221

2322
/**
2423
* This enum represents all properties a Cluster can have.
@@ -32,7 +31,7 @@ enum ClusterPropertyTypes implements PropertyType {
3231
SOURCES("Sources"),
3332
STARTRANK("Start rank"),
3433
BASEDIST("Start base"),
35-
SCORE("Total interestingness score");
34+
SCORE("Maximum interestingness score");
3635

3736
private String description;
3837
private ClusterPropertyTypes(String description) {
@@ -60,7 +59,6 @@ public class ClusterDrawable extends Group implements Drawable, Propertyable {
6059
private static final int INTERESTINGNESS_THRESHOLD = 600;
6160
private Cluster cluster;
6261
private Set<String> sources;
63-
private Text label;
6462
private Pie pie;
6563
private Map<PropertyType, String> properties;
6664
private int interestingness;
@@ -79,7 +77,6 @@ public ClusterDrawable(ColorServer colorServer, Cluster cluster) {
7977
this.interestingness = cluster.getNodes().stream()
8078
.mapToInt(e -> e.getInterestingnessScore())
8179
.max().getAsInt();
82-
label = new Text(Integer.toString(cluster.getNodes().size()));
8380
setOnMouseClicked(e -> AbstractView.setLastClicked(this));
8481
draw(colorServer);
8582
}
@@ -88,7 +85,7 @@ public ClusterDrawable(ColorServer colorServer, Cluster cluster) {
8885
* Add all properties of a cluster to the property pane.
8986
*/
9087
private void initProperties() {
91-
properties.put(ClusterPropertyTypes.TITLE, null);
88+
properties.put(ClusterPropertyTypes.TITLE, cluster.getNodes().size() + " nodes");
9289
properties.put(ClusterPropertyTypes.ID, cluster.getNodes().stream()
9390
.map(e -> e.getId())
9491
.collect(Collectors.toList()).toString());
@@ -107,12 +104,13 @@ private void initProperties() {
107104
*/
108105
private void initSingletonProperties() {
109106
EnrichedSequenceNode sn = cluster.getNodes().iterator().next();
107+
String score = properties.remove(ClusterPropertyTypes.SCORE);
110108
properties.put(ClusterPropertyTypes.BASEDIST, Integer.toString(sn.getBaseDistance()));
111109
properties.put(ClusterPropertyTypes.STARTREF, Integer.toString(sn.getStartRef()));
112110
properties.put(ClusterPropertyTypes.ENDREF, Integer.toString(sn.getEndRef()));
113111
properties.put(ClusterPropertyTypes.SEQUENCE, sn.getSequence());
112+
properties.put(ClusterPropertyTypes.SCORE, score);
114113

115-
properties.put(ClusterPropertyTypes.SCORE, Integer.toString(sn.getInterestingnessScore()));
116114
sn.getScores().forEach((k, v) -> properties.put(k, Integer.toString(v)));
117115
}
118116

@@ -137,7 +135,6 @@ private void draw(ColorServer colorServer) {
137135
if (interestingness > INTERESTINGNESS_THRESHOLD) {
138136
commonNode.getStyleClass().add("interesting-node");
139137
}
140-
getChildren().add(label);
141138
}
142139

143140
/**

0 commit comments

Comments
 (0)