$darkmode
DENOPTIM
DENOPTIMConstants.java
Go to the documentation of this file.
1/*
2 * DENOPTIM
3 * Copyright (C) 2019 Vishwesh Venkatraman <vishwesh.venkatraman@ntnu.no> and
4 * Marco Foscato <marco.foscato@uib.no>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as published
8 * by the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
15 *
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20package denoptim.constants;
21
22import java.io.File;
23import java.util.ArrayList;
24import java.util.Arrays;
25import java.util.Collections;
26import java.util.HashMap;
27import java.util.HashSet;
28import java.util.Map;
29import java.util.Set;
30
31import org.openscience.cdk.interfaces.IAtom;
32import org.openscience.cdk.interfaces.IAtomContainer;
33
34import denoptim.exception.DENOPTIMException;
35import denoptim.files.FileFormat;
36import denoptim.files.FileUtils;
37import denoptim.graph.APClass;
38import denoptim.graph.AttachmentPoint;
39import denoptim.graph.Edge.BondType;
40import denoptim.graph.Vertex;
41import denoptim.graph.rings.RingClosingAttractor;
42
43
48public final class DENOPTIMConstants
49{
53 public static final String EOL = System.getProperty("line.separator");
54
58 public static final String FSEP = System.getProperty("file.separator");
59
63 public static final File GLOBALCONFIG = ensureConfigFolderExists();
64 private static File ensureConfigFolderExists()
65 {
66 File configFolder = new File(
67 System.getProperty("user.home") + FSEP + ".denoptim");
68 try
69 {
70 if (!configFolder.exists())
71 {
72 boolean wasMade = FileUtils.createDirectory(
73 configFolder.getAbsolutePath());
74 if (!wasMade)
75 {
76 throw new DENOPTIMException("ERROR: could not make "
77 + "configuration folder '"
78 + configFolder.getAbsolutePath() + "'");
79 }
80 }
81 } catch (Throwable t)
82 {
83 t.printStackTrace();
84 String msg = "ERROR: unable to make configuration folder '"
85 + configFolder.getAbsolutePath() + "'";
86 System.err.println(msg);
87 throw new Error(msg);
88 }
89 return configFolder;
90 }
91
95 public static final File RECENTFILESLIST = new File(
96 GLOBALCONFIG.getAbsoluteFile() + FSEP + "recent_files_list");
97
98 public static final Map<String, Integer> VALENCE_MAP = createMap();
99 private static Map<String, Integer> createMap()
100 {
101 Map<String, Integer> result = new HashMap<>();
102 result.put("C", 4);
103 result.put("N", 3);
104 result.put("S", 6);
105 result.put("As", 5);
106 result.put("Cd", 2);
107 result.put("Hg", 2);
108 result.put("Zn", 2);
109 result.put("B", 3);
110 result.put("Si", 4);
111 result.put("Ge", 4);
112 result.put("Se", 6);
113 result.put("Te", 6);
114 result.put("Sb", 5);
115 result.put("Sn", 4);
116 result.put("Cl", 1);
117 result.put("Br", 1);
118 result.put("F", 1);
119 result.put("I", 1);
120 result.put("P", 5);
121 result.put("O", 2);
122 return Collections.unmodifiableMap(result);
123 };
124
125 public static final Set<String> ORGANIC_SUBSET_ELEMENTS =
126 new HashSet<>(Arrays.asList(new String[] {"C",
127 "N", "S", "O", "P", "F", "Br", "Cl", "I", "B"}
128 ));
129
130 public static final Set<String> ALL_ELEMENTS =
131 new HashSet<>(Arrays.asList(new String[] {"H", "He",
132 "Li", "Be", "B", "C", "N", "O", "F", "Ne",
133 "Na", "Mg", "Al", "SiP", "S", "Cl", "Ar",
134 "K", "Ca", "Ga", "Ge", "As", "Se", "Br", "Kr",
135 "Rb", "Sr", "In", "Sn", "Sb", "Te", "I", "Xe",
136 "Cs", "Ba", "Tl", "Pb", "Bi", "Po", "At", "Rn",
137 "Fr", "Ra",
138 "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni",
139 "Cu", "Zn",
140 "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd",
141 "Ag", "Cd",
142 "La", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt",
143 "Au", "Hg",
144 "Ac", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd",
145 "Tb", "Dy",
146 "Ho", "Er", "Tm", "Yb", "Lu", "Th", "Pa", "U",
147 "Np", "Pu",
148 "Am", "Cm", "Bk", "Cf", "Es", "Fm", "Md", "No",
149 "Lr"}));
150
156 public static ArrayList<String> ALL_METALS = new ArrayList<String>(
157 Arrays.asList("Li", "Na", "K", "Rb", "Cs", "Fr",
158 "Be", "Mg", "Ca", "Sr", "Ba", "Ra",
159 "Al", "Ga", "In", "Tl",
160 "Ge", "Sn", "Pb",
161 "Sb", "Bi",
162 "Po",
163 "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn",
164 "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd",
165 "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt", "Au", "Hg",
166 "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy", "Ho", "Er",
167 "Tm", "Yb", "Lu",
168 "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf", "Es", "Fm",
169 "Md", "No", "Lr"));
170
171 public static final Set<String> ALLOWED_ELEMENTS =
172 new HashSet<>(Arrays.asList(new String[] {"C", "H",
173 "N", "S", "O", "P", "F", "Br", "Cl", "I", "B", "As",
174 "Si", "Sn", "Cd", "Hg", "Zn", "Te", "Ge", "Sb", "Se"}
175 ));
176
177 public static final Set<String> ALLOWED_EXTENSIONS =
178 new HashSet<>(Arrays.asList(new String[] {".txt",
179 ".sdf", ".mol"}
180 ));
181
186 public static final String APCMAPCOMPRULE = "RCN";
187
192 public static final String APCMAPAP2BO = "RBO";
193
198 public static final String APCMAPFORBIDDENEND = "DEL";
199
204 public static final String APCMAPCAPPING = "CAP";
205
210 public static final String APCMAPIGNORE = "#";
211
215 public static final String GAGENDIRNAMEROOT = "Gen";
216
220 public static final String GAGENSUMMARYHEADER = "#Name "
221 + "GraphId UID "
222 + "Fitness Source";
223
227 public static final String FSEIDXNAMEROOT = "FSE-Level_";
228
232 public static final String SERGFILENAMEROOT = "dg_";
233
237 public static final String SERGFILENAMEEXT = "json";
238
242 public static final String FITFILENAMEPREFIX = "M";
243
247 public static final String FITFILENAMEEXTIN = "_inp.sdf";
248
252 public static final String FITFILENAMEEXTOUT = "_out.sdf";
253
257 public static final String CANDIDATE2DEXTENSION = ".png";
258
262 public static final String UNREADABLEFILEPOSTFIX = "_UNREADABLE";
263
267 public static final String GRAPHFORMATSTRING = "STRING";
268
272 public static final String GRAPHFORMATBYTE = "BYTE";
273
274
275 public static final double INVPI = 1.0/Math.sqrt(Math.PI * 2);
276
277
278 public static final int MOLDIGITS = 8;
279
283 public static final String GCODETAG = "GCODE";
284
288 public static final String GRAPHTAG = "GraphENC";
289
293 public static final String GRAPHJSONTAG = "GraphJson";
294
298 public static final String VERTEXJSONTAG = "VertexJson";
299
303 public static final String PROVENANCE = "Provenance";
304
308 public static final String APSTAG = "ATTACHMENT_POINTS";
309
313 public static final String MOLERRORTAG = "MOL_ERROR";
314
318 public static final String FITNESSTAG = "FITNESS";
319
323 public static final String SMILESTAG = "SMILES";
324
328 public static final String UNIQUEIDTAG = "UID";
329
333 public static final String INCHIKEYTAG = "InChi";
334
338 public static final String PARENTGRAPHTAG = "ParentGraph";
339
343 public static final String GRAPHLEVELTAG = "GraphLevel";
344
348 public static final String DUMMYATMSYMBOL = "Du";
349
353 public static final String ATMPROPAPS = "ATTACHMENT_POINTS";
354
360 public static final String ATMPROPVERTEXID = "DENOPTIMVertexID";
361
368 public static final String ATMPROPVERTEXPATH = "ATMPROPVERTEXPATH";
369
374 public static final String ATMPROPORIGINALATMID = "DENOPTIMAtomPosition";
375
380 public static final String BONDPROPROTATABLE = "DENOPTIMRotable";
381
387 public static final Object RCAPROPAPCTORCA = "RCAPROPAPCTORCA";
388
394 public static final Object RCAPROPCHORDBNDTYP = "RCAPROPCHORDBNDTYP";
395
401 public static final Object RCAPROPRINGUSER = "RCAPROPRINGUSER";
402
406 public static final double FLOATCOMPARISONTOLERANCE = 0.000000001;
407
411 public static final String SEPARATORAPPROPATMS = " ";
412
416 public static final String SEPARATORAPPROPAPS = ",";
417
421 public static final String SEPARATORAPPROPAAP = "#";
422
426 public static final String SEPARATORAPPROPSCL = ":";
427
431 public static final String SEPARATORAPPROPXYZ = "%";
432
437 public static final Object MOLPROPAPxVID = "APsPerVertexID";
438
443 public static final Object MOLPROPAPxEDGE = "APsPerEdge";
444
449 public static final Object MOLPROPAPxATOM = "APsPerAtom";
450
455 public static final Object MOLPROPAPxBOND = "APsPerBond";
456
462 public static final Object STOREDVID = "OLDVERTEXID";
463
469 public static final Object LINKAPS = "LINKTOGRAPHSAP";
470
474 public static final Object APORIGINALLENGTH = "ORIGINALLENGTH";
475
481 public static final Object VRTSYMMSETID = "VRTSYMMSETID";
482
487 public static final Object GRAPHBRANCHID = "GRAPHBRANCHID";
488
493 public static final String CUTRULKEYWORD = "CTR";
494
499 public static final Object FORMULASTR = "FORMULASTR";
500
508 public static final Object ISOMORPHICFAMILYID = "ISOMORPHICFAMILYID";
509
514 public static final String MWSLOTFRAGSFILENAMEROOT = "MWSlot_";
515
520 public static final String MWSLOTFRAGSUNQFILENANEEND = "_Unq";
521
526 public static final String MWSLOTFRAGSALLFILENANEEND = "_All";
527
532
533}
General set of constants used in DENOPTIM.
static final Set< String > ORGANIC_SUBSET_ELEMENTS
static final String GRAPHTAG
SDF tag containing graph encoding.
static final Object FORMULASTR
Property name used to store molecular formula as string in an atom container.
static final File RECENTFILESLIST
List of recent files.
static final String APCMAPIGNORE
Keyword identifying compatibility matrix file lines with comments.
static final Map< String, Integer > VALENCE_MAP
static final String VERTEXJSONTAG
SDF tag containing vertex encoding in JSON format.
static final String ATMPROPAPS
String tag of Atom property used to store attachment points.
static final String INCHIKEYTAG
SDF tag containing the unique identifier of a candidate.
static ArrayList< String > ALL_METALS
Elemental symbols of all metal elements, including alkaly, transition metals, actinides,...
static final String APCMAPAP2BO
Keyword identifying compatibility matrix file lines with APClass-to-Bond order map.
static final Set< String > ALL_ELEMENTS
static final String UNREADABLEFILEPOSTFIX
Postfix used to mark a file that cannot be read.
static final String PROVENANCE
SDF tag containing provenance data for a graph.
static final Object MOLPROPAPxBOND
Key for IAtomContainer property containing the map of AttachmentPoints per atom.
static final Object GRAPHBRANCHID
Property of Vertex used to record the identity of the graph branch holding that Vertex.
static final File GLOBALCONFIG
Global configuration folder.
static final String APSTAG
SDF tag defining attachment points.
static final String MWSLOTFRAGSUNQFILENANEEND
Final part of filename used to collect unique fragments in a certain molecular weight slot.
static final String CANDIDATE2DEXTENSION
Extension of output file with 2D picture of candidate.
static final String SEPARATORAPPROPAAP
Separator between atom index and APClass in molecular property.
static final String SERGFILENAMEEXT
Extension filenames of serialized graphs.
static final String EOL
new line character
static final String PARENTGRAPHTAG
SDF tag defining the ID of a parent graph (used in FSE)
static final String ATMPROPVERTEXID
String tag of Atom property used to store the unique ID of the Vertex corresponding to the molecular ...
static final double FLOATCOMPARISONTOLERANCE
Smallest difference for comparison of double and float numbers.
static final String SEPARATORAPPROPATMS
Separator between APs on different atoms in molecular property.
static final String APCMAPCAPPING
Keyword identifying compatibility matrix file lines with capping rules.
static final String GRAPHLEVELTAG
SDF tag defining the graph generating level in an FSE run.
static final String GCODETAG
SDF tag containing graph ID.
static final Object RCAPROPRINGUSER
Property of a IAtom representing a RingClosingAttractor.
static final Object RCAPROPCHORDBNDTYP
Property of a IAtom representing a RingClosingAttractor.
static final String SEPARATORAPPROPSCL
Separator between APClass and APSubClass and coordinates.
static final Set< String > ALLOWED_EXTENSIONS
static final String FITFILENAMEPREFIX
Prefix of filenames for input/output files related to fitness.
static final String GAGENSUMMARYHEADER
Header of text files collection generation details.
static final String GRAPHFORMATSTRING
Label used to point at text based graph format.
static final String UNIQUEIDTAG
SDF tag containing the unique identifier of a candidate.
static final Object MOLPROPAPxVID
Key for IAtomContainer property containing the map of AttachmentPoints per vertex ID.
static final String GAGENDIRNAMEROOT
Prefix for generation folders.
static final FileFormat TMPFRAGFILEFORMAT
Format for intermediate files used during fragmentation.
static final String CUTRULKEYWORD
Keyword that identifies rows defining cutting rules in files collecting cutting rules.
static final String GRAPHJSONTAG
SDF tag containing graph encoding in JSON format.
static final String SEPARATORAPPROPXYZ
Separator between coordinates.
static final String MWSLOTFRAGSFILENAMEROOT
Initial part of filename used to collect fragments belonging to a certain molecular weight slot.
static final Object MOLPROPAPxEDGE
Key for IAtomContainer property containing the map of AttachmentPoints per edge.
static final String ATMPROPVERTEXPATH
Name of Atom property used to store the unique ID of the Vertex that owns the atom and the IDs of any...
static final String APCMAPFORBIDDENEND
Keyword identifying compatibility matrix file lines with forbidden ends.
static final String MOLERRORTAG
SDF tag containing errors during execution of molecule specific tasks.
static final String SERGFILENAMEROOT
Prefix filenames of serialized graphs.
static Map< String, Integer > createMap()
static final String DUMMYATMSYMBOL
Symbol of dummy atom.
static final String SMILESTAG
SDF tag containing the SMILES of a candidate.
static final Object APORIGINALLENGTH
Key of AP property where we save the original length of the AP vector.
static final Object MOLPROPAPxATOM
Key for IAtomContainer property containing the map of AttachmentPoints per vertex ID.
static final String APCMAPCOMPRULE
Keyword identifying compatibility matrix file lines with APClass compatibility rules.
static final Object RCAPROPAPCTORCA
Property of a IAtom representing a RingClosingAttractor.
static final String FSEP
file separator
static final Set< String > ALLOWED_ELEMENTS
static final Object ISOMORPHICFAMILYID
Property used to store the identifier of the family of isomorphic fragments that owns a fragment.
static final String FSEIDXNAMEROOT
Prefix for graph indexing files.
static final String FITFILENAMEEXTOUT
Ending and extension of output file of external fitness provider.
static final String GRAPHFORMATBYTE
Label used to point at byte based graph format.
static final Object STOREDVID
Key of the property remembering vertex IDs.
static final String SEPARATORAPPROPAPS
Separator between APs on same atom in molecular property.
static final String FITNESSTAG
SDF tag containing the fitness of a candidate.
static final Object LINKAPS
Key of property used to records references of APs.
static final String ATMPROPORIGINALATMID
Name of Atom property used to store the original position of an atom in the atom list of the fragment...
static final String FITFILENAMEEXTIN
Ending and extension of input file of external fitness provider.
static final Object VRTSYMMSETID
Property of Vertex used to keep mark symmetric vertexes during graph operations and before defining t...
static final String MWSLOTFRAGSALLFILENANEEND
Final part of filename used to collect all samples fragments in a certain molecular weight slot inclu...
static final String BONDPROPROTATABLE
String tag of Bond's property used to store the property of being rotatable.
static boolean createDirectory(String fileName)
Creates a directory.
Definition: FileUtils.java:231
File formats identified by DENOPTIM.
Definition: FileFormat.java:32