Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MetFragR - Java Error #160

Open
viictoriaeriksson opened this issue Nov 4, 2024 · 5 comments
Open

MetFragR - Java Error #160

viictoriaeriksson opened this issue Nov 4, 2024 · 5 comments

Comments

@viictoriaeriksson
Copy link

Hi,
I am trying to use the metfrag in by following the example provided by creating the "settingsObject" and use it in the run.metfrag(settingsObject). However, I never get any results from it, only gives a data frame with 0 columns/rows (but does not give any Errors). This happens both when I tried the example of a settingsObject and when I have tried to use my own input in the settingsObject.
Do you know what could be the cause for this?

Further, I have tried to use the "frag.generateMatchingFragments"-function such as:
smiles <- "CC(C(=O)C1=CC(=CC=C1)Cl)NC"
molecule<-parse.smiles(smiles)[[1]]
mzs <- c(144.080571, 145.088167, 180.057363, 182.05468)
matching.fragments<-frag.generateMatchingFragments(molecule, mzs, 197.060742, mzabs = 0.01, mzppm = 10.0, posCharge = TRUE, ionMode = 1, treeDepth = 2)

And here I obtain the error " Error in .jcall(obj, "[Lorg/openscience/cdk/interfaces/IAtomContainer;", :
java.lang.NoSuchMethodError: 'net.sf.jniinchi.INCHI_RET net.sf.jniinchi.INCHI_RET.getValue(int)' "

Therefore, I think that why also run.metfrag does not give any results, could be due to java-problem.
Have you encountered this Error before, and do you know how to solve it?

Thanks in advance!

@sneumann
Copy link
Member

sneumann commented Nov 5, 2024

Hi, I haven't encountered this specific error before. Looks like net.sf.jniinchi.* is unavailable.
This could have to do with the rCDK installation, which also needs the InChI stuff with it.
What is your sessionInfo() ?
When trying metfRagR just now, I also had installation problems in other places having to do with Java, so there is indeed something not working, possibly in relation with newer rCDK packages.
Yours, Steffen

@sneumann
Copy link
Member

sneumann commented Nov 5, 2024

Correction, I got your example to work here.
I did have to change two places where the JAR file is loaded.
Fixed in ec1133a
Can you give it a try and report back ?
Yours,
Steffen

> library(metfRag)
Loading required package: rJava
Loading required package: rcdk
Loading required package: rcdklibs
Loading required package: rjson
> smiles <- "CC(C(=O)C1=CC(=CC=C1)Cl)NC"
molecule<-parse.smiles(smiles)[[1]]
mzs <- c(144.080571, 145.088167, 180.057363, 182.05468)
matching.fragments<-frag.generateMatchingFragments(molecule, mzs, 197.060742, mzabs = 0.01, mzppm = 10.0, posCharge = TRUE, ionMode = 1, treeDepth = 2)

11:11:56.407 INFO  de.ipbhalle.metfraglib.process.CombinedMetFragProcess - Got 1 candidate(s)
11:11:56.465 INFO  de.ipbhalle.metfraglib.process.ProcessingStatus - 100 %
11:11:57.410 INFO  de.ipbhalle.metfraglib.process.CombinedMetFragProcess - 0 candidate(s) were discarded before processing due to pre-filtering
11:11:57.411 INFO  de.ipbhalle.metfraglib.process.CombinedMetFragProcess - 0 candidate(s) discarded during processing due to errors
11:11:57.411 INFO  de.ipbhalle.metfraglib.process.CombinedMetFragProcess - 0 candidate(s) discarded after processing due to post-filtering
11:11:57.412 INFO  de.ipbhalle.metfraglib.process.CombinedMetFragProcess - Stored 1 candidate(s)
> sessionInfo()
R version 4.3.3 (2024-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 24.04.1 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.12.0 
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.0

locale:
 [1] LC_CTYPE=en_US.UTF-8          LC_NUMERIC=C                 
 [3] LC_TIME=en_US.UTF-8           LC_COLLATE=en_US.UTF-8       
 [5] LC_MONETARY=en_US.UTF-8       LC_MESSAGES=en_US.UTF-8      
 [7] LC_PAPER=en_US.UTF-8          LC_NAME=en_US.UTF-8          
 [9] LC_ADDRESS=en_US.UTF-8        LC_TELEPHONE=en_US.UTF-8     
[11] LC_MEASUREMENT=en_US.UTF-8    LC_IDENTIFICATION=en_US.UTF-8

time zone: Europe/Berlin
tzcode source: system (glibc)

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] metfRag_2.5.0 rjson_0.2.23  rcdk_3.8.1    rcdklibs_2.9  rJava_1.0-11 

loaded via a namespace (and not attached):
[1] compiler_4.3.3    squash_1.0.9      tools_4.3.3       parallel_4.3.3   
[5] fingerprint_3.5.7 iterators_1.0.14  itertools_0.1-3   png_0.1-8       

@viictoriaeriksson
Copy link
Author

Hi,
Thank you for your reply!

I still get the same error. Here are my sessionInfo.

`Loading required package: rJava

library(metfRag)
Loading required package: rcdk
Loading required package: rcdklibs
Loading required package: rjson
Loading required package: fingerprint
smiles <- "CC(C(=O)C1=CC(=CC=C1)Cl)NC"
molecule<-parse.smiles(smiles)[[1]]
mzs <- c(144.080571, 145.088167, 180.057363, 182.05468)
matching.fragments<-frag.generateMatchingFragments(molecule, mzs, 197.060742, mzabs = 0.01, mzppm = 10.0, posCharge = TRUE, ionMode = 1, treeDepth = 2)
Error in .jcall(obj, "[Lorg/openscience/cdk/interfaces/IAtomContainer;", :
java.lang.NoSuchMethodError: 'net.sf.jniinchi.INCHI_RET net.sf.jniinchi.INCHI_RET.getValue(int)'
sessionInfo()
R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26100)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.utf8
[2] LC_CTYPE=English_United Kingdom.utf8
[3] LC_MONETARY=English_United Kingdom.utf8
[4] LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.utf8

time zone: Europe/Stockholm
tzcode source: internal

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] metfRag_2.4.2 fingerprint_3.5.7 rjson_0.2.23 rcdk_3.8.1
[5] rcdklibs_2.9 rJava_1.0-11

loaded via a namespace (and not attached):
[1] compiler_4.4.1 squash_1.0.9 parallel_4.4.1 tools_4.4.1
[5] rstudioapi_0.17.1 iterators_1.0.14 itertools_0.1-3 png_0.1-8 `

@sneumann
Copy link
Member

sneumann commented Nov 6, 2024

Hm, so we need to check how you install, and what metfrag.jar and CDK.jar are used.
We have the same rcdk_3.8.1 rcdklibs_2.9 rJava_1.0-11. Good.
You have an older metfRag_2.4.2, can you install the most recent metfRag with my fix ?
You checkout or download the ZIP for MetFragRelaunched, and should be able to install
from within https://github.com/ipb-halle/MetFragRelaunched/tree/master/MetFragR/rpackage/metfRag
Yours,
Steffen

@viictoriaeriksson
Copy link
Author

Thank you again for your reply!

I thought I had installed the new version, but noticed that it was not the case.
Now when I tried the newer version, I do not get the Error anymore. However, instead, I get a new Error:
"Error in frag.generateMatchingFragments(molecule, mzs, 197.060742, mzabs = 0.01, :
java.lang.ClassNotFoundException"

`Loading required package: rJava

library(metfRag)
Loading required package: rcdk
Loading required package: rcdklibs
Loading required package: rjson
smiles <- "CC(C(=O)C1=CC(=CC=C1)Cl)NC"
molecule<-parse.smiles(smiles)[[1]]
mzs <- c(144.080571, 145.088167, 180.057363, 182.05468)
matching.fragments<-frag.generateMatchingFragments(molecule, mzs, 197.060742, mzabs = 0.01, mzppm = 10.0, posCharge = TRUE, ionMode = 1, treeDepth = 2)
Error in frag.generateMatchingFragments(molecule, mzs, 197.060742, mzabs = 0.01, :
java.lang.ClassNotFoundException
sessionInfo()
R version 4.4.1 (2024-06-14 ucrt)
Platform: x86_64-w64-mingw32/x64
Running under: Windows 11 x64 (build 26100)

Matrix products: default

locale:
[1] LC_COLLATE=English_United Kingdom.utf8 LC_CTYPE=English_United Kingdom.utf8 LC_MONETARY=English_United Kingdom.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.utf8

time zone: Europe/Stockholm
tzcode source: internal

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] metfRag_2.5.0 rjson_0.2.23 rcdk_3.8.1 rcdklibs_2.9 rJava_1.0-11

loaded via a namespace (and not attached):
[1] compiler_4.4.1 squash_1.0.9 parallel_4.4.1 fingerprint_3.5.7 tools_4.4.1 rstudioapi_0.17.1 iterators_1.0.14 itertools_0.1-3 png_0.1-8`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants