rickhelmus / patRoon

Workflow solutions for mass-spectrometry based non-target analysis.
https://rickhelmus.github.io/patRoon/
GNU General Public License v3.0
58 stars 17 forks source link

error with generateCompounds( ) - could not run MetFrag #106

Closed Theodoralee03 closed 3 months ago

Theodoralee03 commented 3 months ago

Hi everyone,

I am currently facing issues with the generateCompounds( )function. I am able to run both my own dataset, as well as the tutorial dataset all the way to generateMSpeakLists()and generateFormulas() with no issues. Feature groups are recognized in my fGroups (e.g. 488 features groups for the tutorial dataset), however, I repeatedly get this error while running the generateCompounds (), in which I will obtain 0 compounds from 0 feature groups (0.00%). the warnings indicate that restarting failed MetFrag command, and it could not run MetFrag.

 compounds <- generateCompounds(fGroups, mslists, "metfrag", dbRelMzDev = 5, fragRelMzDev = 5, fragAbsMzDev = 0.002,
+                                adduct = "[M+H]+", database = "pubchem",
+                                maxCandidatesToStop = 2500)
Identifying 488 feature groups with MetFrag...
Converting to algorithm specific adducts... Done!
  |=========================================================================================================================================| 100%
Loaded 0 compounds from 0 features (0.00%).
There were 50 or more warnings (use warnings() to see the first 50)
> warnings()
Warning messages:
1: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M109_R192_157 - exit: 1 (retry 1/2)
2: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M115_R196_218 - exit: 1 (retry 1/2)
3: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M116_R316_229 - exit: 1 (retry 1/2)
4: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M120_R268_288 - exit: 1 (retry 1/2)
5: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M109_R192_157 - exit: 1 (retry 2/2)
6: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M115_R196_218 - exit: 1 (retry 2/2)
7: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M116_R316_229 - exit: 1 (retry 2/2)
8: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M120_R268_288 - exit: 1 (retry 2/2)
9: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M109_R192_157 - exit code: 1 - Log: log/metfrag/mfcl-M109_R192_157.txt
10: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M115_R196_218 - exit code: 1 - Log: log/metfrag/mfcl-M115_R196_218.txt
11: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M116_R316_229 - exit code: 1 - Log: log/metfrag/mfcl-M116_R316_229.txt
12: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M120_R268_288 - exit code: 1 - Log: log/metfrag/mfcl-M120_R268_288.txt
13: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M134_R301_482 - exit: 1 (retry 1/2)
14: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M135_R252_506 - exit: 1 (retry 1/2)
15: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M137_R249_531 - exit: 1 (retry 1/2)
16: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M141_R216_591 - exit: 1 (retry 1/2)
17: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M134_R301_482 - exit: 1 (retry 2/2)
18: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M135_R252_506 - exit: 1 (retry 2/2)
19: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M137_R249_531 - exit: 1 (retry 2/2)
20: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M141_R216_591 - exit: 1 (retry 2/2)
21: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M134_R301_482 - exit code: 1 - Log: log/metfrag/mfcl-M134_R301_482.txt
22: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M135_R252_506 - exit code: 1 - Log: log/metfrag/mfcl-M135_R252_506.txt
23: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M137_R249_531 - exit code: 1 - Log: log/metfrag/mfcl-M137_R249_531.txt
24: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M141_R216_591 - exit code: 1 - Log: log/metfrag/mfcl-M141_R216_591.txt
25: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M143_R329_633 - exit: 1 (retry 1/2)
26: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M146_R309_673 - exit: 1 (retry 1/2)
27: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M146_R225_675 - exit: 1 (retry 1/2)
28: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M147_R102_694 - exit: 1 (retry 1/2)
29: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M143_R329_633 - exit: 1 (retry 2/2)
30: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M146_R309_673 - exit: 1 (retry 2/2)
31: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M146_R225_675 - exit: 1 (retry 2/2)
32: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M147_R102_694 - exit: 1 (retry 2/2)
33: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M143_R329_633 - exit code: 1 - Log: log/metfrag/mfcl-M143_R329_633.txt
34: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M146_R309_673 - exit code: 1 - Log: log/metfrag/mfcl-M146_R309_673.txt
35: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M146_R225_675 - exit code: 1 - Log: log/metfrag/mfcl-M146_R225_675.txt
36: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M147_R102_694 - exit code: 1 - Log: log/metfrag/mfcl-M147_R102_694.txt
37: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M149_R308_743 - exit: 1 (retry 1/2)
38: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M151_R222_772 - exit: 1 (retry 1/2)
39: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M155_R199_855 - exit: 1 (retry 1/2)
40: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M155_R312_856 - exit: 1 (retry 1/2)
41: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M149_R308_743 - exit: 1 (retry 2/2)
42: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M151_R222_772 - exit: 1 (retry 2/2)
43: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M155_R199_855 - exit: 1 (retry 2/2)
44: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M155_R312_856 - exit: 1 (retry 2/2)
45: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M149_R308_743 - exit code: 1 - Log: log/metfrag/mfcl-M149_R308_743.txt
46: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M151_R222_772 - exit code: 1 - Log: log/metfrag/mfcl-M151_R222_772.txt
47: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M155_R199_855 - exit code: 1 - Log: log/metfrag/mfcl-M155_R199_855.txt
48: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Could not run MetFrag for M155_R312_856 - exit code: 1 - Log: log/metfrag/mfcl-M155_R312_856.txt
49: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M156_R95_886 - exit: 1 (retry 1/2)
50: In errorHandler(cmd = commandQueue[[i]], exitStatus = exitStatus,  ... :
  Restarting failed MetFrag command for M156_R288_895 - exit: 1 (retry 1/2)

I thought it might have to do with the installation of MetFrag; the verifyDependencies( ) result suggest that it was able to locate the files needed for MetFrag to run. I have also installed it manually using options(patRoon.path.MetFragCL = "~/MetFragCommandLine-2.4.8.jar")

> patRoon::verifyDependencies()
Checking ProteoWizard... found! (directory 'C:/Users/Theodora/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/ProteoWizard 3.0.24037 64-bit')
Checking OpenMS... found! (in 'C:/Users/Theodora/AppData/Local/R/win-library/4.2/patRoonExt/ext/openms/bin')
Checking pngquant... found! (in 'C:/Users/Theodora/OneDrive - Nanyang Technological University/PhD One Drive/Non Target Analysis 2024/pngquant-windows/pngquant')
Checking SIRIUS... found! (in 'C:/Users/Theodora/AppData/Local/R/win-library/4.2/patRoonExt/ext/sirius')
Checking MetFrag CL... found! (in 'C:/Users/Theodora/AppData/Local/R/win-library/4.2/patRoonExt/ext')
Checking MetFrag CompTox Database... found! (in 'C:/Users/Theodora/AppData/Local/R/win-library/4.2/patRoonExt/ext')
Checking MetFrag PubChemLite Database... found! (in 'C:/Users/Theodora/AppData/Local/R/win-library/4.2/patRoonExt/ext')
Checking OpenBabel... found! (in 'C:/Users/Theodora/AppData/Local/R/win-library/4.2/patRoonExt/ext/openbabel')
Checking BioTransformer... found! (in 'C:/Users/Theodora/AppData/Local/R/win-library/4.2/patRoonExt/ext/biotransformer')

Can anyone share with me any ideas on how I can resolve this issue or let me know if I had done the installation wrongly? I have also tried installing MetFrag on R manually with install_github("c-ruttkies/MetFragR/metfRag") to ensure all the necessary packages were installed and updated, but unfortunately, this did not help as well.

Another possible reason might be due to my own dataset which is an Agilent all-ion dataset, I am concerned if the formats will be incompatible with this function. Nonetheless, with the patRoon tutorial sample dataset had the same issue, so it is highly likely to do with MetFrag installation on my PC. Please let me know if you have further questions, thank you so much in advance!

LeonSaal commented 3 months ago

Hi,

that is indeed unfortunate. As the MetFrag installation could be verified on two separate ways, I assume it has something to do with the input data for the command. Do the log files (stored under log/metfrag/mfcl-M..._R..._....txt) contain any valuable information?

Kind regards,

Leon

Theodoralee03 commented 3 months ago

Hi Leon,

Thank you for your help!

Here's the information in the log for one of the txt files

command: java
args: -jar C:/Users/Theodora/AppData/Local/R/win-library/4.2/patRoonExt/ext/MetFragCommandLine-2.5.0.jar C:\Users\Theodora\AppData\Local\Temp\RtmpGOxReM\parameters1f8943c5e4a30.txt

---

output:

standard error output:
Exception in thread "main" java.lang.UnsupportedClassVersionError: de/ipbhalle/metfrag/commandline/CommandLineTool has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0

    at java.lang.ClassLoader.defineClass1(Native Method)

    at java.lang.ClassLoader.defineClass(Unknown Source)

    at java.security.SecureClassLoader.defineClass(Unknown Source)

    at java.net.URLClassLoader.defineClass(Unknown Source)

    at java.net.URLClassLoader.access$100(Unknown Source)

    at java.net.URLClassLoader$1.run(Unknown Source)

    at java.net.URLClassLoader$1.run(Unknown Source)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.net.URLClassLoader.findClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)

I realised its a similar issue with https://github.com/rickhelmus/patRoon/issues/91#issue-1952616801 , I'll install a more updated version to try! Thank you so much!

Theodoralee03 commented 3 months ago

Update: It Works!

An example from my dataset

compounds <- generateCompounds(fGroups, mslists, "metfrag", method = "CL",
+                                dbRelMzDev = 5, fragRelMzDev = 5, fragAbsMzDev = 0.002,
+                                adduct = "[M+H]+", database = "pubchemlite", maxCandidatesToStop = 2500)
Identifying 1477 feature groups with MetFrag...
Converting to algorithm specific adducts... Done!
  |====================================================================================================================================================================| 100%
Loaded 66 compounds from 6 features (0.41%).

I downloaded the latest Java version from here https://www.oracle.com/java/technologies/downloads/#jdk21-windows

Thanks Leon for your help!

rickhelmus commented 3 months ago

Great! Thanks @LeonSaal for the assist!