User a9d76a1173
17-01-2012 19:02:12
Hi,
Attached sdf file has amino acids in abbreviated format. Furthermore it does not have smiles in it. How do I add smiles strings, expand abbreviated groups, and write it back to a new sdf file?? Following is the code I tried..it doesn't seem to expand abbreviations..Is it because it doesn't have smiles??
public void marvinWrite() 
    {
        try
        {
        FileInputStream fileInputStream = new FileInputStream("abbr.sdf");
    FileOutputStream os = new FileOutputStream("out.sdf");
    MolImporter molImporter = new MolImporter(fileInputStream);
    MolExporter molExporter = new MolExporter(os, "sdf");
    Molecule molecule;
    while ((molecule = molImporter.read()) != null) {
            molecule.ungroupSgroups();
        molExporter.write(molecule);
    }
    molImporter.close();
    molExporter.close();  
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }