Source code: joelib/JOE.java
1 ///////////////////////////////////////////////////////////////////////////////
2 // Filename: $RCSfile: JOE.java,v $
3 // Purpose: File converting.
4 // Language: Java
5 // Compiler: JDK 1.4
6 // Authors: Joerg K. Wegner
7 // Version: $Revision: 1.10 $
8 // $Date: 2003/08/22 15:56:15 $
9 // $Author: wegner $
10 //
11 // Copyright (c) Dept. Computer Architecture, University of Tuebingen, Germany
12 //
13 // This program is free software; you can redistribute it and/or modify
14 // it under the terms of the GNU General Public License as published by
15 // the Free Software Foundation version 2 of the License.
16 //
17 // This program is distributed in the hope that it will be useful,
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 // GNU General Public License for more details.
21 ///////////////////////////////////////////////////////////////////////////////
22 package joelib;
23
24
25 /*==========================================================================*
26 * IMPORTS
27 *========================================================================== */
28 import joelib.test.Convert;
29
30
31 /*==========================================================================*
32 * CLASS DECLARATION
33 *==========================================================================*/
34
35 /**
36 * Class for converting molecules and calculating descriptors.
37 *
38 * <p>
39 * <blockquote><pre>
40 * Usage:
41 * java -cp . joelib.JOE [options] <input file> [<output file>]
42 *
43 * Options:
44 * [-i<inputFormat>] - Format of the input file
45 * [-o<outputFormat>] - Format of the output file
46 * [-h] - Remove hydrogens from molecule
47 * [+h] - Add hydrogens to molecule
48 * [+p] - Add only polar hydrogens (+h implicit)
49 * [-e] - Converts only non-empty molecules
50 * [-d] - Remove all descriptors from the molecule
51 * [+d] - Add all available descriptors to the molecule
52 * [+v] - Switch verbosity ON
53 * [+snd] - Show all available native value descriptors
54 * [+sad] - Show all available atom property descriptors
55 * [+sall] - Show all available descriptors
56 * [+x<descriptor name>] - Converts only molecules where <descriptor name> exists
57 * [-r<skip desc. rule>] - Skips molecules, if rule fits
58 * [+r<conv. desc. rule>] - Converts only molecules where rule fits
59 * [+f<lineStructure>] - Required if you use FLAT output format which other input format
60 * [+s<lineStructure>] - Can be used for an alternate SMILES entry line structure
61 * [-m<SMARTS rule>] - Skips molecules, if SMARTS rule fits
62 * [+m<SMARTS rule>] - Converts only molecules where SMARTS rule fits
63 * [-um<SMARTS rule>] - Skips molecules, if SMARTS rule fits
64 * [+um<SMARTS rule>] - Converts only molecules where SMARTS rule fits
65 * [-?][--help] - Shows this message
66 *
67 *If no output file is defined, all molecules will be written to stdout.
68 *
69 *Filter rules have the form:
70 *<native value descriptor><relation><value>
71 *where <relation> is <, <=, ==, >, >= or !=
72 *Example:
73 *"+rNumber_of_halogen_atoms==2"
74 *
75 *SMARTS filter rules have the form:
76 *<SMARTS pattern><relation><value>
77 *where <relation> is <, <=, ==, >, >= or !=
78 *Example:
79 *"+umaNC=O==1"
80 *Converts all molecules, where the molecule contains ONE NC=O group connected to an aromatic atom (aNC=O).
81 * </pre></blockquote>
82 *
83 * @author wegnerj
84 * @license GPL
85 * @cvsversion $Revision: 1.10 $, $Date: 2003/08/22 15:56:15 $
86 * @see joelib.test.Convert
87 * @see joelib.process.filter.NativeValueFilter
88 * @cite smarts
89 */
90 public class JOE
91 {
92 //~ Methods ////////////////////////////////////////////////////////////////
93
94 /*-------------------------------------------------------------------------*
95 * main
96 *-------------------------------------------------------------------------*/
97
98 /**
99 * The main program for the TestSmarts class
100 *
101 * @param args The command line arguments
102 */
103 public static void main(String[] args)
104 {
105 Convert convert = new Convert();
106
107 int status = convert.parseCommandLine(args);
108
109 if (status == Convert.CONTINUE)
110 {
111 convert.convert();
112 }
113 else if (status == Convert.STOP_USAGE)
114 {
115 convert.usage();
116 System.exit(1);
117 }
118 else if (status == Convert.STOP)
119 {
120 System.exit(0);
121 }
122 }
123 }
124 ///////////////////////////////////////////////////////////////////////////////
125 // END OF FILE.
126 ///////////////////////////////////////////////////////////////////////////////