Search in sources :

Example 6 with NumberKeyListener

use of uk.ac.babraham.SeqMonk.Utilities.NumberKeyListener in project SeqMonk by s-andrews.

the class HiCCisTransQuantitation method getOptionsPanel.

/* (non-Javadoc)
	 * @see uk.ac.babraham.SeqMonk.Quantitation.Quantitation#getOptionsPanel(uk.ac.babraham.SeqMonk.SeqMonkApplication)
	 */
public JPanel getOptionsPanel() {
    if (optionPanel != null) {
        // We've done this already
        return optionPanel;
    }
    optionPanel = new JPanel();
    optionPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.weightx = 0.5;
    gbc.weighty = 0.5;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    optionPanel.add(new JLabel("Count duplicated reads only once"), gbc);
    gbc.gridx = 2;
    ignoreDuplicatesBox = new JCheckBox();
    ignoreDuplicatesBox.setSelected(false);
    optionPanel.add(ignoreDuplicatesBox, gbc);
    gbc.gridx = 1;
    gbc.gridy++;
    optionPanel.add(new JLabel("Include far-cis in trans count"), gbc);
    gbc.gridx = 2;
    includeFarCisBox = new JCheckBox();
    includeFarCisBox.setSelected(false);
    includeFarCisBox.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent ae) {
            farCisDistanceField.setEnabled(includeFarCisBox.isSelected());
        }
    });
    optionPanel.add(includeFarCisBox, gbc);
    gbc.gridx = 1;
    gbc.gridy++;
    optionPanel.add(new JLabel("Far cis distance cutoff"), gbc);
    gbc.gridx = 2;
    farCisDistanceField = new JTextField("" + farCisDistance, 7);
    farCisDistanceField.setEnabled(false);
    farCisDistanceField.addKeyListener(new NumberKeyListener(false, false));
    optionPanel.add(farCisDistanceField, gbc);
    gbc.gridx = 1;
    gbc.gridy++;
    optionPanel.add(new JLabel("Subtract median chromosome value"), gbc);
    gbc.gridx = 2;
    correctPerChromosomeBox = new JCheckBox();
    optionPanel.add(correctPerChromosomeBox, gbc);
    return optionPanel;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) NumberKeyListener(uk.ac.babraham.SeqMonk.Utilities.NumberKeyListener)

Example 7 with NumberKeyListener

use of uk.ac.babraham.SeqMonk.Utilities.NumberKeyListener in project SeqMonk by s-andrews.

the class HiCPrevNextQuantitation method getOptionsPanel.

/* (non-Javadoc)
	 * @see uk.ac.babraham.SeqMonk.Quantitation.Quantitation#getOptionsPanel(uk.ac.babraham.SeqMonk.SeqMonkApplication)
	 */
public JPanel getOptionsPanel() {
    if (optionPanel != null) {
        // We've done this already
        return optionPanel;
    }
    optionPanel = new JPanel();
    optionPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.weightx = 0.5;
    gbc.weighty = 0.5;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    optionPanel.add(new JLabel("Count duplicated reads only once"), gbc);
    gbc.gridx = 2;
    ignoreDuplicatesBox = new JCheckBox();
    ignoreDuplicatesBox.setSelected(false);
    optionPanel.add(ignoreDuplicatesBox, gbc);
    gbc.gridx = 1;
    gbc.gridy++;
    optionPanel.add(new JLabel("Distance to measure around probe"), gbc);
    gbc.gridx = 2;
    distanceField = new JTextField("" + distance, 7);
    distanceField.addKeyListener(new NumberKeyListener(false, false));
    optionPanel.add(distanceField, gbc);
    gbc.gridx = 1;
    gbc.gridy++;
    optionPanel.add(new JLabel("Min Absolute Count"), gbc);
    gbc.gridx = 2;
    minCountField = new JTextField("" + minCount, 7);
    minCountField.addKeyListener(new NumberKeyListener(false, false));
    optionPanel.add(minCountField, gbc);
    return optionPanel;
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) NumberKeyListener(uk.ac.babraham.SeqMonk.Utilities.NumberKeyListener)

Example 8 with NumberKeyListener

use of uk.ac.babraham.SeqMonk.Utilities.NumberKeyListener in project SeqMonk by s-andrews.

the class LogTransformQuantitation method getOptionsPanel.

/* (non-Javadoc)
	 * @see uk.ac.babraham.SeqMonk.Quantitation.Quantitation#getOptionsPanel(uk.ac.babraham.SeqMonk.SeqMonkApplication)
	 */
public JPanel getOptionsPanel() {
    if (optionPanel != null) {
        // We've done this already
        return optionPanel;
    }
    optionPanel = new JPanel();
    optionPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.weightx = 0.5;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    optionPanel.add(new JLabel("Log Base "), gbc);
    gbc.gridx = 2;
    logBaseField = new JTextField("" + logBase);
    logBaseField.addKeyListener(new NumberKeyListener(true, false));
    logBaseField.addKeyListener(new KeyListener() {

        public void keyTyped(KeyEvent arg0) {
        }

        public void keyReleased(KeyEvent arg0) {
            optionsChanged();
        }

        public void keyPressed(KeyEvent arg0) {
        }
    });
    optionPanel.add(logBaseField, gbc);
    gbc.gridx = 1;
    gbc.gridy++;
    optionPanel.add(new JLabel("Threshold "), gbc);
    thresholdField = new JTextField("" + threshold);
    thresholdField.addKeyListener(new NumberKeyListener(true, false));
    thresholdField.addKeyListener(new KeyListener() {

        public void keyTyped(KeyEvent arg0) {
        }

        public void keyReleased(KeyEvent arg0) {
            optionsChanged();
        }

        public void keyPressed(KeyEvent arg0) {
        }
    });
    gbc.gridx++;
    optionPanel.add(thresholdField, gbc);
    return optionPanel;
}
Also used : KeyEvent(java.awt.event.KeyEvent) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) KeyListener(java.awt.event.KeyListener) NumberKeyListener(uk.ac.babraham.SeqMonk.Utilities.NumberKeyListener) JTextField(javax.swing.JTextField) NumberKeyListener(uk.ac.babraham.SeqMonk.Utilities.NumberKeyListener)

Example 9 with NumberKeyListener

use of uk.ac.babraham.SeqMonk.Utilities.NumberKeyListener in project SeqMonk by s-andrews.

the class MergeConsecutiveProbeGenerator method getOptionsPanel.

/* (non-Javadoc)
	 * @see uk.ac.babraham.SeqMonk.ProbeGenerators.ProbeGenerator#getOptionsPanel(uk.ac.babraham.SeqMonk.SeqMonkApplication)
	 */
public JPanel getOptionsPanel() {
    if (optionPanel == null) {
        optionPanel = new JPanel();
        optionPanel.setLayout(new GridBagLayout());
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 1;
        gbc.gridy = 1;
        gbc.weightx = 0.5;
        gbc.weighty = 0.5;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        optionPanel.add(new JLabel("Number of probes to merge"), gbc);
        gbc.gridx = 2;
        numberToMergeField = new JTextField("5");
        numberToMergeField.addKeyListener(new NumberKeyListener(false, false));
        optionPanel.add(numberToMergeField, gbc);
        gbc.gridy++;
        gbc.gridx = 1;
        optionPanel.add(new JLabel("Step Size"), gbc);
        gbc.gridx = 2;
        stepSizeField = new JTextField("5");
        stepSizeField.addKeyListener(new NumberKeyListener(false, false));
        optionPanel.add(stepSizeField, gbc);
    }
    return optionPanel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) JTextField(javax.swing.JTextField) NumberKeyListener(uk.ac.babraham.SeqMonk.Utilities.NumberKeyListener)

Example 10 with NumberKeyListener

use of uk.ac.babraham.SeqMonk.Utilities.NumberKeyListener in project SeqMonk by s-andrews.

the class ManualCorrectionQuantitation method getOptionsPanel.

/* (non-Javadoc)
	 * @see uk.ac.babraham.SeqMonk.Quantitation.Quantitation#getOptionsPanel(uk.ac.babraham.SeqMonk.SeqMonkApplication)
	 */
public JPanel getOptionsPanel() {
    if (optionPanel != null) {
        // We've done this already
        return optionPanel;
    }
    optionPanel = new JPanel();
    optionPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.weightx = 0.5;
    gbc.weighty = 0.1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    optionPanel.add(new JLabel("Method of correction"), gbc);
    gbc.gridx = 2;
    correctionActions = new JComboBox(new String[] { "Add", "Subtract", "Multiply", "Divide" });
    optionPanel.add(correctionActions, gbc);
    Vector<DataStore> quantitatedStores = new Vector<DataStore>();
    DataSet[] sets = application.dataCollection().getAllDataSets();
    for (int s = 0; s < sets.length; s++) {
        if (sets[s].isQuantitated()) {
            quantitatedStores.add(sets[s]);
        }
    }
    DataGroup[] groups = application.dataCollection().getAllDataGroups();
    for (int g = 0; g < groups.length; g++) {
        if (groups[g].isQuantitated()) {
            quantitatedStores.add(groups[g]);
        }
    }
    data = quantitatedStores.toArray(new DataStore[0]);
    correctionFactors = new JTextField[data.length];
    // Now we work our way through the sets
    JPanel correctionPanel = new JPanel();
    correctionPanel.setLayout(new GridBagLayout());
    GridBagConstraints cbc = new GridBagConstraints();
    cbc.gridx = 1;
    cbc.gridy = 1;
    cbc.weightx = 0.5;
    cbc.weighty = 0.5;
    cbc.insets = new Insets(1, 3, 1, 3);
    cbc.fill = GridBagConstraints.HORIZONTAL;
    for (int d = 0; d < data.length; d++) {
        cbc.gridx = 1;
        cbc.gridy++;
        correctionPanel.add(new JLabel(data[d].name()), cbc);
        cbc.gridx = 2;
        correctionFactors[d] = new JTextField();
        if (storedCorrections.containsKey(data[d].name())) {
            correctionFactors[d].setText("" + storedCorrections.get(data[d].name()));
        }
        correctionFactors[d].addKeyListener(new NumberKeyListener(true, true));
        correctionPanel.add(correctionFactors[d], cbc);
    }
    gbc.gridx = 1;
    gbc.gridy++;
    gbc.gridwidth = 2;
    optionPanel.add(new JLabel("Correction factors", JLabel.CENTER), gbc);
    gbc.gridy++;
    gbc.weighty = 0.9;
    gbc.fill = GridBagConstraints.BOTH;
    optionPanel.add(new JScrollPane(correctionPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER), gbc);
    gbc.gridx = 1;
    gbc.gridy++;
    gbc.gridwidth = 2;
    gbc.weighty = 0.001;
    gbc.fill = GridBagConstraints.NONE;
    JButton loadFromFileButton = new JButton("Load from file");
    loadFromFileButton.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            JFileChooser chooser = new JFileChooser(SeqMonkPreferences.getInstance().getDataLocation());
            chooser.setMultiSelectionEnabled(false);
            chooser.setFileFilter(new TxtFileFilter());
            int result = chooser.showOpenDialog(optionPanel);
            if (result == JFileChooser.CANCEL_OPTION)
                return;
            File file = chooser.getSelectedFile();
            SeqMonkPreferences.getInstance().setLastUsedDataLocation(file);
            try {
                BufferedReader br = new BufferedReader(new FileReader(file));
                String line;
                while ((line = br.readLine()) != null) {
                    line.trim();
                    if (line.startsWith("#"))
                        continue;
                    String[] sections = line.split("\t");
                    if (sections.length < 2)
                        continue;
                    if (sections[1].length() == 0)
                        continue;
                    // See if we can find a dataset with the name of this section
                    for (int d = 0; d < data.length; d++) {
                        if (data[d].name().equals(sections[0])) {
                            // We try setting the value to whatever is stored for this
                            try {
                                Double.parseDouble(sections[1]);
                                correctionFactors[d].setText(sections[1]);
                            } catch (NumberFormatException nfe) {
                                JOptionPane.showMessageDialog(optionPanel, "Skipping " + sections[0] + " as " + sections[1] + " isn't a number", "Correction import error", JOptionPane.WARNING_MESSAGE);
                            }
                        }
                    }
                }
                br.close();
            } catch (IOException ioe) {
                JOptionPane.showMessageDialog(optionPanel, "Failed to read input file:" + ioe.getMessage(), "Correction import error", JOptionPane.ERROR_MESSAGE);
                return;
            }
        }
    });
    optionPanel.add(loadFromFileButton, gbc);
    return optionPanel;
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) DataSet(uk.ac.babraham.SeqMonk.DataTypes.DataSet) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) TxtFileFilter(uk.ac.babraham.SeqMonk.Utilities.FileFilters.TxtFileFilter) JTextField(javax.swing.JTextField) DataStore(uk.ac.babraham.SeqMonk.DataTypes.DataStore) FileReader(java.io.FileReader) Vector(java.util.Vector) JScrollPane(javax.swing.JScrollPane) DataGroup(uk.ac.babraham.SeqMonk.DataTypes.DataGroup) JComboBox(javax.swing.JComboBox) JLabel(javax.swing.JLabel) IOException(java.io.IOException) ActionListener(java.awt.event.ActionListener) JFileChooser(javax.swing.JFileChooser) BufferedReader(java.io.BufferedReader) NumberKeyListener(uk.ac.babraham.SeqMonk.Utilities.NumberKeyListener) File(java.io.File)

Aggregations

JLabel (javax.swing.JLabel)15 JPanel (javax.swing.JPanel)15 JTextField (javax.swing.JTextField)15 NumberKeyListener (uk.ac.babraham.SeqMonk.Utilities.NumberKeyListener)15 GridBagConstraints (java.awt.GridBagConstraints)14 GridBagLayout (java.awt.GridBagLayout)14 JComboBox (javax.swing.JComboBox)8 JCheckBox (javax.swing.JCheckBox)7 ActionEvent (java.awt.event.ActionEvent)4 ActionListener (java.awt.event.ActionListener)4 BorderLayout (java.awt.BorderLayout)3 KeyEvent (java.awt.event.KeyEvent)3 KeyListener (java.awt.event.KeyListener)3 JScrollPane (javax.swing.JScrollPane)3 DataStore (uk.ac.babraham.SeqMonk.DataTypes.DataStore)3 ProbeList (uk.ac.babraham.SeqMonk.DataTypes.Probes.ProbeList)3 JList (javax.swing.JList)2 TypeColourRenderer (uk.ac.babraham.SeqMonk.Dialogs.Renderers.TypeColourRenderer)2 Insets (java.awt.Insets)1 BufferedReader (java.io.BufferedReader)1