$darkmode
DENOPTIM
FragmenterParameters.java
Go to the documentation of this file.
1/*
2 * DENOPTIM
3 * Copyright (C) 2019 Marco Foscato <marco.foscato@uib.no>
4 *
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU Affero General Public License as published
7 * by the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Affero General Public License for more details.
14 *
15 * You should have received a copy of the GNU Affero General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19package denoptim.programs.fragmenter;
20
21import java.io.File;
22import java.lang.reflect.Field;
23import java.text.SimpleDateFormat;
24import java.util.ArrayList;
25import java.util.Date;
26import java.util.HashMap;
27import java.util.HashSet;
28import java.util.LinkedHashMap;
29import java.util.List;
30import java.util.Map;
31import java.util.Set;
32import java.util.concurrent.atomic.AtomicInteger;
33import java.util.logging.Level;
34
35import denoptim.constants.DENOPTIMConstants;
36import denoptim.exception.DENOPTIMException;
37import denoptim.files.FileFormat;
38import denoptim.files.FileUtils;
39import denoptim.fragmenter.FragmentClusterer;
40import denoptim.fragmenter.ScaffoldingPolicy;
41import denoptim.graph.DGraph;
42import denoptim.graph.Template.ContractLevel;
43import denoptim.graph.Vertex;
44import denoptim.graph.Vertex.BBType;
45import denoptim.io.DenoptimIO;
46import denoptim.logging.StaticLogger;
47import denoptim.programs.RunTimeParameters;
48import denoptim.utils.FormulaUtils;
49
50
58{
63 private String structuresFile;
64
69 private String formulaeFile;
70
75 private LinkedHashMap<String, String> formulae;
76
80 private String cutRulesFile;
81
85 List<CuttingRule> cuttingRules;
86
90 private int numParallelTasks = 1;
91
97 private boolean checkFormula = false;
98
105 private boolean acceptUnsetToSingeBOApprox = false;
106
110 private boolean addExplicitH = false;
111
115 private boolean preFilter = false;
116
122 private Set<String> preFilterSMARTS = new HashSet<String>();
123
127 private boolean doFragmentation = false;
128
136 private boolean doFiltering = false;
137
141 private boolean doRejectWeirdIsotopes = true;
142
146 private Set<String> rejectedElements = new HashSet<String>();
147
153 private Map<String,Double> formulaCriteriaLessThan =
154 new HashMap<String,Double>();
155
161 private Set<Map<String,Double>> formulaCriteriaMoreThan =
162 new HashSet<Map<String,Double>>();
163
167 private Set<String> rejectedAPClasses = new HashSet<String>();
168
173 private Set<String[]> rejectedAPClassCombinations = new HashSet<String[]>();
174
179 private int maxFragHeavyAtomCount = -1;
180
185 private int minFragHeavyAtomCount = -1;
186
190 private Map<String, String> fragRejectionSMARTS = new HashMap<String, String>();
191
196 private Map<String, String> fragRetentionSMARTS = new HashMap<String, String>();
197
202 private boolean doAddDuOnLinearity = true;
203
208 private double linearAngleLimit = 170.0;
209
213 private String ignorableFragmentsFile = "";
214
218 private ArrayList<Vertex> ignorableFragments = new ArrayList<Vertex>();
219
224 private String targetFragmentsFile = "";
225
230 private ArrayList<Vertex> targetFragments = new ArrayList<Vertex>();
231
258 // NB: javadoc reproduced also in the getter method. See below
259 private boolean doManageIsomorphicFamilies = false;
260
267 private int isomorphicSampleSize = 1;
268
272 public static final int MAXISOMORPHICSAMPLESIZE = 50;
273
277 private int mwSlotSize = 10;
278
283 private Map<String,File> mwSlotToAllFragsFile = new HashMap<String,File>();
284
289 private Map<String,File> mwSlotToUnqFragsFile = new HashMap<String,File>();
290
296 private Map<String,Integer> isomorphsCount = new HashMap<String,Integer>();
297
298 //TODO: We could use something like the SizeControlledSet used in the EA to
299 // collect unique identifiers.
300
304 private AtomicInteger unqIsomorphicFamilyId = new AtomicInteger(0);
305
311 public final Object MANAGEMWSLOTSSLOCK = new Object();
312
318 private boolean doExtactRepresentativeConformer = false;
319
326 private int sizeUnimodalPop = 20;
327
333 private double maxNoiseUnimodalPop = 0.2;
334
344
350
354 private boolean saveClustersOfConformerToFile = false;
355
359 private boolean isStandaloneFragmentClustering = false;
360
364 private boolean workingIn3D = true;
365
372
377 protected boolean embedRingsInTemplate = false;
378
384
385
386//------------------------------------------------------------------------------
387
392 {
394 }
395
396//------------------------------------------------------------------------------
397
401 public int getNumTasks()
402 {
403 return numParallelTasks;
404 }
405
406//------------------------------------------------------------------------------
407
413 {
414 this.numParallelTasks = numParallelTasks;
415 }
416
417//------------------------------------------------------------------------------
418
422 public String getStructuresFile()
423 {
424 return structuresFile;
425 }
426
427//------------------------------------------------------------------------------
428
434 {
435 this.structuresFile = structuresFile;
436 }
437
438//------------------------------------------------------------------------------
439
445 public void setFormulaeFile(String formulaeFile)
446 {
447 this.formulaeFile = formulaeFile;
448 }
449
450//------------------------------------------------------------------------------
451
456 public String getFormulaeFile()
457 {
458 return formulaeFile;
459 }
460
461//------------------------------------------------------------------------------
462
466 public List<CuttingRule> getCuttingRules()
467 {
468 return cuttingRules;
469 }
470
471//------------------------------------------------------------------------------
472
476 public void setCuttingRules(List<CuttingRule> cuttingRules)
477 {
478 this.cuttingRules = cuttingRules;
479 }
480
481//------------------------------------------------------------------------------
482
486 public void setCuttingRulesFilePathname(String pathname)
487 {
488 this.cutRulesFile = pathname;
489 }
490
491//------------------------------------------------------------------------------
492
497 {
498 return cutRulesFile;
499 }
500
501//------------------------------------------------------------------------------
502
506 public LinkedHashMap<String, String> getFormulae()
507 {
508 return formulae;
509 }
510
511//------------------------------------------------------------------------------
512
519 public boolean doCheckFormula()
520 {
521 return checkFormula;
522 }
523
524//------------------------------------------------------------------------------
525
531 public void setCheckFormula(boolean checkFormula)
532 {
533 this.checkFormula = checkFormula;
534 }
535
536
537//------------------------------------------------------------------------------
538
542 public boolean doPreFilter()
543 {
544 return preFilter;
545 }
546
547//------------------------------------------------------------------------------
548
553 public Set<String> getPreFiltrationSMARTS()
554 {
555 return preFilterSMARTS;
556 }
557
558//------------------------------------------------------------------------------
559
563 public boolean doFragmentation()
564 {
565 return doFragmentation;
566 }
567
568//------------------------------------------------------------------------------
569
574 public boolean doRejectWeirdIsotopes()
575 {
577 }
578
579//------------------------------------------------------------------------------
580
585 public boolean doAddDuOnLinearity()
586 {
587 return doAddDuOnLinearity;
588 }
589
590//------------------------------------------------------------------------------
591
595 public Set<String> getRejectedElements()
596 {
597 return rejectedElements;
598 }
599
600//------------------------------------------------------------------------------
601
606 public Map<String, Double> getRejectedFormulaLessThan()
607 {
609 }
610
611//------------------------------------------------------------------------------
612
617 public Set<Map<String, Double>> getRejectedFormulaMoreThan()
618 {
620 }
621
622//------------------------------------------------------------------------------
623
627 public Set<String> getRejectedAPClasses()
628 {
629 return rejectedAPClasses;
630 }
631
632//------------------------------------------------------------------------------
633
637 public Set<String[]> getRejectedAPClassCombinations()
638 {
640 }
641
642//------------------------------------------------------------------------------
643
648 {
650 }
651
652//------------------------------------------------------------------------------
653
658 {
660 }
661
662//------------------------------------------------------------------------------
663
667 public Map<String, String> getFragRejectionSMARTS()
668 {
669 return fragRejectionSMARTS;
670 }
671
672//------------------------------------------------------------------------------
673
677 public Map<String, String> getFragRetentionSMARTS()
678 {
679 return fragRetentionSMARTS;
680 }
681
682//------------------------------------------------------------------------------
683
685 {
686 this.doRejectWeirdIsotopes = doRejectWeirdIsotopes;
687 }
688
689//------------------------------------------------------------------------------
690
691 public void setRejectedElements(Set<String> rejectedElements)
692 {
693 this.rejectedElements = rejectedElements;
694 }
695
696//------------------------------------------------------------------------------
697
699 Map<String, Double> formulaMax)
700 {
701 this.formulaCriteriaLessThan = formulaMax;
702 }
703
704//------------------------------------------------------------------------------
705
707 Set<Map<String, Double>> formulaCriteriaMoreThan)
708 {
709 this.formulaCriteriaMoreThan = formulaCriteriaMoreThan;
710 }
711
712//------------------------------------------------------------------------------
713
715 {
716 this.rejectedAPClasses = rejectedAPClasses;
717 }
718
719//------------------------------------------------------------------------------
720
722 Set<String[]> rejectedAPClassCombinations)
723 {
724 this.rejectedAPClassCombinations = rejectedAPClassCombinations;
725 }
726
727//------------------------------------------------------------------------------
728
730 {
731 this.maxFragHeavyAtomCount = maxFragHeavyAtomCount;
732 }
733
734//------------------------------------------------------------------------------
735
737 {
738 this.minFragHeavyAtomCount = minFragHeavyAtomCount;
739 }
740
741//------------------------------------------------------------------------------
742
743 public void setFragRejectionSMARTS(Map<String, String> fragRejectionSMARTS)
744 {
745 this.fragRejectionSMARTS = fragRejectionSMARTS;
746 }
747
748//------------------------------------------------------------------------------
749
750 public void setFragRetentionSMARTS(Map<String, String> fragRetentionSMARTS)
751 {
752 this.fragRetentionSMARTS = fragRetentionSMARTS;
753 }
754
755//------------------------------------------------------------------------------
756
760 public ArrayList<Vertex> getIgnorableFragments()
761 {
762 return ignorableFragments;
763 }
764
765//------------------------------------------------------------------------------
766
771 public ArrayList<Vertex> getTargetFragments()
772 {
773 return targetFragments;
774 }
775
776//------------------------------------------------------------------------------
777
807 {
809 }
810
811//------------------------------------------------------------------------------
812
814 {
816 }
817
818//------------------------------------------------------------------------------
819
821 {
822 this.isomorphicSampleSize = isomorphicSampleSize;
823 }
824
825//------------------------------------------------------------------------------
826
827 public int getMWSlotSize()
828 {
829 return mwSlotSize;
830 }
831
832//------------------------------------------------------------------------------
833
834 public void setMWSlotSize(int mwSlotSize)
835 {
836 this.mwSlotSize = mwSlotSize;
837 }
838
839//------------------------------------------------------------------------------
840
841 public Map<String, File> getMWSlotToAllFragsFile()
842 {
844 }
845
846//------------------------------------------------------------------------------
847
848 public void setMWSlotToAllFragsFile(Map<String, File> mwSlotToAllFragsFile)
849 {
850 this.mwSlotToAllFragsFile = mwSlotToAllFragsFile;
851 }
852
853//------------------------------------------------------------------------------
854
855 public Map<String, File> getMWSlotToUnqFragsFile()
856 {
858 }
859
860//------------------------------------------------------------------------------
861
870 public File getMWSlotFileNameUnqFrags(String mwSlotId)
871 {
872 return new File(getWorkDirectory() + DenoptimIO.FS
876 }
877
878//------------------------------------------------------------------------------
879
887 public File getMWSlotFileNameAllFrags(String mwSlotId)
888 {
889 return new File(getWorkDirectory() + DenoptimIO.FS
893 }
894
895//------------------------------------------------------------------------------
896
900 public Map<String,Integer> getIsomorphsCount()
901 {
902 return isomorphsCount;
903 }
904
905//------------------------------------------------------------------------------
906
911 public String newIsomorphicFamilyID()
912 {
913 return "IsomorphicFamily_" + unqIsomorphicFamilyId.getAndIncrement();
914 }
915
916//------------------------------------------------------------------------------
917
923 public boolean doFiltering()
924 {
925 return doFiltering;
926 }
927
928//------------------------------------------------------------------------------
929
933 public boolean addExplicitH()
934 {
935 return addExplicitH;
936 }
937
938//------------------------------------------------------------------------------
939
944 public void setAddExplicitH(boolean addExplicitH)
945 {
946 this.addExplicitH = addExplicitH;
947 }
948
949//------------------------------------------------------------------------------
950
955 public boolean acceptUnsetToSingeBO()
956 {
958 }
959
960//-----------------------------------------------------------------------------
961
967 {
968 this.embedRingsInTemplate = embedRingsInTemplate;
969 }
970
971//-----------------------------------------------------------------------------
972
977 public boolean embedRingsInTemplate()
978 {
980 }
981
982//------------------------------------------------------------------------------
983
990 {
991 this.embeddedRingsContract = embeddedRingsContract;
992 }
993
994//------------------------------------------------------------------------------
995
1001 {
1002 return embeddedRingsContract;
1003 }
1004
1005//------------------------------------------------------------------------------
1006
1012 {
1013 this.scaffoldingPolicy = sp;
1014 }
1015
1016//------------------------------------------------------------------------------
1017
1023 {
1024 return scaffoldingPolicy;
1025 }
1026
1027//------------------------------------------------------------------------------
1028
1035 public void interpretKeyword(String key, String value)
1036 throws DENOPTIMException
1037 {
1038 String msg = "";
1039 switch (key.toUpperCase())
1040 {
1041 case "WORKDIR=":
1042 workDir = value;
1043 break;
1044
1045 case "STRUCTURESFILE=":
1046 structuresFile = value;
1047 break;
1048
1049 case "FORMULATXTFILE=":
1050 checkFormula = true;
1051 formulaeFile = value;
1052 break;
1053
1054 case "PREFILTERSMARTS=":
1055 preFilter = true;
1056 preFilterSMARTS.add(value);
1057 break;
1058
1059 case "CUTTINGRULESFILE=":
1060 doFragmentation = true;
1061 cutRulesFile = value;
1062 break;
1063
1064 case "ADDEXPLICITHYDROGEN":
1065 addExplicitH = true;
1066 break;
1067
1068 case "UNSETTOSINGLEBO":
1070 break;
1071
1072 case "IGNORABLEFRAGMENTS=":
1073 ignorableFragmentsFile = value;
1074 doFiltering = true;
1075 break;
1076
1077 case "TARGETFRAGMENTS=":
1078 targetFragmentsFile = value;
1079 doFiltering = true;
1080 break;
1081
1082 case "ISOMORPHICSAMPLESIZE=":
1083 try {
1084 isomorphicSampleSize = Integer.parseInt(value);
1085 } catch (Throwable t)
1086 {
1087 msg = "Unable to parse value of " + key + ": '" + value + "'";
1088 throw new DENOPTIMException(msg);
1089 }
1092 break;
1093
1094 case "REMOVEDUPLICATES":
1096 break;
1097
1098 case "MWSLOTSIZE=":
1099 try {
1100 mwSlotSize = Integer.parseInt(value);
1101 } catch (Throwable t)
1102 {
1103 msg = "Unable to parse value of " + key + ": '" + value + "'";
1104 throw new DENOPTIMException(msg);
1105 }
1106 break;
1107
1108 case "REJECTMINORISOTOPES":
1109 doRejectWeirdIsotopes = true;
1110 doFiltering = true;
1111 break;
1112
1113 case "REJECTELEMENT=":
1114 rejectedElements.add(value);
1115 doFiltering = true;
1116 break;
1117
1118 case "REJFORMULALESSTHAN=":
1119 if (formulaCriteriaLessThan.size()>0)
1120 {
1121 msg = "Attempt to specify more than one criterion for "
1122 + "rejecting fragments based on a lower-limit "
1123 + "molecular formula. ";
1124 throw new DENOPTIMException(msg);
1125 }
1126 Map<String,Double> elSymbolsCount = null;
1127 try {
1128 elSymbolsCount = FormulaUtils.parseFormula(value);
1129 } catch (Throwable t)
1130 {
1131 msg = "Unable to parse value of " + key + ": '" + value + "'";
1132 throw new DENOPTIMException(msg);
1133 }
1134 formulaCriteriaLessThan = elSymbolsCount;
1135 doFiltering = true;
1136 break;
1137
1138 case "REJFORMULAMORETHAN=":
1139 Map<String,Double> elSymbolsCount2= null;
1140 try {
1141 elSymbolsCount2 = FormulaUtils.parseFormula(value);
1142 } catch (Throwable t)
1143 {
1144 msg = "Unable to parse value of " + key + ": '" + value + "'";
1145 throw new DENOPTIMException(msg);
1146 }
1147 formulaCriteriaMoreThan.add(elSymbolsCount2);
1148 doFiltering = true;
1149 break;
1150
1151 case "REJECTAPCLASS=":
1152 rejectedAPClasses.add(value);
1153 doFiltering = true;
1154 break;
1155
1156 case "REJECTAPCLASSCOMBINATION=":
1157 String[] lst = value.split("\\s+");
1159 doFiltering = true;
1160 break;
1161
1162 case "MAXFRAGSIZE=":
1163 try {
1164 maxFragHeavyAtomCount = Integer.parseInt(value);
1165 } catch (Throwable t)
1166 {
1167 msg = "Unable to parse value of " + key + ": '" + value + "'";
1168 throw new DENOPTIMException(msg);
1169 }
1170 doFiltering = true;
1171 break;
1172
1173 case "MINFRAGSIZE=":
1174 try {
1175 minFragHeavyAtomCount = Integer.parseInt(value);
1176 } catch (Throwable t)
1177 {
1178 msg = "Unable to parse value of " + key + ": '" + value + "'";
1179 throw new DENOPTIMException(msg);
1180 }
1181 doFiltering = true;
1182 break;
1183
1184 case "REJECTSMARTS=":
1185 fragRejectionSMARTS.put(value, value);
1186 doFiltering = true;
1187 break;
1188
1189 case "RETAINSMARTS=":
1190 fragRetentionSMARTS.put(value, value);
1191 doFiltering = true;
1192 break;
1193
1194 case "CLUSTERIZEANDCOLLECT=":
1197 switch (value.trim().toUpperCase())
1198 {
1199 case "CENTROIDS":
1201 break;
1202
1203 case "MOSTCENTRAL":
1205 break;
1206
1207 default:
1208 throw new DENOPTIMException("Unable to parse value of "
1209 + key + ": '" + value + "'");
1210 }
1211 break;
1212
1213 case "SAVECLUSTERS":
1216 break;
1217
1218 case "SIZEUNIMODALPOPULATION=":
1219 sizeUnimodalPop = Integer.parseInt(value);
1220 break;
1221
1222 case "MAXNOISEUNIMODALPOPULATION=":
1223 maxNoiseUnimodalPop = Double.parseDouble(value);
1224 break;
1225
1226 case "SDWEIGHTUNIMODALPOPULATION=":
1227 factorForSDOnStatsOfUnimodalPop = Double.parseDouble(value);
1228 break;
1229
1230 case "SCAFFOLDINGPOLICY=":
1231 String[] words = value.split("\\s+");
1232 try {
1234 words[0].toUpperCase());
1236 {
1237 if (words.length<2)
1238 {
1239 throw new DENOPTIMException("Expected elemental "
1240 + "symbol after '"
1241 + ScaffoldingPolicy.ELEMENT+ "', but none "
1242 + "found");
1243 }
1244 scaffoldingPolicy.label = words[1];
1245 }
1246 } catch (Throwable t)
1247 {
1248 msg = "Unable to parse value of " + key + ": '" + value + "'";
1249 throw new DENOPTIMException(msg, t);
1250 }
1251 break;
1252
1253 case "EMBEDRINGSINTEMPLATES=":
1254 {
1256 break;
1257 }
1258
1259 case "RINGEMBEDDINGCONTRACT=":
1260 {
1261 if (value.length() > 0)
1262 {
1263 embeddedRingsContract = ContractLevel.valueOf(value);
1264 }
1265 break;
1266 }
1267
1268/*
1269 case "=":
1270 = value;
1271 doFiltering = true;
1272 break;
1273 */
1274
1275 case "PARALLELTASKS=":
1276 try
1277 {
1278 numParallelTasks = Integer.parseInt(value);
1279 }
1280 catch (Throwable t)
1281 {
1282 msg = "Unable to understand value " + key + "'" + value + "'";
1283 throw new DENOPTIMException(msg);
1284 }
1285 break;
1286
1287 case "VERBOSITY=":
1288 try
1289 {
1290 verbosity = Integer.parseInt(value);
1291 }
1292 catch (Throwable t)
1293 {
1294 msg = "Unable to understand value " + key + "'" + value + "'";
1295 throw new DENOPTIMException(msg);
1296 }
1297 break;
1298
1299 default:
1300 msg = "Keyword " + key + " is not a known Fragmenter-"
1301 + "related keyword. Check input files.";
1302 throw new DENOPTIMException(msg);
1303 }
1304 }
1305
1306//------------------------------------------------------------------------------
1307
1314 {
1315 if (!workDir.equals(System.getProperty("user.dir")))
1316 {
1318 }
1319 ensureIsPositive("numParallelTasks", numParallelTasks, "PARALLELTASKS");
1320 ensureIsPositive("isomorphicSampleSize", isomorphicSampleSize,
1321 "ISOMORPHICSAMPLESIZE");
1322 ensureIsPositive("mwSlotSize", mwSlotSize, "MWSLOTSIZE");
1328
1330 }
1331
1332//------------------------------------------------------------------------------
1333
1340 {
1341 if (isMaster)
1343
1344 cuttingRules = new ArrayList<CuttingRule>();
1345 if (cutRulesFile!=null && !cutRulesFile.isBlank())
1346 {
1348 }
1349 if (formulaeFile!=null && !formulaeFile.isBlank())
1350 {
1352 }
1354
1355 if (ignorableFragmentsFile!=null && !ignorableFragmentsFile.isBlank())
1356 {
1357 try
1358 {
1361 } catch (Throwable e)
1362 {
1363 throw new DENOPTIMException("Problems reading file '"
1364 + ignorableFragmentsFile + "'", e);
1365 }
1366 }
1367
1368 if (targetFragmentsFile!=null && !targetFragmentsFile.isBlank())
1369 {
1370 try
1371 {
1374 } catch (Throwable e)
1375 {
1376 throw new DENOPTIMException("Problems reading file '"
1377 + targetFragmentsFile + "'", e);
1378 }
1379 }
1380
1382 {
1384 }
1385
1386 if (isMaster)
1387 {
1388 StaticLogger.appLogger.log(Level.INFO, "Program log file: "
1390 + "Output files associated with the current run are "
1391 + "located in " + workDir);
1392 }
1393 }
1394
1395//------------------------------------------------------------------------------
1396
1398 {
1399 String curDir = workDir;
1400 String fileSep = System.getProperty("file.separator");
1401 boolean success = false;
1402 while (!success)
1403 {
1404 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddkkmmss");
1405 String str = "FRG" + sdf.format(new Date());
1406 workDir = curDir + fileSep + str;
1408 }
1410 logFile = workDir + ".log";
1411 }
1412
1413//------------------------------------------------------------------------------
1414
1421 public String getPrintedList()
1422 {
1423 StringBuilder sb = new StringBuilder(1024);
1424 sb.append(" " + paramTypeName() + " ").append(NL);
1425 for (Field f : this.getClass().getDeclaredFields())
1426 {
1427 try
1428 {
1429 sb.append(f.getName()).append(" = ").append(
1430 f.get(this)).append(NL);
1431 }
1432 catch (Throwable t)
1433 {
1434 sb.append("ERROR! Unable to print " + paramTypeName()
1435 + " parameters. Cause: " + t);
1436 break;
1437 }
1438 }
1439 for (RunTimeParameters otherCollector : otherParameters.values())
1440 {
1441 sb.append(otherCollector.getPrintedList());
1442 }
1443 return sb.toString();
1444 }
1445
1446//------------------------------------------------------------------------------
1447
1452 public double getLinearAngleLimit()
1453 {
1454 return linearAngleLimit;
1455 }
1456
1457//------------------------------------------------------------------------------
1458
1465 {
1466 this.linearAngleLimit = linearAngleLimit;
1467 }
1468
1469//------------------------------------------------------------------------------
1470
1476 {
1478 }
1479
1480//------------------------------------------------------------------------------
1481
1488 {
1489 return sizeUnimodalPop;
1490 }
1491
1492//------------------------------------------------------------------------------
1493
1500 {
1501 this.sizeUnimodalPop = sizeUnimodalPop;
1502 }
1503
1504//------------------------------------------------------------------------------
1505
1513 {
1514 return maxNoiseUnimodalPop;
1515 }
1516
1517//------------------------------------------------------------------------------
1518
1526 {
1527 this.maxNoiseUnimodalPop = maxNoiseUnimodalPop;
1528 }
1529
1530//------------------------------------------------------------------------------
1531
1539 {
1541 }
1542
1543
1544//------------------------------------------------------------------------------
1545
1554 {
1555 this.factorForSDOnStatsOfUnimodalPop = factorForSDOnStatsOfUnimodalPop;
1556 }
1557
1558//------------------------------------------------------------------------------
1559
1567 {
1569 }
1570
1571//------------------------------------------------------------------------------
1572
1582 {
1583 this.useCentroidsAsRepresentativeConformer =
1585 }
1586
1587//------------------------------------------------------------------------------
1588
1595 {
1597 }
1598
1599//------------------------------------------------------------------------------
1600
1609 {
1610 this.saveClustersOfConformerToFile = saveClustersOfConformerToFile;
1611 }
1612
1613//------------------------------------------------------------------------------
1614
1620 {
1622 }
1623
1624//------------------------------------------------------------------------------
1625
1630 public boolean isWorkingIn3D()
1631 {
1632 return workingIn3D;
1633 }
1634
1635//------------------------------------------------------------------------------
1636
1641 public void setWorkingIn3D(boolean workingIn3D)
1642 {
1643 this.workingIn3D = workingIn3D;
1644 }
1645
1646//------------------------------------------------------------------------------
1647
1648}
General set of constants used in DENOPTIM.
static final String MWSLOTFRAGSUNQFILENANEEND
Final part of filename used to collect unique fragments in a certain molecular weight slot.
static final String EOL
new line character
static final FileFormat TMPFRAGFILEFORMAT
Format for intermediate files used during fragmentation.
static final String MWSLOTFRAGSFILENAMEROOT
Initial part of filename used to collect fragments belonging to a certain molecular weight slot.
static final String MWSLOTFRAGSALLFILENANEEND
Final part of filename used to collect all samples fragments in a certain molecular weight slot inclu...
static boolean createDirectory(String fileName)
Creates a directory.
Definition: FileUtils.java:231
static void addToRecentFiles(String fileName, FileFormat ff)
Appends an entry to the list of recent files.
Definition: FileUtils.java:67
Utility methods for input/output.
static LinkedHashMap< String, String > readCSDFormulae(File file)
Read molecular formula from TXT data representation produced by Cambridge Structural Database tools (...
static void readCuttingRules(BufferedReader reader, List< CuttingRule > cutRules, String source)
Read cutting rules from a stream.
static ArrayList< Vertex > readVertexes(File file, Vertex.BBType bbt)
Reads Vertexes from any file that can contain such items.
static final String FS
File separator from system.
Logger class for DENOPTIM.
static final Logger appLogger
Collection of parameters controlling the behavior of the software.
Map< ParametersType, RunTimeParameters > otherParameters
Collection of other parameters by type.
boolean isMaster
Flag signaling this is the master collection of parameters.
String getWorkDirectory()
Gets the pathname to the working directory.
static boolean readYesNoTrueFalse(String s)
Reads a string searching for any common way to say either yes/true (including shorthand t/y) or no/fa...
void ensureFileExists(String pathname)
Ensures a pathname does lead to an existing file or triggers an error.
String paramTypeName()
Returns a string defining the type the parameters collected here.
void ensureIsPositive(String paramName, int value, String paramKey)
Ensures that a parameter is a positive number (x>=0) or triggers an error.
void checkOtherParameters()
Checks any of the parameter collections contained in this instance.
final String NL
New line character.
void processOtherParameters()
Processes any of the parameter collections contained in this instance.
int verbosity
Verbosity level for logger.
void ensureFileExistsIfSet(String pathname)
Ensures a pathname is not empty nor null and that it does lead to an existing file or triggers an err...
Parameters controlling execution of the fragmenter.
String structuresFile
Pathname to the file containing the structures of the molecules to fragment.
void setEmbeddedRingsContract(ContractLevel embeddedRingsContract)
void setFragRejectionSMARTS(Map< String, String > fragRejectionSMARTS)
void setRejectedAPClassCombinations(Set< String[]> rejectedAPClassCombinations)
void setSaveClustersOfConformerToFile(boolean saveClustersOfConformerToFile)
Sets the flag requesting to print clusters of fragments to file upon extraction of the most represent...
void setCuttingRules(List< CuttingRule > cuttingRules)
Assigns the cutting rules loaded from the input.
void setStructuresFile(String structuresFile)
Sets the pathname of the file containing input structures.
void setSizeUnimodalPop(int sizeUnimodalPop)
Sets the size of the population of normally distributed noise-distorted population used to define the...
double factorForSDOnStatsOfUnimodalPop
Factor used to multiply the standard deviation when adding it to the mean of the RMSD for a unimodal ...
void setCheckFormula(boolean checkFormula)
Sets the value of the flag controlling the execution of elemental analysis on the structures.
Set< String > preFilterSMARTS
SMARTS identifying substructures that lead to rejection of a structure before fragmentation.
Map< String, File > mwSlotToUnqFragsFile
Mapping of the molecular weight slot identifier to the file collecting unique fragments belonging to ...
void setFactorForSDOnStatsOfUnimodalPop(double factorForSDOnStatsOfUnimodalPop)
Sets the weight of the standard deviation when calculating the RMSD threshold from the statistics of ...
String cutRulesFile
Pathname to the file containing the cutting rules.
String formulaeFile
Pathname to the file containing the formulae of the molecules to fragment.
ContractLevel embeddedRingsContract
Type of constrain defined for any template generated upon conversion of molecules into DGraph.
void setRejectedFormulaMoreThan(Set< Map< String, Double > > formulaCriteriaMoreThan)
boolean doRejectWeirdIsotopes
Flag requesting to reject fragments with minor isotopes.
void checkParameters()
Evaluate consistency of input parameters.
void interpretKeyword(String key, String value)
Processes a keyword/value pair and assign the related parameters.
void setFragRetentionSMARTS(Map< String, String > fragRetentionSMARTS)
final Object MANAGEMWSLOTSSLOCK
Synchronization lock for manipulating a) the collections (i.e., MW slots) of fragments produced by mu...
boolean doAddDuOnLinearity
Flag requesting to add dummy atoms on linearities.
double linearAngleLimit
Upper limit for an angle before it is treated as "flat" ("linear") angle, i.e., close enough to 180 D...
int minFragHeavyAtomCount
Lower limit for number of non-H atoms in fragments.
void setAddExplicitH(boolean addExplicitH)
Give true to add explicit H atoms on all atoms.
boolean doFiltering
Flag requesting to do post-fragmentation processing of fragments, i.e., application of all filtration...
void setUseCentroidsAsRepresentativeConformer(boolean useCentroidsAsRepresentativeConformer)
void setRejectedFormulaLessThan(Map< String, Double > formulaMax)
Set< Map< String, Double > > formulaCriteriaMoreThan
Upper limits of formula-based criteria for fragment rejection.
boolean doFragmentation
Fag requesting the fragmentation of the structures.
void setNumTasks(int numParallelTasks)
Sets the number of parallel tasks to run.
AtomicInteger unqIsomorphicFamilyId
Unique identifier of a family of isomorphic versions of a fragment,.
void setLinearAngleLimit(double linearAngleLimit)
Sets the upper limit for an angle before it is treated as "flat" angle, i.e., close enough to 180 DEG...
List< CuttingRule > cuttingRules
List of cutting rules sorted by priority.
String getPrintedList()
Returns the list of parameters in a string with newline characters as delimiters.
File getMWSlotFileNameAllFrags(String mwSlotId)
Builds the pathname of the file meant to hold all isomorphic fragments from a given MW slot.
Set< String > rejectedAPClasses
The initial part of APClasses that lead to rejection of a fragment.
boolean doExtactRepresentativeConformer
Flag signaling the request to analyze each isomorphic family to extract the most representative fragm...
ArrayList< Vertex > targetFragments
List of fragment that will be retained, i.e., any isomorphic fragment of any of these will be kept,...
boolean acceptUnsetToSingeBOApprox
Flag requesting to force-accepting the approximation that converts all unset bond orders to single bo...
boolean workingIn3D
Flag activating operations depending on 3D structure.
Map< String, File > mwSlotToAllFragsFile
Mapping of the molecular weight slot identifier to the file collecting all collected fragments belong...
void setMaxNoiseUnimodalPop(double maxNoiseUnimodalPop)
Sets the maximum noise of the population of normally distributed noise-distorted population used to d...
Set< String > rejectedElements
Symbols of elements that lead to rejection of a fragment.
boolean saveClustersOfConformerToFile
Flag requesting to print clusters of fragments to file.
int mwSlotSize
Molecular weight slot width for collecting fragments.
void setRejectWeirdIsotopes(boolean doRejectWeirdIsotopes)
String newIsomorphicFamilyID()
Produced a new unique identifier for a family of isomorphic fragments.
double maxNoiseUnimodalPop
Maximum amount of absolute noise used to generate normally distributed noise-distorted population of ...
boolean checkFormula
Flag requesting the execution of elemental analysis and comparison of the content of the structure fi...
Map< String, String > fragRejectionSMARTS
SMARTS leading to rejection of a fragment.
void setFormulaeFile(String formulaeFile)
Sets the pathname of the file containing molecular formula with a format respecting Cambridge Structu...
File getMWSlotFileNameUnqFrags(String mwSlotId)
Builds the pathname of the file meant to hold unique fragments from within a given MW slot,...
boolean useCentroidsAsRepresentativeConformer
Flag requesting to same cluster centroids rather than the actual fragments that are closest to the ce...
void setCuttingRulesFilePathname(String pathname)
Assigns the pathname to the cutting rules file.
boolean addExplicitH
Flag requesting to add explicit H atoms.
void setEmbedRingsInTemplate(boolean embedRingsInTemplate)
int maxFragHeavyAtomCount
Upper limit for number of non-H atoms in fragments.
int numParallelTasks
Number of parallel tasks to run.
Map< String, Double > formulaCriteriaLessThan
Lower limits of formula-based criteria for fragment rejection.
Map< String, String > fragRetentionSMARTS
SMARTS leading to retention of a fragment.
int sizeUnimodalPop
Size of on-the-fly generated, normally distributed noise-distorted population of geometries used to d...
void setRejectedAPClasses(Set< String > rejectedAPClasses)
boolean isStandaloneFragmentClustering
Flag requesting to run fragment clusterer in stand-alone fashion.
ScaffoldingPolicy scaffoldingPolicy
The policy for defining the scaffold vertex in a graph that does not have such a BBType.
String ignorableFragmentsFile
Pathname to file with fragments that can be ignored.
boolean preFilter
Fag requesting the pre-fragmentation filtering of the structures.
ArrayList< Vertex > ignorableFragments
List of fragment that can be rejected.
void setRejectedElements(Set< String > rejectedElements)
void processParameters()
Processes all parameters and initialize related objects.
LinkedHashMap< String, String > formulae
Molecular formula read-in from CSD file.
boolean embedRingsInTemplate
Flag that enables the embedding of rings in templates upon conversion of molecules into DGraph.
int isomorphicSampleSize
Size of the sample of isomorphic fragments to collect.
Map< String, Integer > isomorphsCount
Counts of isomorphic versions of each known fragment generated in a fragmentation process.
void setMWSlotToAllFragsFile(Map< String, File > mwSlotToAllFragsFile)
static final int MAXISOMORPHICSAMPLESIZE
Maximum isomorphic sample size.
void setWorkingIn3D(boolean workingIn3D)
Sets boolean variable workingIn3D.
String targetFragmentsFile
Pathname to file with fragments that will be retained, i.e., any isomorphic fragment of any of these ...
Set< String[]> rejectedAPClassCombinations
Combination of strings matching the beginning of APClass names that lead to rejection of a fragment.
Utilities for manipulating molecular formulas.
static Map< String, Double > parseFormula(String formula)
Reads a molecular formula written as "H2 O" or "C6 H12 O6".
File formats identified by DENOPTIM.
Definition: FileFormat.java:32
Defines how to define the scaffold vertex of a graph.
Enum specifying to what extent the template's inner graph can be changed.
Definition: Template.java:104
FREE
Inner graphs are free to change within the confines of the required AttachmentPoints.
Definition: Template.java:109
The type of building block.
Definition: Vertex.java:87
FRG_PARAMS
Parameters controlling the fragmenter.