Re: [Cdk-user] General Question to method getAtomNumber(IAtom atom) of IAtomContainer

2017-04-11 Thread Nikolas Glaser
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  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 
> . Easiest way to 
> do this is with a SMARTS pattern match 
> .
> 
> 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 
> 
> 
> 
> 
> 
> On 7 April 2017 at 17:28, Nikolas Glaser  > 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 
> 
> ___
> Cdk-user mailing list
> Cdk-user@lists.sourceforge.net 
> 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


Re: [Cdk-user] General Question to method getAtomNumber(IAtom atom) of IAtomContainer

2017-04-07 Thread John Mayfield
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.
Easiest way to do this is with a SMARTS pattern match
.

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


[image: Inline images 1]


On 7 April 2017 at 17:28, Nikolas Glaser  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
> ___
> Cdk-user mailing list
> Cdk-user@lists.sourceforge.net
> 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


[Cdk-user] General Question to method getAtomNumber(IAtom atom) of IAtomContainer

2017-04-07 Thread Nikolas Glaser
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
___
Cdk-user mailing list
Cdk-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cdk-user