Closed kozo2 closed 3 years ago
Okay, I think this one is a bit more complicated. The same str/String issue likely, but not sure that it's the only thing to solve here. I also think both need a ScyJava example in the documentation, somewhere.
I ported the method you need, which will be part of the next release:
from scyjava import config, jimport
config.add_endpoints('io.github.egonw.bacting:managers-cdk:0.0.24')
workspaceRoot = "."
cdkClass = jimport("net.bioclipse.managers.CDKManager")
cdk = cdkClass(workspaceRoot)
heptane = cdk.loadMolecule("/Test/heptane.mol")
print(heptane)
I am going to release 0.0.24 now.
done.
@egonw Thanks.
However, there seems to be a problem with the handling of the loadMolecule
argument file PATH string.
You can check it with https://colab.research.google.com/drive/1RwXBVgClncDwascTbhhsFkuzPmgFl6ar?usp=sharing
from scyjava import config, jimport
config.add_endpoints('io.github.egonw.bacting:managers-cdk:0.0.24')
workspaceRoot = "."
cdkClass = jimport("net.bioclipse.managers.CDKManager")
cdk = cdkClass(workspaceRoot)
# kegg_sdf = cdk.loadMolecule("./kegg.sdf") #this does not work
# kegg_sdf = cdk.loadMolecule("/content/kegg.sdf") #this also does not work
kegg_sdf = cdk.loadMolecule("/kegg.sdf") # this works but is not appropriate
Yes, this is a bit of Bioclipse legacy (which inherits it from Eclipse)... everything is in a Project in the workspace. On disk this is just a folder.
So, your workspaceRoot = ".". In that folder make a subfolder "KEGG" and copy the kegg.sdf
file into that folder. Then:
kegg_sdf = cdk.loadMolecule("/KEGG/kegg.sdf")
Thank you for the information. I understand why you always put files under a certain directory.
Bacting API method with unexpected output
loadMolecule did not work when importing CDKManager with scyjava.
Expected Output
Actual Output
Additional context
You can reproduce the error with https://colab.research.google.com/drive/1RwXBVgClncDwascTbhhsFkuzPmgFl6ar?usp=sharing