Skip to content

Commit

Permalink
do not number non-polymer residues
Browse files Browse the repository at this point in the history
  • Loading branch information
mhekkel committed Mar 12, 2024
1 parent cedaab9 commit 3ebceb7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/pdb/reconstruct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,10 @@ void checkAtomRecords(datablock &db)
if (atom_site.contains(key("label_seq_id") < 0))
fixNegativeSeqID(atom_site);

std::set<int> polymer_entities;
for (int id : db["entity"].find<int>("type"_key == "polymer", "id"))
polymer_entities.insert(id);

for (auto row : atom_site)
{
residue_key_type k = row.get<std::optional<std::string>,
Expand Down Expand Up @@ -443,6 +447,7 @@ void checkAtomRecords(datablock &db)
std::string comp_id = get_comp_id(k);

bool is_peptide = cf.is_peptide(comp_id);
bool is_polymer = polymer_entities.contains(row["label_entity_id"].as<int>());
auto compound = cf.create(comp_id);

if (not compound)
Expand Down Expand Up @@ -483,12 +488,12 @@ void checkAtomRecords(datablock &db)
chem_comp_entry.assign(items);
}

if (is_peptide and not has_seq_id(k))
if (is_polymer and not has_seq_id(k))
throw std::runtime_error("atom_site record has peptide comp_id but no sequence number, cannot continue");

int seq_id = get_seq_id(k);

if (row["label_seq_id"].empty() and cf.is_monomer(comp_id))
if (is_polymer and row["label_seq_id"].empty() and cf.is_monomer(comp_id))
row["label_seq_id"] = std::to_string(seq_id);

if (row["label_atom_id"].empty())
Expand Down

0 comments on commit 3ebceb7

Please sign in to comment.