Skip to content

Commit

Permalink
MDL reading and writing UP_OR_DOWN
Browse files Browse the repository at this point in the history
Signed-off-by: Rajarshi Guha <rajarshi.guha@gmail.com>
  • Loading branch information
Stefan Kuhn authored and rajarshi committed May 12, 2010
1 parent fd1e57c commit e36983b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/main/org/openscience/cdk/io/MDLReader.java
Expand Up @@ -525,8 +525,11 @@ private IMolecule readMolecule(IMolecule molecule) throws CDKException {
// bond has no stereochemistry
stereo = IBond.Stereo.NONE;
} else if (mdlStereo == 4) {
//MDL bond undefined
stereo = (IBond.Stereo)CDKConstants.UNSET;
//MDL up or down bond
stereo = IBond.Stereo.UP_OR_DOWN;
} else if (mdlStereo == 3) {
//MDL e or z undefined
stereo = IBond.Stereo.E_OR_Z;
}
} else {
logger.warn("Missing expected stereo field at line: " + line);
Expand Down
2 changes: 1 addition & 1 deletion src/main/org/openscience/cdk/io/MDLV2000Reader.java
Expand Up @@ -619,7 +619,7 @@ private IMolecule readMolecule(IMolecule molecule) throws CDKException {
stereo = IBond.Stereo.E_OR_Z;
} else if (mdlStereo == 4) {
//MDL bond undefined
stereo = (IBond.Stereo)CDKConstants.UNSET;
stereo = IBond.Stereo.UP_OR_DOWN;
}
} else {
handleError(
Expand Down
6 changes: 5 additions & 1 deletion src/main/org/openscience/cdk/io/MDLWriter.java
Expand Up @@ -322,7 +322,8 @@ else if(atom.getValency()==0)
logger.warn("Skipping bond with more/less than two atoms: " + bond);
} else {
if (bond.getStereo() == IBond.Stereo.UP_INVERTED ||
bond.getStereo() == IBond.Stereo.DOWN_INVERTED) {
bond.getStereo() == IBond.Stereo.DOWN_INVERTED ||
bond.getStereo() == IBond.Stereo.UP_OR_DOWN_INVERTED) {
// turn around atom coding to correct for inv stereo
line = formatMDLInt(container.getAtomNumber(bond.getAtom(1)) + 1,3);
line += formatMDLInt(container.getAtomNumber(bond.getAtom(0)) + 1,3);
Expand All @@ -348,6 +349,9 @@ else if(atom.getValency()==0)
case UP_OR_DOWN:
line += "4";
break;
case UP_OR_DOWN_INVERTED:
line += "4";
break;
case E_OR_Z:
line += "3";
break;
Expand Down

0 comments on commit e36983b

Please sign in to comment.