From: <eg...@us...> - 2006-09-07 20:52:39
|
Revision: 6842 http://svn.sourceforge.net/cdk/?rev=6842&view=rev Author: egonw Date: 2006-09-07 13:52:34 -0700 (Thu, 07 Sep 2006) Log Message: ----------- Added reading of <molecule><name></molecule> and <molecule><indentifier convention='iupac:inchi'/></molecule> Modified Paths: -------------- trunk/cdk/src/org/openscience/cdk/io/cml/CMLCoreModule.java trunk/cdk/src/org/openscience/cdk/io/cml/ChemFileCDO.java Modified: trunk/cdk/src/org/openscience/cdk/io/cml/CMLCoreModule.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/io/cml/CMLCoreModule.java 2006-09-07 20:37:29 UTC (rev 6841) +++ trunk/cdk/src/org/openscience/cdk/io/cml/CMLCoreModule.java 2006-09-07 20:52:34 UTC (rev 6842) @@ -460,6 +460,12 @@ cdo.setObjectProperty("Crystal", "spacegroup", atts.getValue(i)); } } + } else if ("identifier".equals(name)) { + if (atts.getValue("convention") != null && + atts.getValue("convention").equals("iupac:inchi") && + atts.getValue("value") != null) { + cdo.setObjectProperty("Molecule", "inchi", atts.getValue("value")); + } } else if ("scalar".equals(name)) { if (xpath.toString().endsWith("crystal/scalar/")) crystalScalar++; @@ -858,7 +864,11 @@ this.inchi = cData; } else if ("name".equals(name)) { if (xpath.toString().endsWith("molecule/name/")) { - cdo.setObjectProperty("Molecule", DICTREF, cData); + if (DICTREF.length() > 0) { + cdo.setObjectProperty("Molecule", DICTREF, cData); + } else { + cdo.setObjectProperty("Molecule", "Name", cData); + } } } else { logger.warn("Skipping element: " + name); Modified: trunk/cdk/src/org/openscience/cdk/io/cml/ChemFileCDO.java =================================================================== --- trunk/cdk/src/org/openscience/cdk/io/cml/ChemFileCDO.java 2006-09-07 20:37:29 UTC (rev 6841) +++ trunk/cdk/src/org/openscience/cdk/io/cml/ChemFileCDO.java 2006-09-07 20:52:34 UTC (rev 6842) @@ -311,8 +311,10 @@ if (objectType.equals("Molecule")) { if (propertyType.equals("id")) { currentMolecule.setID(propertyValue); + } else if (propertyType.equals("Name")) { + currentMolecule.setProperty(CDKConstants.TITLE, propertyValue); } else if (propertyType.equals("inchi")) { - currentMolecule.setProperty("iupac.nist.chemical.identifier", propertyValue); + currentMolecule.setProperty(CDKConstants.INCHI, propertyValue); } else if (propertyType.equals("pdb:residueName")) { currentMolecule.setProperty( new DictRef(propertyType, propertyValue), propertyValue This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |