Skip to content

The parse.inchi() function does not work with the rcdklibs package v2.8 #3

@AndreySamokhin

Description

@AndreySamokhin

I have been using both the rcdk and the rinchi packages in my work. Thank you for creating them. The other day I decided to download the latest version of the rcdklibs package. I encountered a problem. The parse.inchi() function does not work with the rcdklibs package v2.8. This is an example:

mol <- parse.inchi("InChI=1S/C6H6/c1-2-4-6-5-3-1/h1-6H")

#> Error in .jcall("net/sf/jniinchi/INCHI_RET", "Lnet/sf/jniinchi/INCHI_RET;",  : 
#>  method getValue with signature (I)Lnet/sf/jniinchi/INCHI_RET; not found

Session info:

R version 4.2.3 (2023-03-15 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19045)
...
other attached packages:
[1] rinchi_0.5   rcdk_3.7.0   rcdklibs_2.8 rJava_1.0-6 
...

The root of the problem is that the getValue method is not available for the rcdklibs package v2.8:

javap -classpath cdk-jniinchi-support-2.8.jar net/sf/jniinchi/INCHI_RET

Compiled from "INCHI_RET.java"
public final class net.sf.jniinchi.INCHI_RET extends java.lang.Enum<net.sf.jniinchi.INCHI_RET> {
  public static final net.sf.jniinchi.INCHI_RET SKIP;
  public static final net.sf.jniinchi.INCHI_RET EOF;
  public static final net.sf.jniinchi.INCHI_RET OKAY;
  public static final net.sf.jniinchi.INCHI_RET WARNING;
  public static final net.sf.jniinchi.INCHI_RET ERROR;
  public static final net.sf.jniinchi.INCHI_RET FATAL;
  public static final net.sf.jniinchi.INCHI_RET UNKNOWN;
  public static final net.sf.jniinchi.INCHI_RET BUSY;
  public static net.sf.jniinchi.INCHI_RET[] values();
  public static net.sf.jniinchi.INCHI_RET valueOf(java.lang.String);
  static {};
}

This is a kludge that I came up with to overcome the problem.

  1. Comment the first line (i.e., OKAY <- .jcall(...)) in the body of the parse.inchi() function.
  2. Add the following line instead of the commented one: OKAY <- J("net/sf/jniinchi/INCHI_RET")$OKAY.

Anyway, I'm looking forward to getting an official solution from the developers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions