I have also added 'configure' call in addition to
'Istopes.getMajorIsotope();'
IsotopeFactory isotopeFactory = Isotopes.getInstance();
for (IAtom iAtom : pIAtomContainer.atoms()) {
IIsotope iIsotope =
isotopeFactory.getMajorIsotope(iAtom.getAtomicNumber());
isotopeFactory.configure(iAtom, iIsotope);
}
After few tests, it seems to work fine.
Thanks!
Oscar
2014-11-28 10:31 GMT+01:00 John May <[email protected]>:
> Actually… If you really do want the most abundant isotope replace this
> with a call to Istopes.getMajorIsotope()
> <http://cdk.github.io/cdk/1.5/docs/api/index.html?org/openscience/cdk/config/Isotopes.html>
> ;
>
> J
>
> On 28 Nov 2014, at 09:29, John May <[email protected]> wrote:
>
> Hi Oscar,
>
> We could add this as a convince function but the following would work:
>
> for (IAtom atom : container.atoms()) {
> atom.setAtomicMass(null);
> }
>
>
> J
>
> On 7 Oct 2014, at 12:39, Oscar Mora <[email protected]> wrote:
>
> Hi,
>
> I use CDK 1.5.8 to read and pre-process a set of molecules (read from an
> SDF file). Among those molecules there are very specific cases of molecules
> with Isotopes, typically H isotopes like Deuterium or Tritium. I wonder if
> is there a mechanism to replace those atoms by the most abundant associated
> chemical element.
>
> For example, if there is an 3H (Tritium) modify this atom in the
> 'IAtomContainer' java object to transform it to simple H.
>
> I am working on some kind of loop over all atoms, to check if an Atom is
> an Isotope of another chemical element and then replace this atom. My
> problem is that I cannot see which functionality of the package
> org.openscience.cdk.Isotope use inside the loop.
>
> IAtomContainer molecule = ....
> for (int i = 0; i < molecule .getAtomCount(); i++)
> {
> // molecule.getAtom(i) is an isotope ?
> // replace molecule.getAtom(i) by the most abundant
> chemical element
> }
>
> Maybe, another idea could be modify the parameter
>
> InterpretHydrogenIsotopes
>
> of the object: MDLV2000Reader
>
> in this way:
>
> final Properties customSettings = new Properties();
> customSettings.setProperty("InterpretHydrogenIsotopes", "false");
> final PropertiesListener listener = new PropertiesListener(customSettings);
>
> final MDLV2000Reader mdlV2000Reader = new MDLV2000Reader();
> mdlV2000Reader.addChemObjectIOListener(listener);
> mdlV2000Reader.setReader(new
> ByteArrayInputStream(cleanedMolecule.getBytes()));
> iAtomContainer = mdlV2000Reader.read(new AtomContainer());
>
> but it does not works. (and it seems to be designed only of H atoms)
>
> Has anybody tried to do this kind of processing ? Any piece of advice is
> would be most welcome.
>
> Thanks in advance.
>
> Oscar
>
>
>
>
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user