Skip to content

Commit

Permalink
Fixing pdb2cif, and sequence checking
Browse files Browse the repository at this point in the history
  • Loading branch information
mhekkel committed Jan 29, 2024
1 parent 4e012cb commit 446438b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/pdb/pdb2cif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
18 changes: 12 additions & 6 deletions src/pdb/validate-pdbx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,20 +248,26 @@ 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())
letter = c->one_letter_code();
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 + ')';
}
Expand Down

0 comments on commit 446438b

Please sign in to comment.