Hey John,
thanks for your replay. I think with your information I can do what I wanted
before even smarter.
Cheers,
Niko
> On 7. Apr 2017, at 21:25, John Mayfield <john.wilkinson...@gmail.com> wrote:
>
> HI Niko,
>
> If getAtomNumber works like an array indexOf and does reference equality. I'm
> a bit confused by your description but I think what your trying to do is find
> a hydroxy in CHEMBL501674? In general you need to find a substructure,
> https://en.wikipedia.org/wiki/Subgraph_isomorphism_problem
> <https://en.wikipedia.org/wiki/Subgraph_isomorphism_problem>. Easiest way to
> do this is with a SMARTS pattern match
> <http://www.daylight.com/dayhtml/doc/theory/theory.smarts.html>.
>
> String smi =
> "CO[C@@H]1[C@H](O)[C@@H](C)O[C@@H](OC[C@@H]2[C@@H](C)OC(=O)\\C=C\\[C@H](C)[C@H](CC[C@@H](C)C(=O)\\C=C\\[C@H]3O[C@@H]23)O[C@@H]4O[C@H](C)C[C@H](O)[C@H]4O)[C@@H]1OC";
> SmilesParser smipar = new
> SmilesParser(SilentChemObjectBuilder.getInstance());
> IAtomContainer target = smipar.parseSmiles(smi);
>
> Pattern ptrn = SmartsPattern.create("*[OH]");
> for (int[] mapping : ptrn.matchAll(target)) {
> IAtom a = target.getAtom(mapping[1]); // 0=*, 1=[OH]
> System.out.println(target.getAtomNumber(a));
> }
>
> 4
> 40
> 42
>
>
> There are indexes so add one to get the num in the depiction, 5, 41, 43: CDK
> Depict
> <https://cdkdepict-openchem.rhcloud.com/depict/bow/png?smi=CO[C@@H]1[C@H](O)[C@@H](C)O[C@@H](OC[C@@H]2[C@@H](C)OC(=O)%5C%5CC=C%5C%5C[C@H](C)[C@H](CC[C@@H](C)C(=O)%5C%5CC=C%5C%5C[C@H]3O[C@@H]23)O[C@@H]4O[C@H](C)C[C@H](O)[C@H]4O)[C@@H]1OC&abbr=on&suppressh=true&showtitle=false&sma=*%5BOH%5D&zoom=1.3&annotate=number>
>
> <image.png>
>
>
> On 7 April 2017 at 17:28, Nikolas Glaser <glase...@gmail.com
> <mailto:glase...@gmail.com>> wrote:
> Hey guys,
> I have a general question to the working of the method getAtomNumber().
> What are the criteria an atom is chosen in the IAtomContainer?
>
> For example I have following test code:
> Created a AtomContainer from following smiles: [Z]O // in this
> case the [Z] is a placeholder for the link position of the fragment in the
> main substance
> So I take the Atom at index position 1 in the Fragment. When I print the
> Symbol it is the O.
>
> Now I want to get the Index in the complete substance and it is sure that O
> is in the substance present. I get the index -1 so I think the method cannot
> find the Atom.
> The complete substance I use for my test is CHEMBL501674.
> If I do getAtom(0) on the substance it returns an O Atom.
>
> So the general Question is, is it impossible to get the Atomposition in this
> way in the original substance with a fragment created from a smiles string?
> Or how does the method correctly work, on the documentation I was not able to
> find a detailed information and I had not the time to watch in the code, also
> I thought if it is the wrong way you can tell it me much more faster.
>
> I want to realise the idea of John to get the starting position of the
> fragment in the specific molecule on this way.
>
> Thanks for your help again.
>
> Cheers
> Niko
>
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> <http://sdm.link/slashdot>
> _______________________________________________
> Cdk-user mailing list
> Cdk-user@lists.sourceforge.net <mailto:Cdk-user@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/cdk-user
> <https://lists.sourceforge.net/lists/listinfo/cdk-user>
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user