Closed kozo2 closed 3 years ago
@kozo2, sorry for the delay... could I ask you to try the following?
test = bdbClass.loadRelationalDatabase(to_java("./metabolites_20210109.bridge"))
Looking at the error message, I think it's trying to pass a Python str
to the method, see also https://github.com/scijava/scyjava#available-functions
@egonw I updated https://colab.research.google.com/drive/1hs-yuKl_pOCIkUl5DM4h_Ecyp6rI2cOx?usp=sharing It tries
import scyjava
test = bdbClass.loadRelationalDatabase(scyjava.to_java("./metabolites_20210109.bridge"))
but, there is still the following TypeError
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-12-3d6a271882bf> in <module>()
----> 1 test = bdbClass.loadRelationalDatabase(scyjava.to_java("./metabolites_20210109.bridge"))
2 #test = bdbClass.loadRelationalDatabase("./metabolites_20210109.bridge")
TypeError: No matching overloads found for *static* net.bioclipse.managers.BridgedbManager.loadRelationalDatabase(java.lang.String), options are:
public org.bridgedb.IDMapper net.bioclipse.managers.BridgedbManager.loadRelationalDatabase(java.lang.String) throws net.bioclipse.core.business.BioclipseException
I got some time to look into the notebook more... there was at least a step missing... the bdbClass
should not be used in a static way, but be instantiated around an "Eclipse workspace":
workspaceRoot = "."
bdbClass = jimport("net.bioclipse.managers.BridgedbManager")
bdb = bdbClass(workspaceRoot)
Then, put the BridgeDb database in a project (which will go into that workspace):
!mkdir -p BridgeDb; cd BridgeDb; wget https://ndownloader.figshare.com/files/26001794
!cp 26001794 metabolites_20210109.bridge
Then, the loading would be like this:
test = bdb.loadRelationalDatabase("/BridgeDb/metabolites_20210109.bridge")
But then I still run into a problem, a missing class. I will look into that next.
I can confirm this dependency is indeed not given. Fixing this now.
Okay, the method actually doesn't use the workspace approach :/
So, this is the code that works for me now:
from scyjava import config, jimport
config.add_endpoints('io.github.egonw.bacting:managers-bridgedb:0.0.23-SNAPSHOT')
workspaceRoot = "."
bdbClass = jimport("net.bioclipse.managers.BridgedbManager")
bdb = bdbClass(workspaceRoot)
test = bdb.loadRelationalDatabase("./Test/complexes_20200510.bridge")
I will try to release 0.0.23 today.
Bacting 0.0.23 is released which includes this fix.
@egonw Thanks. I updated https://colab.research.google.com/drive/1hs-yuKl_pOCIkUl5DM4h_Ecyp6rI2cOx?usp=sharing . It works well.
Bacting API method with unexpected output
loadRelationalDatabase did not work when importing BridgedbManager with scyjava.
See
Expected Output
Actual Output
Additional context
You can reproduce this with https://colab.research.google.com/drive/1hs-yuKl_pOCIkUl5DM4h_Ecyp6rI2cOx?usp=sharing