Skip to content

Commit

Permalink
Fixed bug #45 (which wasn't replacing obsolete terms for negated anno…
Browse files Browse the repository at this point in the history
…tations)

Added feature #46 so that the experimental evidence shows for descendent annotations
  • Loading branch information
selewis committed Dec 8, 2016
1 parent ac79096 commit dab2858
Show file tree
Hide file tree
Showing 23 changed files with 374 additions and 261 deletions.
2 changes: 1 addition & 1 deletion .classpath
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="org/paint/gui/PaintTable.java" kind="src" output="target/classes" path="src">
<classpathentry excluding="org/paint/gui/PaintTable.java|org/paint/dialog/CurationStatusColorPane.java|org/paint/dialog/CurationStatusColorDialog.java|org/paint/dialog/AspectColorPane.java" kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
Expand Down
10 changes: 2 additions & 8 deletions config/preferences.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
!!org.paint.config.PaintConfig
GOlrURL: http://golr.geneontology.org/solr
bpPaintColor: !color '138, 190, 204, 255'
ccPaintColor: !color '138, 204, 177, 255'
collapse_no_exp: true
curatedPaintColor: !color '255, 204, 0, 255'
expPaintColor: !color '61, 153, 61, 255'
full_msa: false
gafdir: /Users/suzi/test2/PTHR10003/
inferPaintColor: !color '61, 100, 153, 255'
mfPaintColor: !color '177, 204, 138, 255'
gafdir: /Users/suzi/projects/go/gene-associations/submission/paint/PTHR10003/
msa_colors:
- !color '51, 102, 77, 255'
- !color '112, 153, 92, 255'
Expand All @@ -23,7 +17,7 @@ msa_weighted_colors:
msa_weighted_threshold:
- 90.0
- 75.0
tree_distance_scaling: 25.0
tree_distance_scaling: 50.0
treedir: /Users/suzi/projects/go/data/trees/panther/
use_distances: true
weighted: true
2 changes: 1 addition & 1 deletion resources/org/paint/resources/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v2.28.1
v2.28.2
103 changes: 55 additions & 48 deletions src/org/paint/config/PaintConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import java.awt.Color;
import java.io.StringWriter;

import org.yaml.snakeyaml.Yaml;
import org.bbop.phylo.config.TouchupConfig;
import org.paint.util.GuiConstant;
import org.yaml.snakeyaml.Yaml;

public class PaintConfig extends TouchupConfig {

Expand All @@ -17,13 +16,14 @@ public class PaintConfig extends TouchupConfig {
public double tree_distance_scaling;
public boolean collapse_no_exp;

public Color expPaintColor;
public Color curatedPaintColor;
public Color inferPaintColor;
// public Color expPaintColor;
// public Color curatedPaintColor;
// public Color inferPaintColor;

public Color mfPaintColor;
public Color ccPaintColor;
public Color bpPaintColor;
// public Color mfPaintColor;
// public Color ccPaintColor;
// public Color bpPaintColor;
// public Color allPaintColor;

public float[] msa_threshold;
public float[] msa_weighted_threshold;
Expand Down Expand Up @@ -55,13 +55,14 @@ public PaintConfig() {
super();
use_distances = true;
tree_distance_scaling = 50;
expPaintColor = new Color(142, 35, 35);
curatedPaintColor = new Color(255, 127, 0);
inferPaintColor = new Color(16, 64, 128);
// expPaintColor = new Color(142, 35, 35);
// curatedPaintColor = new Color(255, 127, 0);
// inferPaintColor = new Color(16, 64, 128);

mfPaintColor = new Color(232, 248, 232);
ccPaintColor = new Color(224, 248, 255);
bpPaintColor = new Color(255, 248, 220);
// mfPaintColor = new Color(232, 248, 232);
// ccPaintColor = new Color(224, 248, 255);
// bpPaintColor = new Color(255, 248, 220);
// allPaintColor = new Color(255, 248, 220);

msa_threshold = new float[3];
msa_threshold[0] = 80f;
Expand Down Expand Up @@ -99,40 +100,46 @@ public static void main(String[] args) {
blah.save(PREF_FILE);
}

public Color getAspectColor(int aspect) {
Color color = GuiConstant.BACKGROUND_COLOR;
if (aspect > 0) {
switch (aspect) {
case GuiConstant.HIGHLIGHT_MF:
color = mfPaintColor;
break;
case GuiConstant.HIGHLIGHT_CC:
color = ccPaintColor;
break;
case GuiConstant.HIGHLIGHT_BP:
color = bpPaintColor;
break;
}
}
return color;
}

public void setAspectColor(int aspect, Color color) {
if (aspect > 0) {
switch (aspect) {
case GuiConstant.HIGHLIGHT_MF:
mfPaintColor = color;
break;
case GuiConstant.HIGHLIGHT_CC:
ccPaintColor = color;
break;
case GuiConstant.HIGHLIGHT_BP:
bpPaintColor = color;
break;
}
}
}

// public Color getAspectColor(int aspect) {
// Color color = GuiConstant.BACKGROUND_COLOR;
// if (aspect > 0) {
// switch (aspect) {
// case GuiConstant.HIGHLIGHT_MF:
// color = mfPaintColor;
// break;
// case GuiConstant.HIGHLIGHT_CC:
// color = ccPaintColor;
// break;
// case GuiConstant.HIGHLIGHT_BP:
// color = bpPaintColor;
// break;
// case GuiConstant.HIGHLIGHT_ALLGO:
// color = allPaintColor;
// break;
// }
// }
// return color;
// }
//
// public void setAspectColor(int aspect, Color color) {
// if (aspect > 0) {
// switch (aspect) {
// case GuiConstant.HIGHLIGHT_MF:
// mfPaintColor = color;
// break;
// case GuiConstant.HIGHLIGHT_CC:
// ccPaintColor = color;
// break;
// case GuiConstant.HIGHLIGHT_BP:
// bpPaintColor = color;
// break;
// case GuiConstant.HIGHLIGHT_ALLGO:
// allPaintColor = color;
// break;
// }
// }
// }
//
public float[] getMSAThresholds(boolean weighted) {
if (weighted)
return msa_weighted_threshold;
Expand Down
12 changes: 6 additions & 6 deletions src/org/paint/dialog/CurationStatusColorDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ private void initLayout() {
JPanel everything = new JPanel();
everything.setLayout(new BoxLayout(everything, BoxLayout.Y_AXIS));

final CurationStatusColorPane annot_color;
// final CurationStatusColorPane annot_color;
final AspectColorPane aspect_color;
final JTabbedPane tab_pane;

annot_color = new CurationStatusColorPane();
// annot_color = new CurationStatusColorPane();
aspect_color = new AspectColorPane();
tab_pane = new JTabbedPane();
tab_pane.addTab("Annotation Colors", annot_color);
// tab_pane.addTab("Annotation Colors", annot_color);
tab_pane.addTab("Aspect Colors", aspect_color);
tab_pane.setOpaque(true);

Expand All @@ -52,7 +52,7 @@ public void actionPerformed(ActionEvent e) {
JButton cancel = new JButton("Cancel");
cancel.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
annot_color.cancelColorChange();
// annot_color.cancelColorChange();
aspect_color.cancelColorChange();
CurationStatusColorDialog.this.dispose();
}
Expand All @@ -63,8 +63,8 @@ public void actionPerformed(ActionEvent e) {
public void actionPerformed(ActionEvent e) {
int selIndex = tab_pane.getSelectedIndex();
if (selIndex == 0)
annot_color.resetColorChange();
else
// annot_color.resetColorChange();
// else
aspect_color.resetColorChange();
}
});
Expand Down
34 changes: 20 additions & 14 deletions src/org/paint/displaymodel/DisplayBioentity.java
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public class DisplayBioentity extends Bioentity {
private Hashtable<String, String> attrLookup = new Hashtable<String, String>();

private Color dropColor;
private Color fillColor;

// Methods
public DisplayBioentity(boolean isExpanded) {
Expand Down Expand Up @@ -189,12 +190,9 @@ public void drawMarker(Bioentity currentRoot, Graphics g, boolean triangle, Rect

Rectangle r = new Rectangle(getScreenRectangle());
Point p = new Point(getScreenPosition());
Color fillColor = dropColor != null ? dropColor :
fillColor = dropColor != null ? dropColor :
RenderUtil.annotationStatusColor(this, GuiConstant.BACKGROUND_COLOR, true);
if (isSelected()) {
fillColor = fillColor.brighter();
}
Color drawColor = GuiConstant.FOREGROUND_COLOR;
Color lineColor = isSelected() ? GuiConstant.SELECTION_COLOR : GuiConstant.FOREGROUND_COLOR;

connectToParent(root, g);

Expand All @@ -212,7 +210,7 @@ public void drawMarker(Bioentity currentRoot, Graphics g, boolean triangle, Rect
};
g.setColor(fillColor);
g.fillPolygon(xCoords, yCoords, 4);
g.setColor(drawColor);
g.setColor(lineColor);
g.drawPolygon(xCoords, yCoords, 4);
}
else if (!isLeaf()) {
Expand All @@ -226,7 +224,7 @@ else if (!isLeaf()) {

g.setColor(fillColor);
g.fillPolygon(xCoords, yCoords, 3);
g.setColor(drawColor);
g.setColor(lineColor);
g.drawPolygon(xCoords, yCoords, 3);
} else if (isExpanded() && !isPruned()) {
if (isDuplication()) {
Expand All @@ -236,7 +234,7 @@ else if (!isLeaf()) {
*/
g.setColor(fillColor);
g.fillRect(p.x, p.y - GLYPH_RADIUS, GLYPH_DIAMETER, GLYPH_DIAMETER);
g.setColor(drawColor);
g.setColor(lineColor);
g.drawRect(p.x, p.y - GLYPH_RADIUS, GLYPH_DIAMETER, GLYPH_DIAMETER);
}
else if (isHorizontalTransfer()) {
Expand All @@ -251,7 +249,7 @@ else if (isHorizontalTransfer()) {
};
g.setColor(fillColor);
g.fillPolygon(xCoords, yCoords, 4);
g.setColor(drawColor);
g.setColor(lineColor);
g.drawPolygon(xCoords, yCoords, 4);
}
else {
Expand All @@ -262,7 +260,7 @@ else if (isHorizontalTransfer()) {
*/
g.setColor(fillColor);
g.fillOval(p.x, p.y - GLYPH_RADIUS, GLYPH_DIAMETER, GLYPH_DIAMETER);
g.setColor(drawColor);
g.setColor(lineColor);
g.drawOval(p.x, p.y - GLYPH_RADIUS, GLYPH_DIAMETER, GLYPH_DIAMETER);
}
}
Expand All @@ -274,7 +272,7 @@ else if (isPruned()) {
*/
g.setColor(Color.gray.brighter());
g.fillRect(p.x, p.y - GLYPH_RADIUS, GLYPH_DIAMETER, GLYPH_DIAMETER);
g.setColor(drawColor);
g.setColor(lineColor);
g.drawRect(p.x, p.y - GLYPH_RADIUS, GLYPH_DIAMETER, GLYPH_DIAMETER);
g.drawLine(p.x, p.y - GLYPH_RADIUS, p.x + GLYPH_DIAMETER, p.y + GLYPH_RADIUS);
g.drawLine(p.x, p.y + GLYPH_RADIUS, p.x + GLYPH_DIAMETER, p.y - GLYPH_RADIUS);
Expand All @@ -285,7 +283,7 @@ else if (isPruned()) {
*/
g.setColor(fillColor);
g.fillRect(p.x, p.y - GLYPH_RADIUS, GLYPH_RADIUS, GLYPH_DIAMETER);
g.setColor(drawColor);
g.setColor(lineColor);
g.drawRect(p.x, p.y - GLYPH_RADIUS, GLYPH_RADIUS, GLYPH_DIAMETER);
}
}
Expand All @@ -310,7 +308,11 @@ else if (isPruned()) {

AttributedString as = new AttributedString(s);
as.addAttribute(TextAttribute.FONT, f);
g.setColor(RenderUtil.annotationStatusColor(this, GuiConstant.FOREGROUND_COLOR, false));
if (isSelected()) {
as.addAttribute(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON);
}
Color text_color = RenderUtil.annotationFontColor(this);
g.setColor(text_color);
if (null != s) {
int text_x = p.x + NODE_TO_TEXT_OFFSET;
int text_y = p.y + (r.height / 2);
Expand All @@ -324,7 +326,7 @@ else if (isPruned()) {

x += TEXT_TO_LINE_OFFSET;

g.setColor(drawColor);
g.setColor(lineColor);
if (!(g instanceof Graphics2D)) {
g.drawLine(x, p.y, viewport.width, p.y);
}
Expand Down Expand Up @@ -586,4 +588,8 @@ public void setOriginalChildrenToCurrentChildren() {
originalChildrenOrder.clear();
originalChildrenOrder.addAll(children);
}

public Color getFillColor() {
return fillColor;
}
}
18 changes: 11 additions & 7 deletions src/org/paint/gui/AspectSelector.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public enum Aspect {
BIOLOGICAL_PROCESS,
CELLULAR_COMPONENT,
MOLECULAR_FUNCTION;
// ALL_TERMS;

public String toString() {
return super.toString().toLowerCase();
Expand All @@ -48,9 +49,10 @@ public String toString() {
aspects.put(Aspect.BIOLOGICAL_PROCESS.toString(), "P");
aspects.put(Aspect.CELLULAR_COMPONENT.toString(), "C");
aspects.put(Aspect.MOLECULAR_FUNCTION.toString(), "F");
// aspects.put(Aspect.ALL_TERMS.toString(), "A");
}



private AspectSelector() {
aspect = Aspect.MOLECULAR_FUNCTION;
Expand All @@ -71,7 +73,7 @@ public void setAspect(Aspect new_aspect) {
EventManager.inst().fireAspectChangeEvent(new AspectChangeEvent(this));
}
}

public void setAspect(String code) {
Set<String> names = aspects.keySet();
Aspect new_aspect = null;
Expand All @@ -84,26 +86,28 @@ public void setAspect(String code) {
new_aspect = Aspect.MOLECULAR_FUNCTION;
} else if (name.equals(Aspect.CELLULAR_COMPONENT.toString())) {
new_aspect = Aspect.CELLULAR_COMPONENT;
// } else if (name.equals(Aspect.ALL_TERMS.toString())) {
// new_aspect = Aspect.ALL_TERMS;
}
}
}
if (new_aspect != null) {
setAspect(new_aspect);
}
}

public Aspect getAspect() {
return aspect;
}

public String getAspectName() {
return aspect.toString();
}

public String getAspectCode() {
return getAspectCode(aspect.toString());
}

public String getAspectCode(String aspect_name) {
return aspects.get(aspect_name);
}
Expand Down
Loading

0 comments on commit dab2858

Please sign in to comment.