From a75536943508e8f07427ace90c08c2228e8ad819 Mon Sep 17 00:00:00 2001 From: Gabriel Studer <gabriel.studer@unibas.ch> Date: Sat, 30 Dec 2023 17:13:28 +0100 Subject: [PATCH] mmcif writer: clarify error message for insertion codes Only relevant for resnum based alignments, i.e. enabled mmcif_conform flag --- modules/io/src/mol/mmcif_writer.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/modules/io/src/mol/mmcif_writer.cc b/modules/io/src/mol/mmcif_writer.cc index ecd5ba7d5..d3a0aa4f1 100644 --- a/modules/io/src/mol/mmcif_writer.cc +++ b/modules/io/src/mol/mmcif_writer.cc @@ -712,6 +712,7 @@ namespace { std::vector<int> resnums; for(auto res: res_list) { int num = res.GetNumber().GetNum(); + char ins_code = res.GetNumber().GetInsCode(); if(num < 1) { std::stringstream ss; ss << "Try to construct mmCIF entity from residues using resnum "; @@ -721,6 +722,15 @@ namespace { ss << "but be aware of the consequences..."; throw ost::io::IOException(ss.str()); } + if(ins_code != '\0') { + std::stringstream ss; + ss << "Try to construct mmCIF entity from residues using resnum "; + ss << "based alignments. Insertion codes are not allowed "; + ss << "in this case. Got: " << ins_code << " in residue " << res; + ss << ". You may set mmcif_conform flag to False to write something "; + ss << "but be aware of the consequences..."; + throw ost::io::IOException(ss.str()); + } res_mon_ids.push_back(res.GetName()); resnums.push_back(num); max_resnum = std::max(max_resnum, num); -- GitLab