/// <summary> /// Get molecule string in correct format /// </summary> /// <param name="vo"></param> /// <param name="structureExportFormat"></param> /// <returns></returns> string GetMoleculeString( object vo, ExportStructureFormat structureExportFormat) { string molString = ""; MoleculeMx cs = (MoleculeMx)vo; if (structureExportFormat == ExportStructureFormat.Chime) { molString = cs.GetChimeString(); // save structure as Chime } else if (structureExportFormat == ExportStructureFormat.Smiles) { molString = cs.GetSmilesString(); // save structure as Smiles } else if (structureExportFormat == ExportStructureFormat.Molfile) { molString = cs.GetMolfileString(); // save structure as molfile } else // save structure as molfile as default { molString = cs.GetMolfileString(); } return(molString); }
/// <summary> /// Convert any ChemicalStructures containing a sketch value to a ChimeString for proper serialization /// </summary> /// <param name="oa"></param> public static void ConvertMoleculesToChimeStrings(object[] oa) { for (int ci = 0; ci < oa.Length; ci++) { if (!(oa[ci] is MoleculeMx)) { continue; } MoleculeMx cs = oa[ci] as MoleculeMx; if (Math.Abs(1) == 1) { continue; // noop for now } //if (cs.Type != StructureFormat.Sketch) continue; // obsolete MoleculeFormat type = MoleculeFormat.Chime; string value = cs.GetChimeString(); cs.SetPrimaryTypeAndValue(type, value); } }