Skip to content

Commit 6ce8f7c

Browse files
Merge pull request #136 from denoptim-project/sym_vrtxs_in_same_branch_devel
New symmetry detection algorithm New mutation to add fused rings
2 parents 8a3b2c2 + caafe3a commit 6ce8f7c

File tree

97 files changed

+40478
-4211
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+40478
-4211
lines changed

.classpath

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
</attributes>
88
</classpathentry>
99
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/5"/>
10-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
10+
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
1111
<attributes>
12+
<attribute name="module" value="true"/>
1213
<attribute name="maven.pomderived" value="true"/>
1314
</attributes>
1415
</classpathentry>
@@ -19,7 +20,7 @@
1920
<attribute name="maven.pomderived" value="true"/>
2021
</attributes>
2122
</classpathentry>
22-
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
23+
<classpathentry exported="true" kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
2324
<attributes>
2425
<attribute name="maven.pomderived" value="true"/>
2526
</attributes>
@@ -31,8 +32,8 @@
3132
</classpathentry>
3233
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
3334
<attributes>
34-
<attribute name="maven.pomderived" value="true"/>
3535
<attribute name="test" value="true"/>
36+
<attribute name="maven.pomderived" value="true"/>
3637
</attributes>
3738
</classpathentry>
3839
<classpathentry kind="output" path="target/classes"/>

doc/user_manual.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
# DENOPTIM
33
_De novo_ Optimization of In/organic Molecules
4-
_Version 4.2.0, Jan 2024_
4+
_Version 4.2.2, Nov 2024_
55

66

77
[TOC]
@@ -511,7 +511,8 @@ The following tables list all the keywords grouped according to the main functio
511511
|`RC-EvaluationClosabilityMode`| Defined the closability condition's evaluation mode:<br><br> 0. only constitution of candidate ring,<br> 1. only closability of 3D chain,<br> 2. both 0 and 1.|
512512
|`RC-RequiredElementInRings`| Specifies the elemental symbol that has to be contained in all acceptable rings of fragments. The shortest path is used to evaluate this ring closing condition.|
513513
|`RC-ClosableRingSMARTS`| Specifies a single constitutional ring closability condition by a single SMARTS string. This keyword may be used multiple times to provide a list of constitutional ring closability conditions. <br><br> Example:<br><br> `RC-ClosableRingSMARTS=C1CCCCC1`<br> `RC-ClosableRingSMARTS=C1CCCCCC1`|
514-
|`RC-RingSizeBias`| Specifies the bias associated to a given ring size when selecting the combination of rings (i.e., RCAs) for a given graph.<br><br> The syntax is:<br><br>`RC-RingSizeBias=<size> <bias>`<br><br> Multiple occurrence of this keyword can be used.<br><br> Example: the following lines give to all 6-member rings a probability of being formed that is twice that given to all 5-member rings. Instead 7-membered rings will never be formed.<br><br> `RC-RingSizeBias=5 1`<br> `RC-RingSizeBias=6 2` <br>`RC-RingSizeBias=7 0`<br>
514+
|`RC-RingSizeBias`| Specifies the bias associated to a given ring size when selecting the combination of rings (i.e., RCAs) for a given graph.<br><br> The syntax is:<br><br>`RC-RingSizeBias=<size> <bias>`<br><br> Multiple occurrence of this keyword can be used.<br><br> Example: the following lines give to all 6-member rings a probability of being formed that is twice that given to all 5-member rings. Instead 7-membered rings will never be formed.<br><br> `RC-RingSizeBias=5 1`<br> `RC-RingSizeBias=6 2` <br>`RC-RingSizeBias=7 0`<br>|
515+
|`RC-BridgeHeadFindingRulesFile`| Specifies the pathname to a JSON file defining how to identify candidate bridge-head atoms that can be used to extend ring systems by adding fused rings. The bridge-head atoms are a pair of atoms (with attachment points) that already belong to at least one ring and, once they are identified as candidate bridge-head pair, they can be used, according to APclass compatibility rules, to form a new ring of vertexes, hence a ring. Default rules are available in the distribution folder at src/main/resources/data/bridge-head_finding_rules.json|
515516
|`RC-MaxSizeNewRings`| Specifies the maximum number of ring members for rings created from scratch. |
516517
|`RC-CheckInterdependentChains`| Requires evaluation of interdependent closability condition. WARNING: this function require exhaustive conformational search, which is very time consuming.|
517518
|__Search for ring closing conformations in 3D__||

