Skip to content

Commit 171ccb8

Browse files
committed
additional java tests
1 parent d38ff15 commit 171ccb8

File tree

4 files changed

+41
-5
lines changed

4 files changed

+41
-5
lines changed

README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,20 @@ Run the Java image like this:
8484

8585
The CLASSPATH environment variable is already defined to include the RDKit library.
8686
You'll need to add your own classes and/or libraries to the CLASSPATH.
87-
To do a simple test with the java image using a simple Java class that can be found in the java_src directory:
87+
To do a simple test with the java image using simple Java classes that can be found in the java_src directory first compile
88+
the classes like this:
8889
```
89-
docker run -it --rm -v $PWD/java_src:/example:Z -u root informaticsmatters/rdkit-java-debian:<tag_name> sh -c 'cd /example && ./run.sh'
90-
RDKit version: 2018.03.1.dev1
90+
$ docker run -it --rm -v $PWD/java_src:/example:Z informaticsmatters/rdkit-build-debian:<tag_name> sh -c 'cd /example && ./compile.sh'
91+
```
92+
Then run like this:
93+
```
94+
$ docker run -it --rm -v $PWD/java_src:/example:Z informaticsmatters/rdkit-java-debian:<tag_name> sh -c 'cd /example && ./run.sh'
95+
RDKit version: 2020.09.3
9196
Read smiles: c1ccccc1 Number of atoms: 6
92-
RDKit version: 2020.03.1
93-
Mol: org.RDKit.RWMol@77459877
97+
RDKit version: 2020.09.3
98+
Mol: org.RDKit.RWMol@5b2133b1
99+
RDKit version: 2020.09.3
100+
MorganFP: 4294967295
94101
```
95102

96103
Javadocs are built into `/rdkit/Code/JavaWrappers/gmwrapper/doc`. Since the 2019_09 release a `javadocs.tgz` file is created in the

java_src/compile.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
3+
export CLASSPATH=.:$CLASSPATH
4+
5+
javac foo/*.java
6+

java_src/foo/MorganFP.java

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package foo;
2+
3+
import org.RDKit.*;
4+
5+
public class MorganFP {
6+
7+
public static void main(String[] args) {
8+
9+
System.loadLibrary("GraphMolWrap");
10+
11+
System.out.println("RDKit version: " + RDKFuncs.getRdkitVersion());
12+
13+
String smiles = "Cc1ccccc1";
14+
RWMol m = RWMol.MolFromSmiles(smiles);
15+
16+
17+
SparseIntVectu32 fp = RDKFuncs.MorganFingerprintMol(m, 2);
18+
19+
System.out.println("MorganFP: " + fp.size());
20+
}
21+
}

java_src/run.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@ export CLASSPATH=.:$CLASSPATH
55
java foo/Example1
66

77
java foo/Standardize
8+
9+
java foo/MorganFP

0 commit comments

Comments
 (0)