Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
TriPOINT/src/edu/uconn/tripoint/ui/TriPOINT.java
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
158 lines (118 sloc)
4.25 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package edu.uconn.tripoint.ui; | |
import java.awt.BorderLayout; | |
import java.awt.Dimension; | |
import java.awt.Font; | |
import java.awt.event.ActionEvent; | |
import java.awt.event.ActionListener; | |
import java.io.File; | |
import javax.swing.BoxLayout; | |
import javax.swing.JButton; | |
import javax.swing.JComboBox; | |
import javax.swing.JFileChooser; | |
import javax.swing.JFrame; | |
import javax.swing.JLabel; | |
import javax.swing.JOptionPane; | |
import javax.swing.JSeparator; | |
import javax.swing.JTextField; | |
import javax.swing.JPanel; | |
import javax.swing.UIManager; | |
import javax.swing.UnsupportedLookAndFeelException; | |
import javax.swing.border.EmptyBorder; | |
public class TriPOINT { | |
private final JFileChooser _fc = new JFileChooser(); | |
private String _path = "./"; | |
private JFrame _frame; | |
private UIUtil _util = new UIUtil(); | |
private JTextField _dg; | |
private JTextField _out; | |
private JComboBox<String> _pdb; | |
private JTextField _rs; | |
private ScoreConfigPanel _scp; | |
private NonCodingPanel _ncp; | |
public static void main(String[] args) { | |
try { | |
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); | |
} | |
catch (UnsupportedLookAndFeelException e) { } | |
catch (ClassNotFoundException e) { } | |
catch (InstantiationException e) { } | |
catch (IllegalAccessException e) { } | |
new TriPOINT(); | |
} | |
public TriPOINT(){ | |
_path = System.getProperty("user.dir"); | |
if(!_path.endsWith("/")){ | |
_path += "/"; | |
} | |
_fc.setCurrentDirectory(new File(_path)); | |
_frame = new JFrame(); | |
_frame.add(getMainPanel()); | |
_frame.setSize(450,550); | |
_frame.setResizable(false); | |
_frame.setVisible(true); | |
_frame.setTitle("TriPOINT"); | |
_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | |
} | |
private JPanel getMainPanel(){ | |
JPanel rv = new JPanel(); | |
rv.setLayout(new BoxLayout(rv, BoxLayout.Y_AXIS)); | |
JLabel dgl = new JLabel("Gene Expression/Score File:"); | |
_dg = new JTextField(); | |
_util.setFieldPanel(rv, _fc, dgl, _dg, new JButton("..."), null, false); | |
JLabel outl = new JLabel("Output Directory:"); | |
_out = new JTextField(); | |
_util.setFieldPanel(rv, _fc, outl, _out, new JButton("..."), null, true); | |
JLabel pdbl = new JLabel("Pathway DB:"); | |
_pdb = new JComboBox<String>(); | |
_pdb.addItem("kegg"); | |
_pdb.addItem("reactome"); | |
_pdb.addItem("biocarta"); | |
_pdb.addItem("humancyc"); | |
_pdb.addItem("nci"); | |
_pdb.addItem("panther"); | |
rv.add(_util.getHorizontalField(pdbl, _pdb)); | |
JLabel rsl = new JLabel("Random State:"); | |
_rs = new JTextField("929"); | |
rv.add(_util.getHorizontalField(rsl, _rs)); | |
rv.add(new JSeparator(JSeparator.HORIZONTAL)); | |
JPanel ncropanel = new JPanel(); | |
ncropanel.setLayout(new BorderLayout()); | |
JLabel ncro = new JLabel("Non-Coding Regulator Options:"); | |
ncro.setFont(new Font("Arial", Font.BOLD, 14)); | |
ncropanel.add(ncro, BorderLayout.WEST); | |
rv.add(ncropanel); | |
_ncp = new NonCodingPanel(_fc); | |
rv.add(_ncp); | |
rv.add(new JSeparator(JSeparator.HORIZONTAL)); | |
JPanel scpanel = new JPanel(); | |
scpanel.setLayout(new BorderLayout()); | |
JLabel sc = new JLabel("Score Configurations:"); | |
sc.setFont(new Font("Arial", Font.BOLD, 14)); | |
scpanel.add(sc, BorderLayout.WEST); | |
rv.add(scpanel); | |
_scp = new ScoreConfigPanel(); | |
rv.add(_scp); | |
JPanel runpanel = new JPanel(); | |
runpanel.setLayout(new BorderLayout()); | |
JButton run = new JButton("Run TriPOINT"); | |
runpanel.add(run, BorderLayout.EAST); | |
rv.add(runpanel); | |
run.addActionListener(new ActionListener(){ | |
@Override | |
public void actionPerformed(ActionEvent e) { | |
InputValidator iv = new InputValidator(_dg.getText(), _out.getText(), _pdb.getSelectedItem().toString(), _rs.getText(), | |
_ncp.getInteractions(), _ncp.getNoncodingRegulators(), _ncp.getRefflat(), _ncp.getProximityDistance(), | |
_scp.getActiveThreshold(), _scp.getInActiveThreshold(), _scp.getWeakFactor(), _scp.getExponentialDecayRate(), _scp.getGeneScoreImpact()); | |
if(iv.hasError()){ | |
JOptionPane.showMessageDialog(_frame, iv.getErrorMessages().toString(),"Input Error",JOptionPane.ERROR_MESSAGE); | |
} | |
else{ | |
final CommandRunner ppcr = new CommandRunner(_frame, "Run TriPOINT"); | |
//JOptionPane.showMessageDialog(_frame, iv.getErrorMessages().toString(),"Run TriPOINT"); | |
} | |
} | |
}); | |
rv.setBorder(new EmptyBorder(10, 10, 10, 10)); | |
return rv; | |
} | |
} |