Re: [Cdk-user] Smarts cast exception

2019-11-08 Thread John Mayfield
No problem,

So essentially there are "molecules" and  "queries". Molecules are things,
queries match things. We can convert a molecule to a query by telling it
what things we want to match.

John

On Fri, 8 Nov 2019 at 09:27, Stesycki, Manuel 
wrote:

> Ok i looked up the Test class and did the following:
>
> public static String createSMARTS(AtomContainer ac) {
>
> String ret;
>
> try {
>
> QueryAtomContainer qac = QueryAtomContainer.create(ac,
> Expr.Type.ALIPHATIC_ELEMENT,
> Expr.Type.AROMATIC_ELEMENT,
> Expr.Type.SINGLE_OR_AROMATIC,
> Expr.Type.ALIPHATIC_ORDER,
> Expr.Type.ISOTOPE,
> Expr.Type.RING_BOND_COUNT
> );
>
> ret = Smarts.generate(qac);
>
> } catch (Exception e) {
> ret = "";
> }
>
> return ret;
> }
>
> This works for me.
>
> Sorry to bother you,
>Manuel Stesycki
>
> IT
>0208 / 306-2146
>Physikbau, Büro 117
>stesy...@mpi-muelheim.mpg.de
>
> Max-Planck-Institut für Kohlenforschung
>Kaiser-Wilhelm-Platz 1
>D-45470 Mülheim an der Ruhr
>http://www.kofo.mpg.de/de
>
> Am 07.11.2019 um 14:34 schrieb Stesycki, Manuel <
> stesy...@mpi-muelheim.mpg.de>:
>
> Dear all,
>
> i am trying to create SMARTS-Pattern for a structure.
> The structure is an AtomContainer and read from an MDL file.
> If i try to call Smarts.generate( AtomContainer )
> i get this error message:
>
> java.lang.ClassCastException: org.openscience.cdk.Bond cannot be cast to
> org.openscience.cdk.isomorphism.matchers.QueryBond
>
> Has anyone a clue, where my mistake is?
>
> Many thanks,
>Manuel Stesycki
>
> IT
>0208 / 306-2146
>Physikbau, Büro 117
>stesy...@mpi-muelheim.mpg.de
>
> Max-Planck-Institut für Kohlenforschung
>Kaiser-Wilhelm-Platz 1
>D-45470 Mülheim an der Ruhr
>http://www.kofo.mpg.de/de
>
>
> ___
> Cdk-user mailing list
> Cdk-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/cdk-user
>
___
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user


Re: [Cdk-user] Smarts cast exception

2019-11-08 Thread Stesycki, Manuel
Ok i looked up the Test class and did the following:

public static String createSMARTS(AtomContainer ac) {

String ret;

try {

QueryAtomContainer qac = QueryAtomContainer.create(ac, 
Expr.Type.ALIPHATIC_ELEMENT,
Expr.Type.AROMATIC_ELEMENT,
Expr.Type.SINGLE_OR_AROMATIC,
Expr.Type.ALIPHATIC_ORDER,
Expr.Type.ISOTOPE,
Expr.Type.RING_BOND_COUNT
);

ret = Smarts.generate(qac);

} catch (Exception e) {
ret = "";
}

return ret;
}

This works for me.

Sorry to bother you,
   Manuel Stesycki

IT
   0208 / 306-2146
   Physikbau, Büro 117
   stesy...@mpi-muelheim.mpg.de

Max-Planck-Institut für Kohlenforschung
   Kaiser-Wilhelm-Platz 1
   D-45470 Mülheim an der Ruhr
   http://www.kofo.mpg.de/de

Am 07.11.2019 um 14:34 schrieb Stesycki, Manuel 
mailto:stesy...@mpi-muelheim.mpg.de>>:

Dear all,

i am trying to create SMARTS-Pattern for a structure.
The structure is an AtomContainer and read from an MDL file.
If i try to call Smarts.generate( AtomContainer )
i get this error message:

java.lang.ClassCastException: org.openscience.cdk.Bond cannot be cast to 
org.openscience.cdk.isomorphism.matchers.QueryBond

Has anyone a clue, where my mistake is?

Many thanks,
   Manuel Stesycki

IT
   0208 / 306-2146
   Physikbau, Büro 117
   stesy...@mpi-muelheim.mpg.de

Max-Planck-Institut für Kohlenforschung
   Kaiser-Wilhelm-Platz 1
   D-45470 Mülheim an der Ruhr
   http://www.kofo.mpg.de/de


___
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user