ceabiodb / biodb

An R package framework for accessing biological and chemical databases and developing or extending new connectors.
GNU Affero General Public License v3.0
11 stars 2 forks source link

Bug in the calculation of inchikey while getting MassBank entry. #150

Closed adelabriere closed 6 years ago

adelabriere commented 6 years ago

Infinite recursion sometimes occurs when calling entry <- getEntry("massbank.jp",some_mass_bank_id,drop=TRUE) and when the inchi key is then computed after calling entry$getFieldValue("inchikey"). However it seems quite random and not really dependent of the massbank ID.

I had this bug when calling for more than 100 massbank entries

If I manage to build a reproducible example I will put it online.

The reccuring message look like this :

INFO[2018-01-17 09:52:40][BiodbFactory::.createNewEntries()] : Creating 1 entries from ids 48300 ... INFO[2018-01-17 09:52:40][BiodbFactory::getEntryContent()] : Get chebi entry content(s) for 1 id(s)... INFO[2018-01-17 09:52:40][BiodbFactory::getEntryContent()] : 0 chebi entry content(s) loaded from cache. INFO[2018-01-17 09:52:40][BiodbFactory::getEntryContent()] : 1 entry content(s) need to be fetched from chebi database

... repeated infinitely. It occurs when using it in a sapply function

pkrog commented 6 years ago

Hi Alexis, yes please try to give a code for reproducing it. I'll try to debug it asap.

adelabriere commented 6 years ago

Here is a reproducible example :

nbdb <- biodb:::Biodb$new()
msconn <- nbdb$getFactory()$createConn('massbank.jp')

id_ms <-c('KO002985')

rentry <- nbdb$getFactory()$getEntry("massbank.jp",id_ms,drop=TRUE)
rentry$getFieldValue("inchikey")

Bug does not occur when we use rentry$getFieldValue("inchikey",compute=FALSE)