Search in sources :

Example 1 with OrderedListSelector

use of uk.ac.babraham.SeqMonk.Dialogs.OrderedListSelector in project SeqMonk by s-andrews.

the class MAPlotDialog method actionPerformed.

/* (non-Javadoc)
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
public void actionPerformed(ActionEvent ae) {
    if (ae.getActionCommand().equals("close")) {
        setVisible(false);
        dispose();
    } else if (ae.getActionCommand().equals("sublists")) {
        // Select a set of sublists from the current probe list to highlight
        // in the plot
        OrderedListSelector selector = new OrderedListSelector(this, probeList, subLists);
        // It's modal so by the time we get here the selection has been made
        subLists = selector.getOrderedLists();
        // try to highlight anything.
        if (subLists != null && subLists.length == 0) {
            subLists = null;
        }
        selector.dispose();
        actionPerformed(new ActionEvent(this, 1, "plot"));
    } else if (ae.getActionCommand().equals("plot")) {
        DataStore xStore = (DataStore) xStores.getSelectedItem();
        DataStore yStore = (DataStore) yStores.getSelectedItem();
        getContentPane().remove(maPlotPanel);
        // Check if these stores are quantitated
        if (!xStore.isQuantitated()) {
            JOptionPane.showMessageDialog(this, xStore.name() + " is not quantiated", "Can't make plot", JOptionPane.INFORMATION_MESSAGE);
        } else if (!yStore.isQuantitated()) {
            JOptionPane.showMessageDialog(this, yStore.name() + " is not quantiated", "Can't make plot", JOptionPane.INFORMATION_MESSAGE);
        } else {
            maPlotPanel = new MAPlotPanel(xStore, yStore, probeList, subLists, commonScaleBox.isSelected(), dotSizeSlider.getValue());
            getContentPane().add(maPlotPanel, BorderLayout.CENTER);
        }
        validate();
    } else if (ae.getActionCommand().equals("save_probe_list")) {
        if (maPlotPanel instanceof MAPlotPanel) {
            ProbeList list = ((MAPlotPanel) maPlotPanel).getFilteredProbes(collection.probeSet());
            if (list.getAllProbes().length == 0) {
                JOptionPane.showMessageDialog(this, "No probes were selected", "No probes", JOptionPane.INFORMATION_MESSAGE);
                return;
            }
            // Ask for a name for the list
            String groupName = null;
            while (true) {
                groupName = (String) JOptionPane.showInputDialog(this, "Enter list name", "Found " + list.getAllProbes().length + " probes", JOptionPane.QUESTION_MESSAGE, null, null, list.name());
                if (groupName == null) {
                    // Remove the list which will have been created by this stage
                    list.delete();
                    // They cancelled
                    return;
                }
                if (groupName.length() == 0)
                    // Try again
                    continue;
                break;
            }
            list.setName(groupName);
        }
    } else if (ae.getActionCommand().equals("save_image")) {
        ImageSaver.saveImage(maPlotPanel);
    } else {
        throw new IllegalArgumentException("Unknown command " + ae.getActionCommand());
    }
}
Also used : ProbeList(uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList) ActionEvent(java.awt.event.ActionEvent) DataStore(uk.ac.babraham.SeqMonk.DataTypes.DataStore) OrderedListSelector(uk.ac.babraham.SeqMonk.Dialogs.OrderedListSelector)

Example 2 with OrderedListSelector

use of uk.ac.babraham.SeqMonk.Dialogs.OrderedListSelector in project SeqMonk by s-andrews.

the class ScatterPlotDialog method actionPerformed.

/* (non-Javadoc)
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
public void actionPerformed(ActionEvent ae) {
    if (ae.getActionCommand().equals("close")) {
        setVisible(false);
        dispose();
    } else if (ae.getActionCommand().equals("sublists")) {
        // Select a set of sublists from the current probe list to highlight
        // in the plot
        OrderedListSelector selector = new OrderedListSelector(this, probeList, subLists);
        // It's modal so by the time we get here the selection has been made
        subLists = selector.getOrderedLists();
        // try to highlight anything.
        if (subLists != null && subLists.length == 0) {
            subLists = null;
        }
        selector.dispose();
        actionPerformed(new ActionEvent(this, 1, "plot"));
    } else if (ae.getActionCommand().equals("plot")) {
        DataStore xStore = (DataStore) xStores.getSelectedItem();
        DataStore yStore = (DataStore) yStores.getSelectedItem();
        getContentPane().remove(scatterPlotPanel);
        // Check if these stores are quantitated
        if (!xStore.isQuantitated()) {
            JOptionPane.showMessageDialog(this, xStore.name() + " is not quantiated", "Can't make plot", JOptionPane.INFORMATION_MESSAGE);
        } else if (!yStore.isQuantitated()) {
            JOptionPane.showMessageDialog(this, yStore.name() + " is not quantiated", "Can't make plot", JOptionPane.INFORMATION_MESSAGE);
        } else {
            scatterPlotPanel = new ScatterPlotPanel(xStore, yStore, probeList, subLists, commonScaleBox.isSelected(), dotSizeSlider.getValue());
            getContentPane().add(scatterPlotPanel, BorderLayout.CENTER);
        }
        validate();
    } else if (ae.getActionCommand().equals("save_probe_list")) {
        if (scatterPlotPanel instanceof ScatterPlotPanel) {
            ProbeList list = ((ScatterPlotPanel) scatterPlotPanel).getFilteredProbes(collection.probeSet());
            if (list.getAllProbes().length == 0) {
                JOptionPane.showMessageDialog(this, "No probes were selected", "No probes", JOptionPane.INFORMATION_MESSAGE);
                return;
            }
            // Ask for a name for the list
            String groupName = null;
            while (true) {
                groupName = (String) JOptionPane.showInputDialog(this, "Enter list name", "Found " + list.getAllProbes().length + " probes", JOptionPane.QUESTION_MESSAGE, null, null, list.name());
                if (groupName == null) {
                    // Remove the list which will have been created by this stage
                    list.delete();
                    // They cancelled
                    return;
                }
                if (groupName.length() == 0)
                    // Try again
                    continue;
                break;
            }
            list.setName(groupName);
        }
    } else if (ae.getActionCommand().equals("save_image")) {
        ImageSaver.saveImage(scatterPlotPanel);
    } else {
        throw new IllegalArgumentException("Unknown command " + ae.getActionCommand());
    }
}
Also used : ProbeList(uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList) ActionEvent(java.awt.event.ActionEvent) DataStore(uk.ac.babraham.SeqMonk.DataTypes.DataStore) OrderedListSelector(uk.ac.babraham.SeqMonk.Dialogs.OrderedListSelector)

Example 3 with OrderedListSelector

use of uk.ac.babraham.SeqMonk.Dialogs.OrderedListSelector in project SeqMonk by s-andrews.

the class StrandBiasPlotDialog method actionPerformed.

/* (non-Javadoc)
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
public void actionPerformed(ActionEvent ae) {
    if (ae.getActionCommand().equals("close")) {
        setVisible(false);
        dispose();
    } else if (ae.getActionCommand().equals("sublists")) {
        // Select a set of sublists from the current probe list to highlight
        // in the plot
        OrderedListSelector selector = new OrderedListSelector(this, probeList, subLists);
        // It's modal so by the time we get here the selection has been made
        subLists = selector.getOrderedLists();
        // try to highlight anything.
        if (subLists != null && subLists.length == 0) {
            subLists = null;
        }
        selector.dispose();
        actionPerformed(new ActionEvent(this, 1, "plot"));
    } else if (ae.getActionCommand().equals("plot")) {
        DataStore xStore = (DataStore) stores.getSelectedItem();
        getContentPane().remove(strandBiasPlotPanel);
        strandBiasPlotPanel = new StrandBiasPlotPanel(xStore, probeList, subLists, dotSizeSlider.getValue());
        getContentPane().add(strandBiasPlotPanel, BorderLayout.CENTER);
        validate();
    } else if (ae.getActionCommand().equals("save_probe_list")) {
        if (strandBiasPlotPanel instanceof StrandBiasPlotPanel) {
            ProbeList list = ((StrandBiasPlotPanel) strandBiasPlotPanel).getFilteredProbes(collection.probeSet());
            if (list.getAllProbes().length == 0) {
                JOptionPane.showMessageDialog(this, "No probes were selected", "No probes", JOptionPane.INFORMATION_MESSAGE);
                return;
            }
            // Ask for a name for the list
            String groupName = null;
            while (true) {
                groupName = (String) JOptionPane.showInputDialog(this, "Enter list name", "Found " + list.getAllProbes().length + " probes", JOptionPane.QUESTION_MESSAGE, null, null, list.name());
                if (groupName == null) {
                    // Remove the list which will have been created by this stage
                    list.delete();
                    // They cancelled
                    return;
                }
                if (groupName.length() == 0)
                    // Try again
                    continue;
                break;
            }
            list.setName(groupName);
        }
    } else if (ae.getActionCommand().equals("save_image")) {
        ImageSaver.saveImage(strandBiasPlotPanel);
    } else {
        throw new IllegalArgumentException("Unknown command " + ae.getActionCommand());
    }
}
Also used : ProbeList(uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList) ActionEvent(java.awt.event.ActionEvent) DataStore(uk.ac.babraham.SeqMonk.DataTypes.DataStore) OrderedListSelector(uk.ac.babraham.SeqMonk.Dialogs.OrderedListSelector)

Example 4 with OrderedListSelector

use of uk.ac.babraham.SeqMonk.Dialogs.OrderedListSelector in project SeqMonk by s-andrews.

the class VariancePlotDialog method actionPerformed.

/* (non-Javadoc)
	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
	 */
