ipb-halle / MetFragR

R package for MetFrag
24 stars 14 forks source link

MetFusionMoNAScore not supported? #18

Closed rhelmus closed 7 years ago

rhelmus commented 7 years ago

Hi Christoph,

Hopefully you're not getting mad for me bothering you again ... :-)

I'm trying to include MoNa scoring (similar to the Spectra Similarity scoring option in the web interface), but it throws an exception (both via R and commandline interface):

2017-02-15 10:32:59 INFO - Fetching candidates from PubChem
2017-02-15 10:33:08 INFO - Got 4 candidate(s)
2017-02-15 10:33:08 INFO - 30 %
2017-02-15 10:33:08 INFO - 50 %
2017-02-15 10:33:08 INFO - 80 %
2017-02-15 10:33:08 INFO - 100 %
2017-02-15 10:33:09 ERROR - MetFusionMoNAScore not known or defined for 88419651
Error running MetFrag process.
java.lang.NullPointerException
    at de.ipbhalle.metfraglib.list.SortedScoredCandidateList.addElement(SortedScoredCandidateList.java:12)
    at de.ipbhalle.metfraglib.candidatefilter.PostProcessingCandidateInChIKeyFilter.filter(PostProcessingCandidateInChIKeyFilter.java:25)
    at de.ipbhalle.metfraglib.collection.PostProcessingCandidateFilterCollection.filter(PostProcessingCandidateFilterCollection.java:18)
    at de.ipbhalle.metfraglib.process.CombinedMetFragProcess.run(CombinedMetFragProcess.java:217)
    at de.ipbhalle.metfrag.r.MetfRag.runMetFrag(MetfRag.java:132)

This is the result from the example with the MetFusionMoNAScore scoring set in MetFragScoreTypes.

Regards, Rick

c-ruttkies commented 7 years ago

Hi Rick, no problem. I am happy you are reporting these issues. This might be fixed with the last update to version 2.4.2. I recommend using the offline version of the MetFusion score which uses a local spectral library originating from MoNA. Should be quite up-to-date.

Just add to the settings object additional values like:

settings[["MetFragScoreTypes"]]<-c("FragmenterScore", "OfflineMetFusionScore")
settings[["MetFragScoreWeights"]]<-c(1.0, 1.0)

The offline MetFusion score is quite faster than the online version. Please close this issue if you are fine with it.

Best regards, Christoph

rhelmus commented 7 years ago

Thanks for the prompt changes! It seems to work fine now.

By coincidence I first tested with only the OfflineMetFusionScore enabled and then it threw a NullPointerException. Then I tried it with c("PubChemNumberPubMedReferences", "OfflineMetFusionScore") and it also crashed, so the metfusion score seems dependent on FragmenterScore. In any case, not an issue for me and I guess in general as you usually want this score.

I will close the report as the small bug is a bit unrelated anyway.