ipb-halle / MetFragR

R package for MetFrag
24 stars 14 forks source link

Can't connect to any database #16

Closed rhelmus closed 7 years ago

rhelmus commented 7 years ago

Hi,

Just started to mess around with the R interface to MetFrag. Unfortunately, however, running the example from the project page (http://c-ruttkies.github.io/MetFrag/projects/metfragr/) gives me the following error:

4474990 [main] INFO de.ipbhalle.metfraglib.database.OnlinePubChemDatabase - Fetching candidates from PubChem Error: Could not open URL connection! http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/50465,57010914,56974741,88419651,23354334/property/inchi,XLogP,InChIKey,MolecularFormula,IsotopeAtomCount,IsomericSMILES,MonoisotopicMass/CSV Error retrieving candidates java.lang.Exception at de.ipbhalle.metfraglib.functions.HelperFunctions.getInputStreamFromURL(HelperFunctions.java:66) at de.ipbhalle.metfraglib.database.OnlinePubChemDatabase.savingRetrievedHits(OnlinePubChemDatabase.java:281) at de.ipbhalle.metfraglib.database.OnlinePubChemDatabase.getCandidateIdentifiers(OnlinePubChemDatabase.java:178) at de.ipbhalle.metfraglib.database.OnlinePubChemDatabase.getCandidateIdentifiers(OnlinePubChemDatabase.java:57) at de.ipbhalle.metfraglib.process.CombinedMetFragProcess.retrieveCompounds(CombinedMetFragProcess.java:77) at de.ipbhalle.metfrag.r.MetfRag.runMetFrag(MetfRag.java:123)

I've also tried it with KEGG: 4948608 [main] ERROR de.ipbhalle.metfraglib.database.OnlineKeggDatabase - Error: Could not open URL connection! http://rest.kegg.jp/get/50465/mol java.io.IOException: Server returned HTTP response code: 400 for URL: http://rest.kegg.jp/get/50465/mol at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1876) at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1474) at de.ipbhalle.metfraglib.database.OnlineKeggDatabase.getInputStreamFromURL(OnlineKeggDatabase.java:243) at de.ipbhalle.metfraglib.database.OnlineKeggDatabase.getCandidateByIdentifier(OnlineKeggDatabase.java:112) at de.ipbhalle.metfraglib.database.OnlineKeggDatabase.getCandidateByIdentifier(OnlineKeggDatabase.java:210) at de.ipbhalle.metfraglib.process.CombinedMetFragProcess.retrieveCompounds(CombinedMetFragProcess.java:85) at de.ipbhalle.metfrag.r.MetfRag.runMetFrag(MetfRag.java:123) Error retrieving candidates java.lang.Exception at de.ipbhalle.metfraglib.database.OnlineKeggDatabase.getInputStreamFromURL(OnlineKeggDatabase.java:250) at de.ipbhalle.metfraglib.database.OnlineKeggDatabase.getCandidateByIdentifier(OnlineKeggDatabase.java:112) at de.ipbhalle.metfraglib.database.OnlineKeggDatabase.getCandidateByIdentifier(OnlineKeggDatabase.java:210) at de.ipbhalle.metfraglib.process.CombinedMetFragProcess.retrieveCompounds(CombinedMetFragProcess.java:85) at de.ipbhalle.metfrag.r.MetfRag.runMetFrag(MetfRag.java:123)

Trying to use ChemSpider results in a timeout.

Some more hints:

Cheers and happy Christmas :-)

c-ruttkies commented 7 years ago

Hi,

thanks for reporting this issue.

I have updated the jar file with the adapted PubChem query links. The http support was stopped recently which hasn't been fixed in the R package so far.

KEGG and ChemSpider are actually working. In the example the candidate search is performed by setting database identifiers:

settingsObject[["PrecursorCompoundIDs"]]<-c("50465", "57010914", "56974741", "88419651", "23354334")

These identifiers are PubChem specific and that's why KEGG and ChemSpider fail. Just set

settingsObject[["PrecursorCompoundIDs"]]<-NULL

when you change the database. Keep in mind that you have to set the ChemSpider token, when using ChemSpider as database:

settingsObject[["ChemSpiderToken"]]<-"..."

This need to be a service subscriber token.

Best regards and merry christmas, Christoph

rhelmus commented 7 years ago

Thanks for the very quick reply!

Everything seems to work now. And good thing you spotted that I forgot remove the IDs before testing the other databases :-)