pom.xml

+20-20
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<artifactId>denoptim</artifactId>
55

66

7-
<version>4.2.0</version>
7+
<version>4.2.2</version>
88
<!-- WARNING: the vesion must be changes also in doc/user_manual.md-->
99

1010
<name>denoptim</name>
@@ -20,7 +20,7 @@
2020
<dependency>
2121
<groupId>commons-cli</groupId>
2222
<artifactId>commons-cli</artifactId>
23-
<version>1.5.0</version>
23+
<version>1.9.0</version>
2424
</dependency>
2525
<!-- https://mvnrepository.com/artifact/net.sourceforge.jmol/jmol -->
2626
<dependency>
@@ -31,19 +31,19 @@
3131
<dependency>
3232
<artifactId>cdk-bundle</artifactId>
3333
<groupId>org.openscience.cdk</groupId>
34-
<version>2.8</version>
34+
<version>2.9</version>
3535
</dependency>
3636
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
3737
<dependency>
3838
<groupId>commons-io</groupId>
3939
<artifactId>commons-io</artifactId>
40-
<version>2.11.0</version>
40+
<version>2.17.0</version>
4141
</dependency>
4242
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
4343
<dependency>
4444
<groupId>org.apache.commons</groupId>
4545
<artifactId>commons-lang3</artifactId>
46-
<version>3.12.0</version>
46+
<version>3.17.0</version>
4747
</dependency>
4848
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->
4949
<dependency>
@@ -55,19 +55,19 @@
5555
<dependency>
5656
<groupId>com.google.code.gson</groupId>
5757
<artifactId>gson</artifactId>
58-
<version>2.10.1</version>
58+
<version>2.11.0</version>
5959
</dependency>
6060
<!-- https://mvnrepository.com/artifact/com.google.guava/guava -->
6161
<dependency>
6262
<groupId>com.google.guava</groupId>
6363
<artifactId>guava</artifactId>
64-
<version>31.1-jre</version>
64+
<version>33.3.1-jre</version>
6565
</dependency>
6666
<!-- https://mvnrepository.com/artifact/org.jfree/jfreechart -->
6767
<dependency>
6868
<groupId>org.jfree</groupId>
6969
<artifactId>jfreechart</artifactId>
70-
<version>1.5.4</version>
70+
<version>1.5.5</version>
7171
</dependency>
7272
<!-- https://mvnrepository.com/artifact/org.jfree/jfreesvg -->
7373
<dependency>
@@ -79,7 +79,7 @@
7979
<dependency>
8080
<groupId>org.jgrapht</groupId>
8181
<artifactId>jgrapht-core</artifactId>
82-
<version>1.5.1</version>
82+
<version>1.5.2</version>
8383
</dependency>
8484
<!-- https://mvnrepository.com/artifact/net.sf.jung/jung-algorithms -->
8585
<dependency>
@@ -109,35 +109,35 @@
109109
<dependency>
110110
<groupId>org.junit.jupiter</groupId>
111111
<artifactId>junit-jupiter</artifactId>
112-
<version>5.9.2</version>
112+
<version>5.11.3</version>
113113
<scope>test</scope>
114114
</dependency>
115115
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
116116
<dependency>
117117
<groupId>org.junit.jupiter</groupId>
118118
<artifactId>junit-jupiter-api</artifactId>
119-
<version>5.9.2</version>
119+
<version>5.11.3</version>
120120
<scope>test</scope>
121121
</dependency>
122122
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
123123
<dependency>
124124
<groupId>org.junit.jupiter</groupId>
125125
<artifactId>junit-jupiter-engine</artifactId>
126-
<version>5.9.2</version>
126+
<version>5.11.3</version>
127127
<scope>test</scope>
128128
</dependency>
129129
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-migrationsupport -->
130130
<dependency>
131131
<groupId>org.junit.jupiter</groupId>
132132
<artifactId>junit-jupiter-migrationsupport</artifactId>
133-
<version>5.9.2</version>
133+
<version>5.11.3</version>
134134
<scope>test</scope>
135135
</dependency>
136136
<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-params -->
137137
<dependency>
138138
<groupId>org.junit.jupiter</groupId>
139139
<artifactId>junit-jupiter-params</artifactId>
140-
<version>5.9.2</version>
140+
<version>5.11.3</version>
141141
<scope>test</scope>
142142
</dependency>
143143
<!-- https://mvnrepository.com/artifact/javax.vecmath/vecmath -->
@@ -162,31 +162,31 @@
162162
<dependency>
163163
<groupId>org.springframework</groupId>
164164
<artifactId>spring-core</artifactId>
165-
<version>6.0.8</version>
165+
<version>6.1.14</version>
166166
</dependency>
167167
<!-- https://mvnrepository.com/artifact/com.github.dpaukov/combinatoricslib3 -->
168168
<dependency>
169169
<groupId>com.github.dpaukov</groupId>
170170
<artifactId>combinatoricslib3</artifactId>
171-
<version>3.3.3</version>
171+
<version>3.4.0</version>
172172
</dependency>
173173
<!-- https://mvnrepository.com/artifact/org.biojava/biojava-core -->
174174
<dependency>
175175
<groupId>org.biojava</groupId>
176176
<artifactId>biojava-core</artifactId>
177-
<version>7.0.1</version>
177+
<version>7.1.3</version>
178178
</dependency>
179179
<!-- https://mvnrepository.com/artifact/org.biojava/biojava-structure -->
180180
<dependency>
181181
<groupId>org.biojava</groupId>
182182
<artifactId>biojava-structure</artifactId>
183-
<version>7.0.1</version>
183+
<version>7.1.3</version>
184184
</dependency>
185185
<!-- https://mvnrepository.com/artifact/org.apache.xmlgraphics/batik-swing -->
186186
<dependency>
187187
<groupId>org.apache.xmlgraphics</groupId>
188188
<artifactId>batik-swing</artifactId>
189-
<version>1.16</version>
189+
<version>1.18</version>
190190
</dependency>
191191
<!-- https://mvnrepository.com/artifact/net.sf.py4j/py4j -->
192192
<dependency>
@@ -207,7 +207,7 @@
207207
<plugin>
208208
<groupId>org.codehaus.mojo</groupId>
209209
<artifactId>license-maven-plugin</artifactId>
210-
<version>2.0.0</version>
210+
<version>2.4.0</version>
211211
<executions>
212212
<execution>
213213
<phase>compile</phase>

src/main/java/denoptim/constants/DENOPTIMConstants.java

+18
Original file line numberDiff line numberDiff line change
@@ -529,5 +529,23 @@ private static Map<String, Integer> createMap()
529529
* Format for intermediate files used during fragmentation.
530530
*/
531531
public static final FileFormat TMPFRAGFILEFORMAT = FileFormat.VRTXSDF;
532+
533+
/**
534+
* Name of {@link Vertex} property used to record how long a ring-closing
535+
* bridge is.
536+
*/
537+
public static final String VRTPROPBRIDGELENGTH = "VRTPROPBRIDGELENGTH";
538+
539+
/**
540+
* Name of {@link Vertex} property used to record which AP is selected
541+
* for bridge formation on side 'A'
542+
*/
543+
public static final String VRTPROPBRIDGEEND_A = "VRTPROPBRIDGEEND_A";
544+
545+
/**
546+
* Name of {@link Vertex} property used to record which AP is selected
547+
* for bridge formation on side 'B'
548+
*/
549+
public static final String VRTPROPBRIDGEEND_B = "VRTPROPBRIDGEEND_B";
532550

533551
}

src/main/java/denoptim/fitness/FitnessProvider.java

+26-12
Original file line numberDiff line numberDiff line change
@@ -472,16 +472,22 @@ public VariableMapper getVariableMapper()
472472
{
473473
return vm;
474474
}};
475-
ValueExpression ve = expFactory.createValueExpression(ncc, expression,
476-
Double.class);
477-
double fitness = (double) ve.getValue(ncc);
478-
iac.setProperty(DENOPTIMConstants.FITNESSTAG,fitness);
475+
476+
double fitness = Double.NaN;
477+
if (iac.getProperty(DENOPTIMConstants.MOLERRORTAG) == null)
478+
{
479+
ValueExpression ve = expFactory.createValueExpression(ncc, expression,
480+
Double.class);
481+
fitness = (double) ve.getValue(ncc);
482+
iac.setProperty(DENOPTIMConstants.FITNESSTAG,fitness);
483+
}
484+
479485
return fitness;
480486
}
481487

482488
//------------------------------------------------------------------------------
483489

