$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 boolean acceptUnsetToSingeBO()
945 {
947 }
948
949//-----------------------------------------------------------------------------
950
956 {
957 this.embedRingsInTemplate = embedRingsInTemplate;
958 }
959
960//-----------------------------------------------------------------------------
961
966 public boolean embedRingsInTemplate()
967 {
969 }
970
971//------------------------------------------------------------------------------
972
979 {
980 this.embeddedRingsContract = embeddedRingsContract;
981 }
982
983//------------------------------------------------------------------------------
984
990 {
992 }
993
994//------------------------------------------------------------------------------
995
1001 {
1002 this.scaffoldingPolicy = sp;
1003 }
1004
1005//------------------------------------------------------------------------------
1006
1012 {
1013 return scaffoldingPolicy;
1014 }
1015
1016//------------------------------------------------------------------------------
1017
1024 public void interpretKeyword(String key, String value)
1025 throws DENOPTIMException
1026 {
1027 String msg = "";
1028 switch (key.toUpperCase())
1029 {
1030 case "WORKDIR=":
1031 workDir = value;
1032 break;
1033
1034 case "STRUCTURESFILE=":
1035 structuresFile = value;
1036 break;
1037
1038 case "FORMULATXTFILE=":
1039 checkFormula = true;
1040 formulaeFile = value;
1041 break;
1042
1043 case "PREFILTERSMARTS=":
1044 preFilter = true;
1045 preFilterSMARTS.add(value);
1046 break;
1047
1048 case "CUTTINGRULESFILE=":
1049 doFragmentation = true;
1050 cutRulesFile = value;
1051 break;
1052
1053 case "ADDEXPLICITHYDROGEN":
1054 addExplicitH = true;
1055 break;
1056
1057 case "UNSETTOSINGLEBO":
1059 break;
1060
1061 case "IGNORABLEFRAGMENTS=":
1062 ignorableFragmentsFile = value;
1063 doFiltering = true;
1064 break;
1065
1066 case "TARGETFRAGMENTS=":
1067 targetFragmentsFile = value;
1068 doFiltering = true;
1069 break;
1070
1071 case "ISOMORPHICSAMPLESIZE=":
1072 try {
1073 isomorphicSampleSize = Integer.parseInt(value);
1074 } catch (Throwable t)
1075 {
1076 msg = "Unable to parse value of " + key + ": '" + value + "'";
1077 throw new DENOPTIMException(msg);
1078 }
1081 break;
1082
1083 case "REMOVEDUPLICATES":
1085 break;
1086
1087 case "MWSLOTSIZE=":
1088 try {
1089 mwSlotSize = Integer.parseInt(value);
1090 } catch (Throwable t)
1091 {
1092 msg = "Unable to parse value of " + key + ": '" + value + "'";
1093 throw new DENOPTIMException(msg);
1094 }
1095 break;
1096
1097 case "REJECTMINORISOTOPES":
1098 doRejectWeirdIsotopes = true;
1099 doFiltering = true;
1100 break;
1101
1102 case "REJECTELEMENT=":
1103 rejectedElements.add(value);
1104 doFiltering = true;
1105 break;
1106
1107 case "REJFORMULALESSTHAN=":
1108 if (formulaCriteriaLessThan.size()>0)
1109 {
1110 msg = "Attempt to specify more than one criterion for "
1111 + "rejecting fragments based on a lower-limit "
1112 + "molecular formula. ";
1113 throw new DENOPTIMException(msg);
1114 }
1115 Map<String,Double> elSymbolsCount = null;
1116 try {
1117 elSymbolsCount = FormulaUtils.parseFormula(value);
1118 } catch (Throwable t)
1119 {
1120 msg = "Unable to parse value of " + key + ": '" + value + "'";
1121 throw new DENOPTIMException(msg);
1122 }
1123 formulaCriteriaLessThan = elSymbolsCount;
1124 doFiltering = true;
1125 break;
1126
1127 case "REJFORMULAMORETHAN=":
1128 Map<String,Double> elSymbolsCount2= null;
1129 try {
1130 elSymbolsCount2 = FormulaUtils.parseFormula(value);
1131 } catch (Throwable t)
1132 {
1133 msg = "Unable to parse value of " + key + ": '" + value + "'";
1134 throw new DENOPTIMException(msg);
1135 }
1136 formulaCriteriaMoreThan.add(elSymbolsCount2);
1137 doFiltering = true;
1138 break;
1139
1140 case "REJECTAPCLASS=":
1141 rejectedAPClasses.add(value);
1142 doFiltering = true;
1143 break;
1144
1145 case "REJECTAPCLASSCOMBINATION=":
1146 String[] lst = value.split("\\s+");
1148 doFiltering = true;
1149 break;
1150
1151 case "MAXFRAGSIZE=":
1152 try {
1153 maxFragHeavyAtomCount = Integer.parseInt(value);
1154 } catch (Throwable t)
1155 {
1156 msg = "Unable to parse value of " + key + ": '" + value + "'";
1157 throw new DENOPTIMException(msg);
1158 }
1159 doFiltering = true;
1160 break;
1161
1162 case "MINFRAGSIZE=":
1163 try {
1164 minFragHeavyAtomCount = 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 "REJECTSMARTS=":
1174 fragRejectionSMARTS.put(value, value);
1175 doFiltering = true;
1176 break;
1177
1178 case "RETAINSMARTS=":
1179 fragRetentionSMARTS.put(value, value);
1180 doFiltering = true;
1181 break;
1182
1183 case "CLUSTERIZEANDCOLLECT=":
1186 switch (value.trim().toUpperCase())
1187 {
1188 case "CENTROIDS":
1190 break;
1191
1192 case "MOSTCENTRAL":
1194 break;
1195
1196 default:
1197 throw new DENOPTIMException("Unable to parse value of "
1198 + key + ": '" + value + "'");
1199 }
1200 break;
1201
1202 case "SAVECLUSTERS":
1205 break;
1206
1207 case "SIZEUNIMODALPOPULATION=":
1208 sizeUnimodalPop = Integer.parseInt(value);
1209 break;
1210
1211 case "MAXNOISEUNIMODALPOPULATION=":
1212 maxNoiseUnimodalPop = Double.parseDouble(value);
1213 break;
1214
1215 case "SDWEIGHTUNIMODALPOPULATION=":
1216 factorForSDOnStatsOfUnimodalPop = Double.parseDouble(value);
1217 break;
1218
1219 case "SCAFFOLDINGPOLICY=":
1220 String[] words = value.split("\\s+");
1221 try {
1222 scaffoldingPolicy = ScaffoldingPolicy.valueOf(words[0]);
1224 {
1225 if (words.length<2)
1226 {
1227 throw new DENOPTIMException("Expected elemental "
1228 + "symbol after '"
1229 + ScaffoldingPolicy.ELEMENT+ "', but none "
1230 + "found");
1231 }
1232 scaffoldingPolicy.label = words[1];
1233 }
1234 } catch (Throwable t)
1235 {
1236 msg = "Unable to parse value of " + key + ": '" + value + "'";
1237 throw new DENOPTIMException(msg);
1238 }
1239 break;
1240
1241 case "EMBEDRINGSINTEMPLATES=":
1242 {
1244 break;
1245 }
1246
1247 case "RINGEMBEDDINGCONTRACT=":
1248 {
1249 if (value.length() > 0)
1250 {
1251 embeddedRingsContract = ContractLevel.valueOf(value);
1252 }
1253 break;
1254 }
1255
1256/*
1257 case "=":
1258 = value;
1259 doFiltering = true;
1260 break;
1261 */
1262
1263 case "PARALLELTASKS=":
1264 try
1265 {
1266 numParallelTasks = Integer.parseInt(value);
1267 }
1268 catch (Throwable t)
1269 {
1270 msg = "Unable to understand value " + key + "'" + value + "'";
1271 throw new DENOPTIMException(msg);
1272 }
1273 break;
1274
1275 case "VERBOSITY=":
1276 try
1277 {
1278 verbosity = 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 default:
1288 msg = "Keyword " + key + " is not a known Fragmenter-"
1289 + "related keyword. Check input files.";
1290 throw new DENOPTIMException(msg);
1291 }
1292 }
1293
1294//------------------------------------------------------------------------------
1295
1302 {
1303 if (!workDir.equals(System.getProperty("user.dir")))
1304 {
1306 }
1307 ensureIsPositive("numParallelTasks", numParallelTasks, "PARALLELTASKS");
1308 ensureIsPositive("isomorphicSampleSize", isomorphicSampleSize,
1309 "ISOMORPHICSAMPLESIZE");
1310 ensureIsPositive("mwSlotSize", mwSlotSize, "MWSLOTSIZE");
1316
1318 }
1319
1320//------------------------------------------------------------------------------
1321
1328 {
1329 if (isMaster)
1331
1332 cuttingRules = new ArrayList<CuttingRule>();
1333 if (cutRulesFile!=null && !cutRulesFile.isBlank())
1334 {
1336 }
1337 if (formulaeFile!=null && !formulaeFile.isBlank())
1338 {
1340 }
1342
1343 if (ignorableFragmentsFile!=null && !ignorableFragmentsFile.isBlank())
1344 {
1345 try
1346 {
1349 } catch (Throwable e)
1350 {
1351 throw new DENOPTIMException("Problems reading file '"
1352 + ignorableFragmentsFile + "'", e);
1353 }
1354 }
1355
1356 if (targetFragmentsFile!=null && !targetFragmentsFile.isBlank())
1357 {
1358 try
1359 {
1362 } catch (Throwable e)
1363 {
1364 throw new DENOPTIMException("Problems reading file '"
1365 + targetFragmentsFile + "'", e);
1366 }
1367 }
1368
1370 {
1372 }
1373
1374 if (isMaster)
1375 {
1376 StaticLogger.appLogger.log(Level.INFO, "Program log file: "
1378 + "Output files associated with the current run are "
1379 + "located in " + workDir);
1380 }
1381 }
1382
1383//------------------------------------------------------------------------------
1384
1386 {
1387 String curDir = workDir;
1388 String fileSep = System.getProperty("file.separator");
1389 boolean success = false;
1390 while (!success)
1391 {
1392 SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddkkmmss");
1393 String str = "FRG" + sdf.format(new Date());
1394 workDir = curDir + fileSep + str;
1396 }
1398 logFile = workDir + ".log";
1399 }
1400
1401//------------------------------------------------------------------------------
1402
1409 public String getPrintedList()
1410 {
1411 StringBuilder sb = new StringBuilder(1024);
1412 sb.append(" " + paramTypeName() + " ").append(NL);
1413 for (Field f : this.getClass().getDeclaredFields())
1414 {
1415 try
1416 {
1417 sb.append(f.getName()).append(" = ").append(
1418 f.get(this)).append(NL);
1419 }
1420 catch (Throwable t)
1421 {
1422 sb.append("ERROR! Unable to print " + paramTypeName()
1423 + " parameters. Cause: " + t);
1424 break;
1425 }
1426 }
1427 for (RunTimeParameters otherCollector : otherParameters.values())
1428 {
1429 sb.append(otherCollector.getPrintedList());
1430 }
1431 return sb.toString();
1432 }
1433
1434//------------------------------------------------------------------------------
1435
1440 public double getLinearAngleLimit()
1441 {
1442 return linearAngleLimit;
1443 }
1444
1445//------------------------------------------------------------------------------
1446
1453 {
1454 this.linearAngleLimit = linearAngleLimit;
1455 }
1456
1457//------------------------------------------------------------------------------
1458
1464 {
1466 }
1467
1468//------------------------------------------------------------------------------
1469
1476 {
1477 return sizeUnimodalPop;
1478 }
1479
1480//------------------------------------------------------------------------------
1481
1488 {
1489 this.sizeUnimodalPop = sizeUnimodalPop;
1490 }
1491
1492//------------------------------------------------------------------------------
1493
1501 {
1502 return maxNoiseUnimodalPop;
1503 }
1504
1505//------------------------------------------------------------------------------
1506
1514 {
1515 this.maxNoiseUnimodalPop = maxNoiseUnimodalPop;
1516 }
1517
1518//------------------------------------------------------------------------------
1519
1527 {
1529 }
1530
1531
1532//------------------------------------------------------------------------------
1533
1542 {
1543 this.factorForSDOnStatsOfUnimodalPop = factorForSDOnStatsOfUnimodalPop;
1544 }
1545
1546//------------------------------------------------------------------------------
1547
1555 {
1557 }
1558
1559//------------------------------------------------------------------------------
1560
1570 {
1571 this.useCentroidsAsRepresentativeConformer =
1573 }
1574
1575//------------------------------------------------------------------------------
1576
1583 {
1585 }
1586
1587//------------------------------------------------------------------------------
1588
1597 {
1598 this.saveClustersOfConformerToFile = saveClustersOfConformerToFile;
1599 }
1600
1601//------------------------------------------------------------------------------
1602
1608 {
1610 }
1611
1612//------------------------------------------------------------------------------
1613
1618 public boolean isWorkingIn3D()
1619 {
1620 return workingIn3D;
1621 }
1622
1623//------------------------------------------------------------------------------
1624
1629 public void setWorkingIn3D(boolean workingIn3D)
1630 {
1631 this.workingIn3D = workingIn3D;
1632 }
1633
1634//------------------------------------------------------------------------------
1635
1636}
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.
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:86
FRG_PARAMS
Parameters controlling the fragmenter.