Pages

Saturday, April 03, 2021

CDK, OPSIN, BridgeDb in Python 3.7 with scyjava and Bacting


Sometimes you just have to ask the right question. In all the excitement I forgot why I asked specifically this, but I duckducked "use maven central in python" and I ran into scyjava. The documentation was not extensive, but installed was the logical pip install scyjava

And the cool thing is, the Groovy code examples can be converted without big changes.

    from scyjava import config, jimport

    config.add_endpoints(

        'io.github.egonw.bacting:managers-cdk:0.0.16'

    )

    workspaceRoot = "."

    cdkClass = jimport("net.bioclipse.managers.CDKManager")

    cdk = cdkClass(workspaceRoot)

    print(cdk.fromSMILES("COC"))

The first two instructions are the equivalent of the @Grab in Groovy. The next three instructions are defining the Bacting manager, and the last line shows how to use the Chemistry Development Kit in Python! 

No comments:

Post a Comment