public void actionPerformed(ActionEvent ae) {
    if (ae.getActionCommand().equals("close")) {
        setVisible(false);
        dispose();
    } else if (ae.getActionCommand().equals("sublists")) {
        // Select a set of sublists from the current probe list to highlight
        // in the plot
        OrderedListSelector selector = new OrderedListSelector(this, probeList, subLists);
        // It's modal so by the time we get here the selection has been made
        subLists = selector.getOrderedLists();
        // try to highlight anything.
        if (subLists != null && subLists.length == 0) {
            subLists = null;
        }
        selector.dispose();
        actionPerformed(new ActionEvent(this, 1, "plot"));
    } else if (ae.getActionCommand().equals("plot")) {
        ReplicateSet xStore = (ReplicateSet) stores.getSelectedItem();
        getContentPane().remove(variancePlotPanel);
        // Check if these stores are quantitated
        if (!xStore.isQuantitated()) {
            JOptionPane.showMessageDialog(this, xStore.name() + " is not quantiated", "Can't make plot", JOptionPane.INFORMATION_MESSAGE);
        } else {
            int varianceMeasure = VariancePlotPanel.VARIANCE_COEF;
            if (varianceMeasures.getSelectedItem().equals("StDev")) {
                varianceMeasure = VariancePlotPanel.VARIANCE_STDEV;
            } else if (varianceMeasures.getSelectedItem().equals("SEM")) {
                varianceMeasure = VariancePlotPanel.VARIANCE_SEM;
            } else if (varianceMeasures.getSelectedItem().equals("QuartDisp")) {
                varianceMeasure = VariancePlotPanel.VARIANCE_QUARTILE_DISP;
            } else if (varianceMeasures.getSelectedItem().equals("Unmeasured")) {
                varianceMeasure = VariancePlotPanel.VARIANCE_NUMBER_UNMEASURED;
            }
            variancePlotPanel = new VariancePlotPanel(xStore, varianceMeasure, probeList, subLists, dotSizeSlider.getValue());
            getContentPane().add(variancePlotPanel, BorderLayout.CENTER);
        }
        validate();
    } else if (ae.getActionCommand().equals("save_probe_list")) {
        if (variancePlotPanel instanceof VariancePlotPanel) {
            ProbeList list = ((VariancePlotPanel) variancePlotPanel).getFilteredProbes(collection.probeSet());
            if (list.getAllProbes().length == 0) {
                JOptionPane.showMessageDialog(this, "No probes were selected", "No probes", JOptionPane.INFORMATION_MESSAGE);
                return;
            }
            // Ask for a name for the list
            String groupName = null;
            while (true) {
                groupName = (String) JOptionPane.showInputDialog(this, "Enter list name", "Found " + list.getAllProbes().length + " probes", JOptionPane.QUESTION_MESSAGE, null, null, list.name());
                if (groupName == null) {
                    // Remove the list which will have been created by this stage
                    list.delete();
                    // They cancelled
                    return;
                }
                if (groupName.length() == 0)
                    // Try again
                    continue;
                break;
            }
            list.setName(groupName);
        }
    } else if (ae.getActionCommand().equals("save_image")) {
        ImageSaver.saveImage(variancePlotPanel);
    } else {
        throw new IllegalArgumentException("Unknown command " + ae.getActionCommand());
    }
}
Also used : ProbeList(uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList) ActionEvent(java.awt.event.ActionEvent) ReplicateSet(uk.ac.babraham.SeqMonk.DataTypes.ReplicateSet) OrderedListSelector(uk.ac.babraham.SeqMonk.Dialogs.OrderedListSelector)

Aggregations

ActionEvent (java.awt.event.ActionEvent)4 ProbeList (uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList)4 OrderedListSelector (uk.ac.babraham.SeqMonk.Dialogs.OrderedListSelector)4 DataStore (uk.ac.babraham.SeqMonk.DataTypes.DataStore)3 ReplicateSet (uk.ac.babraham.SeqMonk.DataTypes.ReplicateSet)1