Hey,
On Tue, Oct 26, 2010 at 1:53 PM, Tobias Girschick <
[email protected]> wrote:
> Yep, I was supposing something like that. Thanks for shedding some light on
> this. Would have been way to easy and efficient...
>
> best regards,
> Tobias
>
>
> On Tue, Oct 26, 2010 at 1:42 PM, Rajarshi Guha <[email protected]>wrote:
>
>> This cannot work since the atom from mol is a different instance from the
>> atom in mol2store, so that
>> mol2store.removeAtomAndConnectedElectronContainers(a) will never remove any
>> atoms.
>>
>
That's what I suspected.
>
>> In fact, given the substructure you must perform a substructure search to
>> get the mapping of the target atoms to the substructure atoms and use that
>> mapping to remove the target atoms.
>>
>
Well, that's the thing I wanted to prevent...as I already have performed
some kind of substructure search. Is there a way to map the substructure on
on the molecule so that I can afterwards remove the overlapping atoms?
best regards,
Tobias
>
>> See http://rguha.net/code/java/#umcss for an example - most likely it
>> won't work with the latest CDK as it was written a long time ago, but should
>> point you in the direction
>>
>>
>> On Oct 26, 2010, at 4:59 AM, Tobias Girschick wrote:
>>
>> sorry, I sent the message before it was ready....here the complete
>>> version
>>>
>>> Hi,
>>>
>>> I would like to substract a substructure from a structure and keep the
>>> remaining parts. There was a similar post in the mailing list history:
>>>
>>>
>>> http://sourceforge.net/mailarchive/message.php?msg_id=200702050602.05302.e.willighagen%40science.ru.nl
>>>
>>> The difference (is it a difference?) is, that I don't calculate the
>>> substructure with CDK code but get it from somewhere else. My code looks
>>> like this (but doesn't work):
>>>
>>> while (sdfreader.hasNext()) {
>>> /*
>>> Substructure: O=Cc1ccccc1
>>> A: OC(=O)c1cccc(c1)Cl
>>> B: CC(=O)c1cccc(F)c1
>>> C: Nc1cccc(c1)C(O)=O
>>> */
>>>
>>> // read the molecules A, B, C
>>> IMolecule mol2store = (IMolecule)sdfreader.next();
>>>
>>> AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2store);
>>> CDKHueckelAromaticityDetector.detectAromaticity(mol2store);
>>>
>>> // read the substructure
>>> FileInputStream fes = new FileInputStream(f_bb);
>>> IteratingMDLReader sdreader = new IteratingMDLReader(fes,
>>> DefaultChemObjectBuilder.getInstance());
>>> IMolecule mol = null;
>>> while (sdreader.hasNext()) {
>>> mol = (IMolecule) sdreader.next();
>>> }
>>> sdreader.close();
>>> fes.close();
>>>
>>> String smiles = sg.createSMILES(mol);
>>> System.out.println("S: " + smiles);
>>> smiles = sg.createSMILES(mol2store);
>>> System.out.println("A: " + smiles);
>>>
>>> Iterable<IAtom> i = mol.atoms();
>>> Iterator<IAtom> atoms = i.iterator();
>>> while(atoms.hasNext()){
>>> IAtom a = atoms.next();
>>> mol2store.removeAtomAndConnectedElectronContainers(a);
>>> }
>>> smiles = sg.createSMILES(mol2store);
>>> System.out.println("B: " + smiles);
>>> smiles = sg.createSMILES(mol);
>>> System.out.println("S: " + smiles);
>>> System.out.println("-------------");
>>> }
>>>
>>> Considering the SMILES output, the atoms haven't been substracted from
>>> the molecules ABC. Any thoughts?
>>>
>>> On Tue, Oct 26, 2010 at 10:56 AM, Tobias Girschick <
>>> [email protected]> wrote:
>>> Hi,
>>>
>>> I would like to substract a substructure from a structure and keep the
>>> remaining parts. There was a similar post in the mailing list history:
>>>
>>>
>>> http://sourceforge.net/mailarchive/message.php?msg_id=200702050602.05302.e.willighagen%40science.ru.nl
>>>
>>> The difference (is it a difference?) is, that I don't calculate the
>>> substructure with CDK code but get it from somewhere else. My code looks
>>> like this (but doesn't work):
>>>
>>> while (sdfreader.hasNext()) {
>>> /*
>>> Substructure: O=Cc1ccccc1
>>> A: OC(=O)c1cccc(c1)Cl
>>> B: CC(=O)c1cccc(F)c1
>>> C: Nc1cccc(c1)C(O)=O
>>> */
>>>
>>> IMolecule mol2store = (IMolecule)sdfreader.next();
>>>
>>> AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol2store);
>>> CDKHueckelAromaticityDetector.detectAromaticity(mol2store);
>>>
>>> FileInputStream fes = new FileInputStream(f_bb);
>>> IteratingMDLReader sdreader = new IteratingMDLReader(fes,
>>> DefaultChemObjectBuilder.getInstance());
>>> IMolecule mol = null;
>>> while (sdreader.hasNext()) {
>>> mol = (IMolecule) sdreader.next();
>>> }
>>> sdreader.close();
>>> fes.close();
>>>
>>> String smiles = sg.createSMILES(mol);
>>> System.out.println("S: " + smiles);
>>> smiles = sg.createSMILES(mol2store);
>>> System.out.println("A: " + smiles);
>>>
>>> Iterable<IAtom> i = mol.atoms();
>>> Iterator<IAtom> atoms = i.iterator();
>>> while(atoms.hasNext()){
>>> IAtom a = atoms.next();
>>> mol2store.removeAtomAndConnectedElectronContainers(a);
>>> }
>>> smiles = sg.createSMILES(mol2store);
>>> System.out.println("B: " + smiles);
>>> smiles = sg.createSMILES(mol);
>>> System.out.println("S: " + smiles);
>>> System.out.println("-------------");
>>> }
>>>
>>> --
>>> Tobias Girschick
>>> mailto: [email protected]
>>>
>>>
>>>
>>> --
>>> Tobias Girschick
>>> mailto: [email protected]
>>>
>>> ------------------------------------------------------------------------------
>>> Nokia and AT&T present the 2010 Calling All Innovators-North America
>>> contest
>>> Create new apps & games for the Nokia N8 for consumers in U.S. and
>>> Canada
>>> $10 million total in prizes - $4M cash, 500 devices, nearly $6M in
>>> marketing
>>> Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
>>>
>>> http://p.sf.net/sfu/nokia-dev2dev_______________________________________________
>>> Cdk-user mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/cdk-user
>>>
>>
>> ----------------------------------------------------
>> Rajarshi Guha | NIH Chemical Genomics Center
>> http://www.rguha.net | http://ncgc.nih.gov
>> ----------------------------------------------------
>> A committee is a group that keeps the minutes and loses hours.
>> -- Milton Berle
>>
>>
>>
>
>
> --
> Tobias Girschick
> mailto: [email protected]
>
--
Tobias Girschick
mailto: [email protected]
------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user