diff --git a/src/pdb/pdb2cif.cpp b/src/pdb/pdb2cif.cpp index 93dc86e..3c446db 100644 --- a/src/pdb/pdb2cif.cpp +++ b/src/pdb/pdb2cif.cpp @@ -6440,9 +6440,9 @@ file read(std::istream &is) // Well, not quite, Unfortunately... People insisted that // having only ATOM records also makes up a valid PDB file... // Since mmCIF files cannot validly start with a letter character - // the test has changed into the following: + // apart from the letter 'd', the test has changed into the following: - if (std::isalpha(ch)) + if (std::isalpha(ch) and std::toupper(ch) != 'D') read_pdb_file(is, result); else { diff --git a/src/pdb/validate-pdbx.cpp b/src/pdb/validate-pdbx.cpp index 054876a..e596a39 100644 --- a/src/pdb/validate-pdbx.cpp +++ b/src/pdb/validate-pdbx.cpp @@ -248,13 +248,12 @@ bool is_valid_pdbx_file(const file &file, std::string_view dictionary, std::erro for (auto comp_id : comp_ids) { std::string letter; - if (compound_factory::kBaseMap.contains(comp_id)) - letter = compound_factory::kBaseMap.at(comp_id); - else if (compound_factory::kAAMap.contains(comp_id)) - letter = compound_factory::kAAMap.at(comp_id); - else + + if (can) { - if (can) + if (compound_factory::kBaseMap.contains(comp_id)) + letter = compound_factory::kBaseMap.at(comp_id); + else { auto c = cf.create(comp_id); if (c and c->one_letter_code()) @@ -262,6 +261,13 @@ bool is_valid_pdbx_file(const file &file, std::string_view dictionary, std::erro else letter = "X"; } + } + else + { + if (compound_factory::kAAMap.contains(comp_id)) + letter = compound_factory::kAAMap.at(comp_id); + else if (comp_id.length() == 1 and compound_factory::kBaseMap.contains(comp_id)) + letter = compound_factory::kBaseMap.at(comp_id); else letter = '(' + comp_id + ')'; }