BioPAX / paxtoolsr

The package provides a set of R functions for interacting with BioPAX OWL files using Paxtools and the querying Pathway Commons (PC) molecular interaction database
https://bioconductor.org/packages/release/bioc/html/paxtoolsr.html
10 stars 1 forks source link

Error with toSBGN() function #10

Open CharlineJnnt opened 4 weeks ago

CharlineJnnt commented 4 weeks ago

Hi,

I have tried using the toSBGN() function to convert a BioPAX file into a SBGN representation, but I get the following error when I use it with your example data:

outFile <- tempfile()
results <- toSBGN(system.file("extdata", "biopax3-short-metabolic-pathway.owl", 
                              package="paxtoolsr"), outFile)

Erreur dans toSBGN(system.file("extdata", "biopax3-short-metabolic-pathway.owl",  : 
  java.lang.NoClassDefFoundError: Could not initialize class com.sun.xml.bind.v2.runtime.reflect.opt.Injector

Could you help, please ?

cannin commented 3 weeks ago

Can you tell me the R, Java, paxtoolsr, and OS versions you're using?

As a stopgap, paxtoolsr wraps the Java-based paxtools, so you can just get the paxtools JAR (https://sourceforge.net/projects/biopax/files//paxtools/) and run it with Java.

# Sample file from https://github.com/BioPAX/paxtoolsr/blob/master/inst/extdata/dna_replication.owl
# Also works with biopax3-short-metabolic-pathway.owl
java -jar paxtools-5.2.2.jar toSBGN dna_replication.owl output.sbgn 

I verified that output.sbgn works by viewing with Newt: https://web.newteditor.org/#

Even with the stopgap solution, I had issues with other Temurin Java versions besides 8 LTS (specifically newer versions for Mac OS aarch64) downloaded from: https://adoptium.net/temurin/releases/?version=8 (tested with Temurin 8.0.432+6 on Mac OS 14.3)

Your issues might be some incompatibility between your Java version and what paxtools requires; updating paxtools to work with newer Java versions is a separate task. In my testing, it might be that I need to upgrade to paxtools-5.2.2.jar, even with Java 8 but I want to know more about specific issue.

CharlineJnnt commented 3 weeks ago

Here are the versions of the softwares/libraries installed on my computer (Windows 10, 22H2):

I haven't changed anything but when I run the command line again, the start seems to work but stops with the same type of error as the first time:

outFile <- tempfile()
results <- toSBGN(system.file("extdata", "biopax3-short-metabolic-pathway.owl",  package="paxtoolsr"), outFile)

SBGN-PD Layout is running...
success ratio: 0.7857142857142857
enhanced ratio: 0.7857142857142857
Total execution time: 182 miliseconds.

Erreur dans toSBGN(system.file("extdata", "biopax3-short-metabolic-pathway.owl",  : 
  java.lang.ExceptionInInitializerError

As you said, it is probably an incompatibility between Java version and paxtoolsr requirements.

I have tried to use the java command with the paxtools JAR but this returned also a error:

java -jar paxtools-4.3.1.jar toSBGN dna_replication.owl output.sbgn

Exception in thread "main" java.lang.IllegalArgumentException: No enum constant org.biopax.paxtools.PaxtoolsMain.Command.toSBGN
        at java.base/java.lang.Enum.valueOf(Enum.java:293)
        at org.biopax.paxtools.PaxtoolsMain$Command.valueOf(PaxtoolsMain.java:683)
        at org.biopax.paxtools.PaxtoolsMain.main(PaxtoolsMain.java:45)

and with the last update:

java -jar paxtools-5.2.2.jar toSBGN dna_replication.owl output.sbgn

#logback.classic pattern: %d %-5level [%thread] %logger{25} - %msg%n
Exception in thread "main" java.lang.ExceptionInInitializerError
        at com.sun.xml.bind.v2.runtime.reflect.opt.AccessorInjector.prepare(AccessorInjector.java:83)
        at com.sun.xml.bind.v2.runtime.reflect.opt.OptimizedAccessorFactory.get(OptimizedAccessorFactory.java:176)
        at com.sun.xml.bind.v2.runtime.reflect.Accessor$FieldReflection.optimize(Accessor.java:282)
        at com.sun.xml.bind.v2.runtime.property.SingleElementNodeProperty.<init>(SingleElementNodeProperty.java:94)
        at java.base/jdk.internal.reflect.DirectConstructorHandleAccessor.newInstance(DirectConstructorHandleAccessor.java:62)
        at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:502)
        at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:486)
        at com.sun.xml.bind.v2.runtime.property.PropertyFactory.create(PropertyFactory.java:128)
        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:181)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
        at com.sun.xml.bind.v2.runtime.ClassBeanInfoImpl.<init>(ClassBeanInfoImpl.java:168)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.getOrCreate(JAXBContextImpl.java:509)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:326)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:141)
        at com.sun.xml.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1157)
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:145)
        at com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:236)
        at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:143)
        at javax.xml.bind.ContextFinder.find(ContextFinder.java:297)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:412)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:375)
        at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:279)
        at org.sbgn.SbgnUtil.writeToFile(SbgnUtil.java:95)
        at org.biopax.paxtools.io.sbgn.L3ToSBGNPDConverter.writeSBGN(L3ToSBGNPDConverter.java:230)
        at org.biopax.paxtools.PaxtoolsMain.toSbgn(PaxtoolsMain.java:302)
        at org.biopax.paxtools.Main$Command$3.run(Main.java:65)
        at org.biopax.paxtools.Main.main(Main.java:22)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @291caca8
        at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:391)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:367)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:315)
        at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:203)
        at java.base/java.lang.reflect.Method.setAccessible(Method.java:197)
        at com.sun.xml.bind.v2.runtime.reflect.opt.Injector$1.run(Injector.java:177)
        at com.sun.xml.bind.v2.runtime.reflect.opt.Injector$1.run(Injector.java:174)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
        at com.sun.xml.bind.v2.runtime.reflect.opt.Injector.<clinit>(Injector.java:172)
        ... 29 more
cannin commented 2 weeks ago

I just tried on a x86 virtual machine with a clean install of Windows with only Java 8 412 installed and paxtools 5.2.2. The toSBGN command worked on the dna_replication.owl

java -jar paxtools-5.2.2.jar toSBGN dna_replication.owl output.sbgn

Immediately before running the java -jar ... command can you run java -version maybe you are not using the Java version you think you are. Some of the other errors you mention look like things I've encountered with other non-8 Java versions.

CharlineJnnt commented 2 weeks ago

When I am running the java -version command, I get this:

openjdk version "21.0.2" 2024-01-16 LTS
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode, sharing)

and I do not know if this version of JDK is compatible with paxtoolsr...