484-
/**
490+
/**
485491
* Takes the value and checks that it is all good, then processes the value
486492
* to extract the result defined by the DescriptorForFitness, puts a
487493
* human-readable version in the molecular representation, and the numerical
@@ -493,16 +499,24 @@ private double processValue(String descName,
493499
IDescriptor implementation,
494500
IImplementationSpecification descSpec, DescriptorValue value,
495501
String varName, IAtomContainer iac) throws Exception
496-
{
497-
if (value == null)
498-
{
499-
throw new Exception("Null value from calcualation of descriptor"
500-
+ " " + descName + " (for variable '" + varName + "'");
501-
}
502+
{
503+
if (value == null)
504+
{
505+
throw new Exception("Null value from calculation of descriptor"
506+
+ " " + descName + " (for variable '" + varName + "'");
507+
}
508+
509+
Exception expFromDescriptor = value.getException();
510+
if (expFromDescriptor != null)
511+
{
512+
// This causes interruption of the experiment
513+
throw new Exception(expFromDescriptor);
514+
}
515+
502516
IDescriptorResult result = value.getValue();
503517
if (result == null)
504518
{
505-
throw new Exception("Null result from calcualation of "
519+
throw new Exception("Null result from calculation of "
506520
+ "descriptor " + descName + "(for variable '"
507521
+ varName + "'");
508522
}

src/main/java/denoptim/fitness/descriptors/SocketProvidedDescriptor.java

+11-3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import com.google.gson.JsonObject;
4242
import com.google.gson.JsonSyntaxException;
4343

44+
import denoptim.constants.DENOPTIMConstants;
4445
import denoptim.fitness.IDenoptimDescriptor;
4546

4647

@@ -311,6 +312,7 @@ public DescriptorValue calculate(IAtomContainer mol)
311312

312313
JsonObject answer = null;
313314
DoubleResult result;
315+
Exception potentialProblem = null;
314316
try {
315317
answer = jsonConverted.fromJson(readerFromSocket.readLine(),
316318
JsonObject.class);
@@ -320,18 +322,23 @@ public DescriptorValue calculate(IAtomContainer mol)
320322
answer.get(KEYJSONMEMBERSCORE).toString());
321323
result = new DoubleResult(value);
322324
} else if (answer.has(KEYJSONMEMBERERR)) {
323-
//System.err.println(KEYJSONMEMBERERR + " from socket server.");
324325
result = new DoubleResult(Double.NaN);
326+
mol.setProperty(DENOPTIMConstants.MOLERRORTAG,
327+
answer.get(KEYJSONMEMBERERR).toString());
325328
} else {
326-
System.err.println("WARNING: Socket server replied without "
329+
System.err.println("ERROR: Socket server replied without "
327330
+ "providing either " + KEYJSONMEMBERSCORE + " or "
328331
+ KEYJSONMEMBERERR + " member. Setting desctriptor "
329332
+ "'" + NAMES[0] + "'to NaN.");
333+
330334
result = new DoubleResult(Double.NaN);
335+
potentialProblem = new Exception(
336+
"Wrong syntax in answer from socket server.");
331337
}
332338
} catch (JsonSyntaxException | IOException e) {
333339
e.printStackTrace();
334340
result = new DoubleResult(Double.NaN);
341+
potentialProblem = e;
335342
}
336343

337344
try
@@ -346,7 +353,8 @@ public DescriptorValue calculate(IAtomContainer mol)
346353
getParameterNames(),
347354
getParameters(),
348355
result,
349-
getDescriptorNames());
356+
getDescriptorNames(),
357+
potentialProblem);
350358
}
351359

352360
//------------------------------------------------------------------------------

src/main/java/denoptim/fitness/descriptors/TanimotoMolSimilarity.java

+7-2
Original file line numberDiff line numberDiff line change
@@ -173,15 +173,20 @@ public static IFingerprinter makeIFingerprinter(String classShortName)
173173
if (params.length == 0)
174174
{
175175
fp = (IFingerprinter) constructor.newInstance();
176-
} else if (params[0].equals(IChemObjectBuilder.class))
176+
} else if (params.length == 1 && params[0].equals(
177+
IChemObjectBuilder.class))
177178
{
178179
//NB potential source of ambiguity on the builder class
179180
fp = (IFingerprinter) constructor.newInstance(cdkBuilder);
180181
}
182+
// NB: we know there are constuctors that take more, for example
183+
// that of PubchemFingerprinter, but those
184+
// exist to enable backwards compatibility
185+
if (fp!=null)
186+
break;
181187
}
182188
} catch (Throwable t)
183189
{
184-
185190
throw new CDKException("Could not make new instance of '"
186191
+ classShortName + "'.", t);
187192
}

0 commit comments

Comments
 (0)