The Order is a not method of IBond it is an nested class - perhaps the wrappers
can’t represent it but it's pretty common so I doubt that’s the case.
I’m flying blind having only spent about 5 mins in Ruby but either try
> import ‘org.openscience.cdk.interfaces.IBond.Order'
or
> import ‘org.openscience.cdk.interfaces.IBond’
with IBond.Order.SINGLE
J
On 24 Feb 2014, at 21:53, Yannick .Djoumbou <y.djoum...@gmail.com> wrote:
> HI,
>
> I have imported the following classes relative to bonds:
>
> import 'org.openscience.cdk.Bond'
> import 'org.openscience.cdk.interfaces.IBond'
> import 'org.openscience.cdk.interfaces.IBond$Order'
> import 'org.openscience.cdk.interfaces.IBond$Stereo'
>
> When using the command you just mentioned, I still get the following error:
>
> NoMethodError: undefined method `Order' for
> Java::OrgOpenscienceCdkInterfaces::IBond:Module
>
> Cheers,
> Yannick
>
>
> On Mon, Feb 24, 2014 at 2:15 PM, John May <john...@ebi.ac.uk> wrote:
> Sorry, I was going on what you had and presumed ruby was loading Order
> directly. The full name is IBond.Order.SINGLE.
>
>> Bond.new(mol.getAtom(0), mol.getAtom(1), IBond.Order.SINGLE)
>
>
> - John
>
> On 24 Feb 2014, at 21:10, Yannick .Djoumbou <y.djoum...@gmail.com> wrote:
>
>> Thanks for the very quick reply.
>>
>> I actually use the Bond class.
>> I've tried the following options:
>> - bond = Bond.new(mol.getAtom(0), mol.getAtom(1), Order.SINGLE)
>>
>> NoMethodError: undefined method `SINGLE' for
>> Java::OrgOpenscienceCdkInterfaces::Order:Class
>> from (irb):37:in `evaluate'
>> from org/jruby/RubyKernel.java:1121:in `eval'
>> from org/jruby/RubyKernel.java:1517:in `loop'
>> from org/jruby/RubyKernel.java:1282:in `catch'
>> from org/jruby/RubyKernel.java:1282:in `catch'
>>
>> - mol.addBond(0,1,Order.Single)
>>
>> NoMethodError: undefined method `Single' for
>> Java::OrgOpenscienceCdkInterfaces::Order:Class
>> from (irb):38:in `evaluate'
>> from org/jruby/RubyKernel.java:1121:in `eval'
>> from org/jruby/RubyKernel.java:1517:in `loop'
>> from org/jruby/RubyKernel.java:1282:in `catch'
>> from org/jruby/RubyKernel.java:1282:in `catch'
>>
>> I guess it comes from the fact that I am using Jruby. I should normally not
>> have a problem with this. It's kind of confusing. Do you have a hint?
>>
>> Cheers,
>>
>> Yannick
>>
>>
>> On Mon, Feb 24, 2014 at 1:21 PM, John May <john...@ebi.ac.uk> wrote:
>> Hi Yannick,
>>
>> I don’t now about ruby wrappers but can answer 2 and 3. Also looks like rcdk
>> is used for ruby and R bindings which is a little confusing.
>>
>> 2) IBond is an interface you need to use the concrete class. There are a
>> couple of way to do this, you can use Bond concrete class (silent package is
>> best)
>>
>>> Bond.new(mol.getAtom(0), mol.getAtom(1), Order.SINGLE)
>>
>> use a builder -
>>
>>> SilentChemObjectBuilder.getInstance().newInstance(IBond.class,
>>> mol.getAtom(0), mol.getAtom(1), Order.SINGLE)
>>
>>
>> or use the convince method on the molecule -
>>
>>> molcule.addBond(0,1, Order.Single);
>>
>>
>> 3-1) CDKHydrogenAdder is only for implicit hydrogens - you only need this if
>> you have null hydrogen values. For explicit hydrogens use the manipulator.
>>
>>> AtomContainerManipulator.convertImplicitToExplicitHydrogens(mol)
>>
>>
>> 3-2) You have a SMARTS pattern and so need to use the SMARTSQueryTool. I
>> don’t think that will be available in the version you are using. Here’s the
>> java code anyways.
>>
>> SMARTSQueryTool sqt = new SMARTSQueryTool(“[#8]=[#6]”);
>> sqt.matches(mol);
>> for (List<Integer> mapping : sqt.getAllMappings()) {
>> for (int i = 0; i < mapping.size(); i++) {
>> System.out.println(mapping.get(i) + 1);
>> }
>> }
>>
>> Hope that helps,
>> John
>>
>
>
------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user