diff --git a/modules/io/src/mol/mmcif_writer.cc b/modules/io/src/mol/mmcif_writer.cc index 12c31d54a60b523908a4a469773fe8153c01463e..aaf0247170e4d4e98c78454df86041dd7f33e289 100644 --- a/modules/io/src/mol/mmcif_writer.cc +++ b/modules/io/src/mol/mmcif_writer.cc @@ -1418,15 +1418,18 @@ MMCifWriterEntity MMCifWriterEntity::FromPolymer(const String& entity_poly_type, ent.branch_type = ""; ent.mon_ids = mon_ids; for(auto mon_id: mon_ids) { - // one letter codes rely on compound library - ost::conop::CompoundPtr compound = - compound_lib->FindCompound(mon_id, ost::conop::Compound::PDB); - if(compound) { - ent.seq_olcs.push_back(MonIDToOLC(mon_id)); - ent.seq_can_olcs.push_back(String(1, compound->GetOneLetterCode())); + ent.seq_olcs.push_back(MonIDToOLC(mon_id)); + if(ent.seq_olcs.back().size() == 1) { + ent.seq_can_olcs.push_back(ent.seq_olcs.back()); } else { - ent.seq_olcs.push_back("(" + mon_id + ")"); - ent.seq_can_olcs.push_back("(" + mon_id + ")"); + ost::conop::CompoundPtr compound = + compound_lib->FindCompound(mon_id, ost::conop::Compound::PDB); + char olc = compound->GetOneLetterCode(); + if(olc < 'A' || olc > 'Z') { + ent.seq_can_olcs.push_back("(" + mon_id + ")"); + } else { + ent.seq_can_olcs.push_back(String(1, olc)); + } } } return ent;