Skip to content

Commit

Permalink
#2539 - Export of unknown monomer to HELM doesn't work (#2690)
Browse files Browse the repository at this point in the history
  • Loading branch information
AliaksandrDziarkach authored Dec 17, 2024
1 parent 4e626c4 commit cd267b4
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 1 deletion.
1 change: 1 addition & 0 deletions api/tests/integration/ref/formats/ket_to_helm.py.out
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ helm_rna_without_base.ket:SUCCEED
helm_simple_rna.ket:SUCCEED
helm_smiles.ket:SUCCEED
helm_smiles_sugar.ket:SUCCEED
helm_unknown.ket:SUCCEED
rna_variants.ket:SUCCEED
1 change: 1 addition & 0 deletions api/tests/integration/tests/formats/ket_to_helm.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def find_diff(a, b):
"helm_molecule_2418": "PEPTIDE1{A}|CHEM1{[C1C=CC=CC=1[*:1] |$;;;;;;_R1$|]}$PEPTIDE1,CHEM1,1:R1-1:R1$$$V2.0",
"helm_chem_rna_hydro": "CHEM1{[MCC]}|RNA1{R(U)P}$CHEM1,RNA1,1:pair-3:pair$$$V2.0",
"helm_monomer_molecule_direct": "PEPTIDE1{A}|CHEM1{[C(=C)N[*:1] |$;;;_R1$|]}$PEPTIDE1,CHEM1,1:R2-1:R1$$$V2.0",
"helm_unknown": "CHEM1{[C1([*:1])C([*:4])C([*:3])C1[*:2] |$;_R1;;_R4;;_R3;;_R2$|]}$$$$V2.0",
}

for filename in sorted(helm_data.keys()):
Expand Down
128 changes: 128 additions & 0 deletions api/tests/integration/tests/formats/ref/helm_unknown.ket
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
{
"root": {
"nodes": [
{
"$ref": "monomer489"
}
],
"connections": [],
"templates": [
{
"$ref": "monomerTemplate-unknown_monomer_with_idt_alias_Unknown"
}
]
},
"monomer489": {
"type": "monomer",
"id": "489",
"position": {
"x": 13.213368034362787,
"y": -10.06310758590698
},
"alias": "Unknown",
"templateId": "unknown_monomer_with_idt_alias_Unknown",
"seqid": 0
},
"monomerTemplate-unknown_monomer_with_idt_alias_Unknown": {
"type": "monomerTemplate",
"atoms": [
{
"label": "C",
"location": [
0,
0,
0
]
},
{
"label": "C",
"location": [
1,
1,
1
]
},
{
"label": "C",
"location": [
2,
2,
2
]
},
{
"label": "C",
"location": [
3,
3,
3
]
}
],
"bonds": [
{
"type": 1,
"atoms": [
0,
1
]
},
{
"type": 1,
"atoms": [
1,
2
]
},
{
"type": 1,
"atoms": [
2,
3
]
},
{
"type": 1,
"atoms": [
0,
3
]
}
],
"class": "CHEM",
"id": "unknown_monomer_with_idt_alias_Unknown",
"fullName": "Unknown",
"alias": "Unknown",
"attachmentPoints": [
{
"attachmentAtom": 0,
"leavingGroup": {
"atoms": []
}
},
{
"attachmentAtom": 1,
"leavingGroup": {
"atoms": []
}
},
{
"attachmentAtom": 2,
"leavingGroup": {
"atoms": []
}
},
{
"attachmentAtom": 3,
"leavingGroup": {
"atoms": []
}
}
],
"idtAliases": {
"base": "Unknown"
},
"unresolved": true,
"naturalAnalogShort": ""
}
}
10 changes: 9 additions & 1 deletion core/indigo-core/molecule/src/sequence_saver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1206,7 +1206,15 @@ void SequenceSaver::add_monomer(KetDocument& document, const std::unique_ptr<Ket
auto& ap = sa.attachment_points.at(ap_id);
int leaving_atom = ap.lvidx;
int ap_idx = getAttachmentOrder(ap.apid.ptr()) + 1;
pmol->resetAtom(leaving_atom, ELEM_RSITE);
if (leaving_atom >= 0)
{
pmol->resetAtom(leaving_atom, ELEM_RSITE);
}
else
{
leaving_atom = pmol->addAtom(ELEM_RSITE);
pmol->addBond(ap.aidx, leaving_atom, BOND_SINGLE);
}
pmol->allowRGroupOnRSite(leaving_atom, ap_idx);
}
sgroups.remove(i);
Expand Down

0 comments on commit cd267b4

Please sign in to comment.