Skip to content

Commit

Permalink
Backmerge: #2358 - Import of monomer with only one connection point (…
Browse files Browse the repository at this point in the history
…R2) doesn't work (#2365)
  • Loading branch information
AliaksandrDziarkach authored Sep 12, 2024
1 parent 08d4fe1 commit 718293e
Show file tree
Hide file tree
Showing 8 changed files with 367 additions and 78 deletions.
1 change: 1 addition & 0 deletions api/tests/integration/ref/formats/helm_to_ket.py.out
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ helm_chem_rna.ket:SUCCEED
helm_mixed_base.ket:SUCCEED
helm_mixed_custom.ket:SUCCEED
helm_multi_char_rna.ket:SUCCEED
helm_no_left_ap.ket:SUCCEED
helm_peptide.ket:SUCCEED
helm_rna_without_base.ket:SUCCEED
helm_simple_rna.ket:SUCCEED
Expand Down
1 change: 1 addition & 0 deletions api/tests/integration/tests/formats/helm_to_ket.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def find_diff(a, b):
"aminoacids_variants": "PEPTIDE1{(D+N).(L+I).(E+Q).(A+C+D+E+F+G+H+I+K+L+M+N+O+P+Q+R+S+T+U+V+W+Y)}$$$$V2.0",
"helm_smiles": "PEPTIDE1{G.[[*]N[C@@H](C=O)C([*])=O |$_R1;;;;;;_R2;$|].C}|PEPTIDE2{G.[[*:1]N[C@@H](C=O)C([*:2])=O].C}$$$$",
"helm_smiles_sugar": "RNA1{[C([*:3])[C@@H](O[*:2])CO[*:1]](A)P}$$$$V2.0",
"helm_no_left_ap": "PEPTIDE1{[DACys].C}$$$$V2.0",
}

lib = indigo.loadMonomerLibraryFromFile(
Expand Down
334 changes: 334 additions & 0 deletions api/tests/integration/tests/formats/ref/helm_no_left_ap.ket
Original file line number Diff line number Diff line change
@@ -0,0 +1,334 @@
{
"root": {
"nodes": [
{
"$ref": "monomer0"
},
{
"$ref": "monomer1"
}
],
"connections": [
{
"connectionType": "single",
"endpoint1": {
"monomerId": "monomer0",
"attachmentPointId": "R2"
},
"endpoint2": {
"monomerId": "monomer1",
"attachmentPointId": "R1"
}
}
],
"templates": [
{
"$ref": "monomerTemplate-DACys___Deamino-Cysteine"
},
{
"$ref": "monomerTemplate-C___Cysteine"
}
]
},
"monomer0": {
"type": "monomer",
"id": "0",
"seqid": 1,
"position": {
"x": 0.000000,
"y": -0.000000
},
"alias": "DACys",
"templateId": "DACys___Deamino-Cysteine"
},
"monomer1": {
"type": "monomer",
"id": "1",
"seqid": 2,
"position": {
"x": 1.600000,
"y": -0.000000
},
"alias": "C",
"templateId": "C___Cysteine"
},
"monomerTemplate-DACys___Deamino-Cysteine": {
"type": "monomerTemplate",
"id": "DACys___Deamino-Cysteine",
"class": "AminoAcid",
"classHELM": "PEPTIDE",
"fullName": "Deamino-Cysteine",
"alias": "DACys",
"naturalAnalogShort": "C",
"attachmentPoints": [
{
"attachmentAtom": 3,
"type": "right",
"leavingGroup": {
"atoms": [
4
]
}
}
],
"atoms": [
{
"label": "S",
"location": [
0.000700,
0.000400,
0.000000
]
},
{
"label": "C",
"location": [
1.300000,
0.750000,
0.000000
]
},
{
"label": "C",
"location": [
2.600000,
0.000000,
0.000000
]
},
{
"label": "C",
"location": [
3.900000,
0.750000,
0.000000
]
},
{
"label": "O",
"location": [
3.900000,
2.250000,
0.000000
]
},
{
"label": "O",
"location": [
5.199200,
0.000400,
0.000000
]
}
],
"bonds": [
{
"type": 1,
"atoms": [
0,
1
]
},
{
"type": 1,
"atoms": [
1,
2
]
},
{
"type": 1,
"atoms": [
2,
3
]
},
{
"type": 1,
"atoms": [
3,
4
]
},
{
"type": 2,
"atoms": [
3,
5
]
}
]
},
"monomerTemplate-C___Cysteine": {
"type": "monomerTemplate",
"id": "C___Cysteine",
"class": "AminoAcid",
"classHELM": "PEPTIDE",
"fullName": "Cysteine",
"alias": "C",
"naturalAnalogShort": "C",
"attachmentPoints": [
{
"attachmentAtom": 4,
"type": "left",
"leavingGroup": {
"atoms": [
7
]
}
},
{
"attachmentAtom": 0,
"type": "right",
"leavingGroup": {
"atoms": [
6
]
}
},
{
"attachmentAtom": 3,
"type": "side",
"leavingGroup": {
"atoms": [
8
]
}
}
],
"atoms": [
{
"label": "C",
"location": [
1.445700,
-1.133300,
0.000000
]
},
{
"label": "C",
"location": [
0.145300,
-0.384000,
0.000000
],
"stereoLabel": "abs"
},
{
"label": "C",
"location": [
0.143000,
1.116800,
0.000000
]
},
{
"label": "S",
"location": [
-1.157300,
1.866100,
0.000000
]
},
{
"label": "N",
"location": [
-1.155100,
-1.133300,
0.000000
]
},
{
"label": "O",
"location": [
1.447500,
-2.333300,
0.000000
]
},
{
"label": "O",
"location": [
2.484200,
-0.532000,
0.000000
]
},
{
"label": "H",
"location": [
-2.194200,
-0.533100,
0.000000
]
},
{
"label": "H",
"location": [
-1.159100,
3.066100,
0.000000
]
}
],
"bonds": [
{
"type": 2,
"atoms": [
5,
0
]
},
{
"type": 1,
"atoms": [
0,
1
]
},
{
"type": 1,
"atoms": [
0,
6
]
},
{
"type": 1,
"atoms": [
1,
4
]
},
{
"type": 1,
"atoms": [
1,
2
],
"stereo": 1
},
{
"type": 1,
"atoms": [
2,
3
]
},
{
"type": 1,
"atoms": [
4,
7
]
},
{
"type": 1,
"atoms": [
3,
8
]
}
]
}
}
1 change: 0 additions & 1 deletion core/indigo-core/molecule/molecule_json_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ namespace indigo
void parseProperties(const rapidjson::Value& props, BaseMolecule& mol);
void setStereoFlagPosition(const rapidjson::Value& pos, int fragment_index, BaseMolecule& mol);
void handleSGroup(SGroup& sgroup, const std::unordered_set<int>& atoms, BaseMolecule& bmol);
static void addMonomerTemplate(const rapidjson::Value& mt_json, MonomerTemplateLibrary* library, KetDocument* document);
void addToLibMonomerGroupTemplate(MonomerTemplateLibrary& library, const rapidjson::Value& monomer_group_template);
static std::string monomerTemplateClass(const rapidjson::Value& monomer_template);
std::string monomerMolClass(const std::string& class_name);
Expand Down
2 changes: 2 additions & 0 deletions core/indigo-core/molecule/monomers_template_library.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ namespace indigo

KetAttachmentPoint& AddAttachmentPoint(const std::string& label, int att_atom);

KetAttachmentPoint& AddAttachmentPointId(const std::string& id, int att_atom);

const KetAttachmentPoint& getAttachmenPointById(const std::string& att_point_id);

std::unique_ptr<TGroup> getTGroup() const;
Expand Down
Loading

0 comments on commit 718293e

Please sign in to comment.