📄 moss.java
字号:
g.setConstraints(bdtype, rc); grid.add(bdtype); lbl = new JLabel("Ignore type of atoms:"); g.setConstraints(lbl, lc); grid.add(lbl); attype = new JComboBox(typenames); g.setConstraints(attype, rc); grid.add(attype); lbl = new JLabel("Match charge of atoms:"); g.setConstraints(lbl, lc); grid.add(lbl); charge = new JCheckBox("", false); g.setConstraints(charge, rc); grid.add(charge); lbl = new JLabel("Match aromaticity of atoms:"); g.setConstraints(lbl, lc); grid.add(lbl); atarom = new JCheckBox("", false); g.setConstraints(atarom, rc); grid.add(atarom); help = new JTextArea( "An atom is aromatic if it is part of an aromatic ring."); help.setFont(small); help.setBackground(this.getBackground()); g.setConstraints(help, rc); grid.add(help); help = new JTextArea((String)null); help.setFont(small); help.setBackground(this.getBackground()); help.setPreferredSize(new Dimension(0,3)); g.setConstraints(help, rc); grid.add(help); lbl = new JLabel("Atom types to exclude:"); g.setConstraints(lbl, rc); grid.add(lbl); excl = new JTextField(""); excl.setFont(font); g.setConstraints(excl, rc); grid.add(excl); lbl = new JLabel("Atom types to exclude as seeds:"); g.setConstraints(lbl, rc); grid.add(lbl); exseed = new JTextField(""); exseed.setFont(font); g.setConstraints(exseed, rc); grid.add(exseed); help = new JTextArea( "The former are generally excluded from the search, the latter\n" +"are not used as seeds, but may appear with other seeds.\n" +"Both have to be specified as a molecule, in seed format."); help.setFont(small); help.setBackground(this.getBackground()); g.setConstraints(help, rc); grid.add(help); help = new JTextArea((String)null); help.setFont(small); help.setBackground(this.getBackground()); help.setPreferredSize(new Dimension(0,0)); rc.weighty = 1.0; g.setConstraints(help, rc); grid.add(help); rc.weighty = 0.0; /* --- rings and chains --- */ grid = new JPanel(g); grid.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); tab.addTab("Rings and Chains", null, grid, null); lbl = new JLabel("Convert Kekule representations:"); g.setConstraints(lbl, lc); grid.add(lbl); kekule = new JCheckBox("", true); g.setConstraints(kekule, rc); grid.add(kekule); help = new JTextArea( "Aromatic rings may be coded as alternating single and double\n" +"bonds (so-called Kekule representation of an aromatic ring).\n" +"It is recommended to convert these " +"to actual aromatic bonds."); help.setFont(small); help.setBackground(this.getBackground()); g.setConstraints(help, rc); grid.add(help); lbl = new JLabel("Distinguish ring bonds:"); g.setConstraints(lbl, lc); grid.add(lbl); rings = new JCheckBox("", false); g.setConstraints(rings, rc); grid.add(rings); rings.addChangeListener(this); labels = new JLabel[3]; labels[0] = lbl = new JLabel("Minimal ring size:"); g.setConstraints(lbl, lc); grid.add(lbl); minring = new JSpinner(new SpinnerNumberModel(5, 0, 256, 1)); g.setConstraints(minring, rc); grid.add(minring); labels[1] = lbl = new JLabel("Maximal ring size:"); g.setConstraints(lbl, lc); grid.add(lbl); maxring = new JSpinner(new SpinnerNumberModel(6, 0, 256, 1)); g.setConstraints(maxring, rc); grid.add(maxring); labels[2] = lbl = new JLabel("Ring extensions:"); g.setConstraints(lbl, lc); grid.add(lbl); ringext = new JComboBox(ringnames); g.setConstraints(ringext, rc); grid.add(ringext); this.stateChanged(null); help = new JTextArea( "Ring extensions require that ring bonds are distinguished\n" +"and that a range of relevant ring sizes is specified.\n" +"It is recommended to use full ring extensions if any."); help.setFont(small); help.setBackground(this.getBackground()); g.setConstraints(help, rc); grid.add(help); help = new JTextArea((String)null); help.setFont(small); help.setBackground(this.getBackground()); help.setPreferredSize(new Dimension(0,10)); g.setConstraints(help, rc); grid.add(help); lbl = new JLabel("Variable length carbon chains:"); g.setConstraints(lbl, lc); grid.add(lbl); chains = new JCheckBox("", false); g.setConstraints(chains, rc); grid.add(chains); help = new JTextArea( "A carbon chain consists only of carbon atoms connected by\n" +"single bonds, which are bridges in the molecule."); help.setFont(small); help.setBackground(this.getBackground()); g.setConstraints(help, rc); grid.add(help); help = new JTextArea((String)null); help.setFont(small); help.setBackground(this.getBackground()); rc.weighty = 1.0; g.setConstraints(help, rc); grid.add(help); rc.weighty = 0.0; /* --- miscellaneous --- */ grid = new JPanel(g); grid.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); tab.addTab("Miscellaneous", null, grid, null); lbl = new JLabel("Extension type:"); g.setConstraints(lbl, lc); grid.add(lbl); exttype = new JComboBox(extnames); exttype.setFont(font); g.setConstraints(exttype, rc); grid.add(exttype); help = new JTextArea( "Maximum source extension defines the MoSS/MoFa algorithm,\n" +"rightmost path extension the gSpan/CloseGraph algorithm."); help.setFont(small); help.setBackground(this.getBackground()); g.setConstraints(help, rc); grid.add(help); lbl = new JLabel("Perfect extension pruning:"); g.setConstraints(lbl, lc); grid.add(lbl); perfect = new JComboBox(pepnames); perfect.setFont(font); g.setConstraints(perfect, rc); grid.add(perfect); lbl = new JLabel("Equivalent sibling pruning:"); g.setConstraints(lbl, lc); grid.add(lbl); equiv = new JCheckBox("", false); g.setConstraints(equiv, rc); grid.add(equiv); lbl = new JLabel("Canonical form pruning:"); g.setConstraints(lbl, lc); grid.add(lbl); canonic = new JCheckBox("", true); g.setConstraints(canonic, rc); grid.add(canonic); lbl = new JLabel("Maximal embeddings:"); g.setConstraints(lbl, lc); grid.add(lbl); maxemb = new JSpinner(new SpinnerNumberModel(0, 0, 999999, 1)); g.setConstraints(maxemb, rc); grid.add(maxemb); help = new JTextArea( "Restricting the maximal number of embeddings that are kept\n" +"per molecule can reduce the amount of memory needed."); help.setFont(small); help.setBackground(this.getBackground()); g.setConstraints(help, rc); grid.add(help); lbl = new JLabel("Normalize output:"); g.setConstraints(lbl, lc); grid.add(lbl); normal = new JCheckBox("", false); g.setConstraints(normal, rc); grid.add(normal); help = new JTextArea( "Normalize the description of the found substructures,\n" +"so that they can be compared by a simple string comparison."); help.setFont(small); help.setBackground(this.getBackground()); g.setConstraints(help, rc); grid.add(help); lbl = new JLabel("Verbose message output:"); g.setConstraints(lbl, lc); grid.add(lbl); verbose = new JCheckBox("", false); g.setConstraints(verbose, rc); grid.add(verbose); help = new JTextArea( "Print the nodes of the search tree during the search."); help.setFont(small); help.setBackground(this.getBackground()); g.setConstraints(help, rc); grid.add(help); help = new JTextArea((String)null); help.setFont(small); help.setBackground(this.getBackground()); help.setPreferredSize(new Dimension(0,0)); rc.weighty = 1.0; g.setConstraints(help, rc); grid.add(help); rc.weighty = 0.0; /* --- about --- */ grid = new JPanel(g); grid.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); tab.addTab("About", null, grid, null); help = new JTextArea( "MoSS - Molecular Substructure Miner"); help.setFont(font); help.setBackground(this.getBackground()); g.setConstraints(help, rc); grid.add(help); help = new JTextArea( "A simple graphical user interface for the MoSS program.\n\n" +"GUI version 1.3, Miner version 4.9 (2006.08.13)\n" +"written by Christian Borgelt\n" +"Intelligent Data Analysis and Graphical Models Research Unit\n" +"European Center for Soft Computing\n" +"c/ Gonzalo Gutierrez Quiros s/n, 33600 Mieres, Spain\n" +"e-mail: christian.borgelt@softcomputing.es\n\n" +"This program is free software;\n" +"you can redistribute it and/or modify it under\n" +"the terms of the GNU Lesser General Public License\n" +"as published by the Free Software Foundation.\n\n" +"This program is distributed in the hope that\n" +"it will be useful, but WITHOUT ANY WARRANTY;\n" +"without even the implied warranty of MERCHANTABILITY\n" +"or FITNESS FOR A PARTICULAR PURPOSE. See the\n" +"GNU Lesser General Public License for more details."); help.setFont(small); help.setBackground(this.getBackground()); g.setConstraints(help, rc); grid.add(help); /* --- buttons --- */ lc.weightx = rc.weightx = 0.5; bbar = new JPanel(new GridLayout(1, 2, 5, 5)); bbar.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); this.exec = btn = new JButton("Run"); g.setConstraints(btn, lc); bbar.add(btn); btn.addActionListener(new AbstractAction () { public void actionPerformed (ActionEvent e) { MoSS.this.execute(); } } ); btn = new JButton("Load"); g.setConstraints(btn, lc); bbar.add(btn); btn.addActionListener(new AbstractAction () { public void actionPerformed (ActionEvent e) { if (chooser == null) chooser = createChooser(); chooser.setDialogType(JFileChooser.OPEN_DIALOG); chooser.setDialogTitle("Load Configuration"); int r = chooser.showDialog(MoSS.this, null); if (r == JFileChooser.APPROVE_OPTION) MoSS.this.loadConfig(chooser.getSelectedFile()); } } ); btn = new JButton("Save"); g.setConstraints(btn, lc); bbar.add(btn); btn.addActionListener(new AbstractAction () { public void actionPerformed (ActionEvent e) { if (chooser == null) chooser = createChooser(); chooser.setDialogType(JFileChooser.SAVE_DIALOG); chooser.setDialogTitle("Save Configuration"); int r = chooser.showDialog(MoSS.this, null); if (r == JFileChooser.APPROVE_OPTION) MoSS.this.saveConfig(chooser.getSelectedFile()); } } ); if (this.isprog) { /* terminate the program */ btn = new JButton("Quit"); btn.addActionListener(new AbstractAction () { public void actionPerformed (ActionEvent e) { System.exit(0); } } );} else { /* only close the dialog box */ btn = new JButton("Close"); btn.addActionListener(new AbstractAction () { public void actionPerformed (ActionEvent e) { MoSS.this.setVisible(false); } } ); } /* configure the button bar */ g.setConstraints(btn, rc); bbar.add(btn); grid = new JPanel(new BorderLayout()); grid.add(bbar, BorderLayout.NORTH); stat = new JTextField("MoSS - Molecular Substructure Miner"); stat.setEditable(false); grid.add(stat, BorderLayout.SOUTH); this.getContentPane().add(tab, BorderLayout.NORTH); this.getContentPane().add(grid, BorderLayout.SOUTH); this.setTitle("MoSS - Molecular Substructure Miner"); this.setDefaultCloseOperation(this.isprog ? JFrame.EXIT_ON_CLOSE : JFrame.HIDE_ON_CLOSE); if (this.owner != null) this.setLocationRelativeTo(this.owner); this.setLocation(50, 50); this.pack(); } /* run() */ /* Following the recommendations in the Java tutorial, the user */ /* interface is created in the "run" method, which is invoked */ /* from the event queue, in order to avoid problems with threads. */ /*------------------------------------------------------------------*/ public MoSS (Component owner, boolean isProg) { this.owner = owner; this.isprog = isProg; try { EventQueue.invokeAndWait(this); } catch (Exception e) {} } public MoSS (Component owner) { this.owner = owner; this.isprog = false; try { EventQueue.invokeAndWait(this); } catch (Exception e) {} } public MoSS () { this.owner = null; this.isprog = true; try { EventQueue.invokeAndWait(this); } catch (Exception e) {} } /*------------------------------------------------------------------*/ public static void main (String args[]) { /* --- main function */ MoSS moss = new MoSS(); /* create a MoSS dialog */ if (args.length > 0) /* load configuration if necessary */ moss.loadConfig(new File(args[0])); moss.setVisible(true); /* make dialog visible */ } /* main() */} /* class MoSS */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -