Skip to content

Commit

Permalink
Added a dialog for approving loss of function @27
Browse files Browse the repository at this point in the history
Added a popup for making an annotatin without drag and drop @29
Fixed refresh of tree after expand/collapse of nodes @28
  • Loading branch information
selewis committed Sep 14, 2016
1 parent 5c94af8 commit 85bba9e
Show file tree
Hide file tree
Showing 13 changed files with 389 additions and 168 deletions.
6 changes: 3 additions & 3 deletions config/preferences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
GOlrURL: http://golr.geneontology.org/solr
bpPaintColor: !color '138, 190, 204, 255'
ccPaintColor: !color '138, 204, 177, 255'
collapse_no_exp: false
collapse_no_exp: true
curatedPaintColor: !color '255, 204, 0, 255'
expPaintColor: !color '61, 153, 61, 255'
full_msa: false
gafdir: /Users/suzi/projects/go/gene-associations/submission/paint/PTHR32175/
gafdir: /Users/suzi/projects/go/gene-associations/submission/paint/PTHR18896/
inferPaintColor: !color '61, 100, 153, 255'
mfPaintColor: !color '177, 204, 138, 255'
msa_colors:
Expand All @@ -23,7 +23,7 @@ msa_weighted_colors:
msa_weighted_threshold:
- 90.0
- 75.0
tree_distance_scaling: 50.0
tree_distance_scaling: 25.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.22
v2.23
144 changes: 144 additions & 0 deletions src/org/paint/dialog/TaxonDialog.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
/*
*
* Copyright (c) 2010, Regents of the University of California
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
* Neither the name of the Lawrence Berkeley National Lab nor the names of its contributors may be used to endorse
* or promote products derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/

package org.paint.dialog;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.List;
import java.util.Map;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.Border;

import org.bbop.phylo.util.OWLutil;
import org.paint.util.RenderUtil;

import owltools.gaf.species.TaxonFinder;

public class TaxonDialog extends JDialog {
/**
*
*/
private static final long serialVersionUID = 1L;

Map<JCheckBox, Integer> selections;
boolean loss;

/** Creates the GUI shown inside the frame's content pane. */
public TaxonDialog(Frame frame, String go_id, List<String> invalids) {
super(frame, true);
setLayout(new BorderLayout());
setContentPane(taxonPane(go_id, invalids));
pack();
setLocationRelativeTo(frame);
setVisible(true);
}

public boolean isLost() {
// this.paintComponents(this.getGraphics());
return loss;
}

private JPanel taxonPane (String go_id, List<String> invalids) {
JPanel qualify = new JPanel();
qualify.setLayout(new BoxLayout(qualify, BoxLayout.PAGE_AXIS));

//Create the components.
JPanel selectionPane = createTaxaListPane(go_id, invalids);

//Lay them out.

JPanel buttonPane = new JPanel();
buttonPane.setOpaque(true);
buttonPane.setBackground(RenderUtil.getAspectColor());
JButton lossButton = null;
lossButton = new JButton("Set as loss");
lossButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
loss = true;
TaxonDialog.this.dispose();
}
} );
JButton cancelButton = null;
cancelButton = new JButton("Cancel");
getRootPane().setDefaultButton(cancelButton);
cancelButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
loss = false;
TaxonDialog.this.dispose();
}
} );

buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
buttonPane.add(Box.createHorizontalGlue());
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPane.add(lossButton);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));
buttonPane.add(cancelButton);
buttonPane.add(Box.createRigidArea(new Dimension(10, 0)));

qualify.add(selectionPane);
qualify.add(buttonPane);
return qualify;
}

/** Creates the panel shown by the first tab. */
private JPanel createTaxaListPane(String go_id, List<String> invalids) {
String description;
description = "Do you intend the evolutionary loss of " + OWLutil.inst().getTermLabel(go_id) + " in these taxa?";

JPanel box = new JPanel();
JLabel label = new JLabel(description);
label.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
box.setOpaque(true);
box.setBackground(RenderUtil.getAspectColor());

box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
box.add(label);

for (String taxon : invalids) {
label = new JLabel(TaxonFinder.getSpecies(taxon));
label.setBackground(Color.white);
label.setOpaque(true);
box.add(label);
}
JPanel pane = new JPanel(new BorderLayout());
pane.add(box, BorderLayout.PAGE_START);
Border padding = BorderFactory.createEmptyBorder(20,20,5,20);
pane.setBorder(padding);
pane.setOpaque(true);
pane.setBackground(RenderUtil.getAspectColor());
return pane;
}

}
24 changes: 7 additions & 17 deletions src/org/paint/displaymodel/DisplayTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
import org.apache.log4j.Logger;
import org.bbop.phylo.annotate.AnnotationUtil;
import org.bbop.phylo.model.Tree;
import org.paint.gui.event.EventManager;
import org.paint.gui.event.NodeReorderEvent;
import org.paint.main.PaintManager;
import org.paint.util.DuplicationColor;

Expand Down Expand Up @@ -147,13 +145,13 @@ private void resetExpansion(Bioentity dsn){
*/
private void expandAllNodes(Bioentity dsn){
resetExpansion(dsn);
nodesReordered();
initCurrentNodes();
}

public void collapseNonExperimental() {
resetExpansion(root);
collapseMRC (root);
nodesReordered();
initCurrentNodes();
}

private void collapseMRC(Bioentity mrc) {
Expand Down Expand Up @@ -181,14 +179,6 @@ public Bioentity getCurrentRoot(){
return currentRoot;
}

// Method to set number of leaves in tree
public void nodesReordered() {
initCurrentNodes();
NodeReorderEvent event = new NodeReorderEvent(this);
event.setNodes(getTerminusNodes());
EventManager.inst().fireNodeReorderEvent(event);
}

private void setDupColorIndex(Bioentity node, int color_index) {
((DisplayBioentity) node).setDupColorIndex(color_index);
if (!node.isLeaf()) {
Expand Down Expand Up @@ -246,7 +236,7 @@ public void handleCollapseExpand(DisplayBioentity node) {
boolean change = (node != null && !node.isLeaf() && !node.isPruned());
if (change) {
setNodeExpanded(node);
nodesReordered();
initCurrentNodes();
}
}

Expand All @@ -264,7 +254,7 @@ public void handleCollapseExpand(List<DisplayBioentity> nodes) {
public boolean handlePruning(DisplayBioentity node) {
boolean change = (node != null && !node.isLeaf());
if (change) {
nodesReordered();
initCurrentNodes();
}
return change;
}
Expand All @@ -277,7 +267,7 @@ protected boolean resetToRoot(Bioentity dsn){
// If it is not the current root, make it the current root
if (currentRoot != dsn){
currentRoot = dsn;
nodesReordered();
initCurrentNodes();
return true;
} else
return false;
Expand All @@ -299,7 +289,7 @@ public void speciesOrder() {
bioentities.clear();
addChildNodesInOrder(currentRoot, bioentities);
// Save new ordering that are visible as well
nodesReordered();
initCurrentNodes();
}

public void descendentCountLadder(boolean most_leaves_at_top) {
Expand All @@ -315,7 +305,7 @@ public void descendentCountLadder(boolean most_leaves_at_top) {
bioentities.clear();
addChildNodesInOrder(currentRoot, bioentities);
// Save new ordering that are visible as well
nodesReordered();
initCurrentNodes();
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/org/paint/gui/association/AssociationsTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ else if (String.class == assoc_model.getColumnClass(column)) {
/*
* This ought to be a regain
*/
log.debug("Association table value = " + value.toString());
log.info("Association table value = " + value.toString());
}
} else if (GeneAnnotation.class == assoc_model.getColumnClass(column)) {
GeneAnnotation assoc = (GeneAnnotation) assoc_model.getValueAt(row, column);
Expand Down
2 changes: 1 addition & 1 deletion src/org/paint/gui/association/TrashCellRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
text = "";
break;
case DEPENDENCIES:
text = "Loss is contraindicated by exp. annotations";
text = "Loss would be contraindicated by exp. annotations";
break;
}
setText(text);
Expand Down
Loading

0 comments on commit 85bba9e

Please sign in to comment.