Commits

petermr  committed 41f6b62

fixed ResolveCT

  • Participants
  • Parent commits a316b4f

Comments (0)

Files changed (1)

File src/main/java/org/xmlcml/cml/crystaleye/supptext/ResolveCTFromName.java

 
 import org.apache.log4j.Logger;
 import org.xmlcml.cml.base.CMLBuilder;
+import org.xmlcml.cml.base.CMLElement;
 import org.xmlcml.cml.base.CMLElements;
+import org.xmlcml.cml.base.CMLUtil;
 import org.xmlcml.cml.crystaleye.AbstractCrystaleyeVisitor;
 import org.xmlcml.cml.crystaleye.util.CrystaleyeUtil;
 import org.xmlcml.cml.crystaleye.util.NameTranslator;
 			throw new RuntimeException("Cannot parse document as CML-POS: "+xmlFile, e);
 		}
 		Document moleculesDocument = resolveMolecules(document);
+		CMLUtil.debug(moleculesDocument.getRootElement(), "DDD");
 		return moleculesDocument;
 	}
 
 			CrystaleyeUtil.extractTopLevelMoleculesWithNameButNoConnectionTable(document);
 
 		for (CMLMolecule origMolecule : origMoleculeList) {
-			CMLMolecule molecule = (CMLMolecule) CMLBuilder.ensureCML(origMolecule);
-			CMLMolecule translatedMolecule = getOpsinOscarIndexMolecule(molecule);
+//			CMLMolecule molecule = (CMLMolecule) CMLBuilder.ensureCML(origMolecule);
+//			CMLMolecule translatedMolecule = getOpsinOscarIndexMolecule(molecule);
+			CMLMolecule translatedMolecule = getOpsinOscarIndexMolecule(origMolecule);
 			if (translatedMolecule != null) {
 				String smiles = new SMILESTool(translatedMolecule).write();
-				addSMILESToDocument(translatedMolecule);
+//				System.err.println("SSS "+smiles);
+				addSMILESToDocument(origMolecule, smiles);
 			}
 		}
 		return document;
 		return opsinOscarMolecule;
 	}
 
-	private void addSMILESToDocument(Element moleculeElement) {
+	private void addSMILESToDocument(Element moleculeElement, String smiles) {
 		if (opsinOscarMolecule != null) {
-			String smiles = new SMILESTool(opsinOscarMolecule).write();
+//			String smiles = new SMILESTool(opsinOscarMolecule).write();
 			CMLFormula formula = new CMLFormula();
 			formula.setInline(smiles);
 			formula.setConvention(CrystaleyeUtil.SMILES);
 			moleculeElement.appendChild(formula);
+//			((CMLElement)moleculeElement).debug("XXXXXXXXX");
 		}
 	}