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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations