User 73531e86ff
12-03-2009 12:48:29
Hi,
I'm writing a function which calulates the number of chiral atoms and number of stereo double bonds. I was able to use the TopologyAnalyser for the chiral atoms successfully. However, I had some issue with the stereoDoubleBondCount function - i'm not sure if it is a bug or as designed.
Basically, if the input smiles does not define the cis/trans state of the double bond it is not included in the count.
e.g. CC=CC gives 0 whereas C/C=C/C gives 1
My workaround was to firstly calculate the 2D coordinates and then search for "squiggly" bonds. Please let me know if there is a better way to do this - I expect calculating the 2D coordinates is not the most efficient. My existing code is below:
Cheers,
Shane
I'm writing a function which calulates the number of chiral atoms and number of stereo double bonds. I was able to use the TopologyAnalyser for the chiral atoms successfully. However, I had some issue with the stereoDoubleBondCount function - i'm not sure if it is a bug or as designed.
Basically, if the input smiles does not define the cis/trans state of the double bond it is not included in the count.
e.g. CC=CC gives 0 whereas C/C=C/C gives 1
My workaround was to firstly calculate the 2D coordinates and then search for "squiggly" bonds. Please let me know if there is a better way to do this - I expect calculating the 2D coordinates is not the most efficient. My existing code is below:
Code: |
public int stereoDoubleBondCount(Molecule molecule) { int count = 0; molecule.clean( 2, "" ); for( final MolBond bond : molecule.getBondArray() ) { count += isDoubleBondStereo(bond) ? 1 : 0; } return count; } private boolean isDoubleBondStereo( MolBond bond ) { if( bond.getType() == 2 ) { final int bondStereo = bond.getFlags() & MolBond.CTUMASK; if( (bondStereo & ( MolBond.CIS | MolBond.TRANS ) ) != 0 ) { return true; } else { for( final MolAtom atom : Arrays.asList( bond.getAtom1(), bond.getAtom2() ) ) { for( int i=0; i final int outerBondStereo = atom.getBond(i).getFlags() & MolBond.STEREO1_MASK; if( ( outerBondStereo & ( MolBond.UP | MolBond.DOWN )) != 0) { return true; } } } } } return false; } |
Cheers,
Shane