Skip to content

Commit

Permalink
Backmerge: Bugfix/950 cdx aromatized structures (#954)
Browse files Browse the repository at this point in the history
* rgroups (#946)

Co-authored-by: Roman Porozhnetov <roman_porozhnetov@epam.com>

* CDX import: Reaction arrows disappear when opening a file #943 (#948)

* marvin cdx fix

* clang fix

Co-authored-by: Roman Porozhnetov <roman_porozhnetov@epam.com>

* CDX import: Aromatized structures are not recognized when Pasting from Clipboard #950 (#953)

* bond order fix

* clang fix

* test fix

Co-authored-by: Roman Porozhnetov <roman_porozhnetov@epam.com>

Co-authored-by: Roman Porozhnetov <roman_porozhnetov@epam.com>
  • Loading branch information
2 people authored and Mikalai Sukhikh committed Jan 17, 2023
1 parent cc1d6c3 commit a15417c
Show file tree
Hide file tree
Showing 4 changed files with 126 additions and 0 deletions.
2 changes: 2 additions & 0 deletions api/tests/integration/ref/formats/cdx_to_ket.py.out
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
*** CDXML to mol ***
arom64.cdx
{"root":{"nodes":[{"$ref":"mol0"}]},"mol0":{"type":"molecule","atoms":[{"label":"Br","location":[0.27766722440719607,-3.042332887649536,0.0]},{"label":"C","location":[0.6933329105377197,-2.8023335933685304,0.0]},{"label":"C","location":[0.6933329105377197,-2.322333812713623,0.0]},{"label":"C","location":[1.1090006828308106,-2.0823333263397219,0.0]},{"label":"C","location":[1.5246663093566895,-2.322333812713623,0.0]},{"label":"C","location":[1.9403340816497803,-2.0823333263397219,0.0]},{"label":"O","location":[2.355999708175659,-2.322333812713623,0.0]},{"label":"C","location":[2.77166748046875,-2.0823333263397219,0.0]},{"label":"C","location":[3.187666893005371,-2.322333812713623,0.0]},{"label":"N","location":[3.603334665298462,-2.0823333263397219,0.0]},{"label":"C","location":[3.653334617614746,-1.6049997806549073,0.0]},{"label":"C","location":[4.123000144958496,-1.5049997568130494,0.0]},{"label":"N","location":[4.363000392913818,-1.9206664562225342,0.0]},{"label":"C","location":[4.041666507720947,-2.2776663303375246,0.0]},{"label":"C","location":[2.77166748046875,-1.6023335456848145,0.0]},{"label":"C","location":[3.187666893005371,-1.3623331785202027,0.0]},{"label":"C","location":[3.187666893005371,-0.8823333978652954,0.0]},{"label":"C","location":[2.77166748046875,-0.6423329710960388,0.0]},{"label":"Cl","location":[2.77166748046875,-0.1623331755399704,0.0]},{"label":"C","location":[2.355999708175659,-0.8823333978652954,0.0]},{"label":"C","location":[2.355999708175659,-1.3623331785202027,0.0]},{"label":"Cl","location":[1.9403340816497803,-1.6023335456848145,0.0]},{"label":"C","location":[1.5246663093566895,-2.8023335933685304,0.0]},{"label":"Cl","location":[1.9403340816497803,-3.042332887649536,0.0]},{"label":"C","location":[1.1090006828308106,-3.042332887649536,0.0]}],"bonds":[{"type":1,"atoms":[0,1]},{"type":4,"atoms":[1,2]},{"type":4,"atoms":[2,3]},{"type":4,"atoms":[3,4]},{"type":1,"atoms":[4,5]},{"type":1,"atoms":[5,6]},{"type":1,"atoms":[6,7]},{"type":1,"atoms":[7,8]},{"type":1,"atoms":[8,9]},{"type":4,"atoms":[9,10]},{"type":4,"atoms":[10,11]},{"type":4,"atoms":[11,12]},{"type":4,"atoms":[12,13]},{"type":4,"atoms":[9,13]},{"type":1,"atoms":[7,14]},{"type":4,"atoms":[14,15]},{"type":4,"atoms":[15,16]},{"type":4,"atoms":[16,17]},{"type":1,"atoms":[17,18]},{"type":4,"atoms":[17,19]},{"type":4,"atoms":[19,20]},{"type":4,"atoms":[14,20]},{"type":1,"atoms":[20,21]},{"type":4,"atoms":[4,22]},{"type":1,"atoms":[22,23]},{"type":4,"atoms":[22,24]},{"type":4,"atoms":[1,24]}]}}
marvin.cdx
CDXML loader: Not a molecule. Found 1 arrows.
*** Try as Reaction ***
Expand Down
81 changes: 81 additions & 0 deletions api/tests/integration/tests/formats/molecules/cdx/arom64.cdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
VmpDRDAxMDAEAwIBAAAAAAAAAAAAAACAAAAAAAMAFQAAAENoZW1EcmF3IEpTIDIu
MC4wLjk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AAACgACADAABAYEAA8AAAAFBgQAFQAAAAAGAgCAAAoGAQAB
AAAFgDEAAAAKAAIAMQAEBgQAFQAAAAUGBAAWAAAACgYBAAEAAAWAMgAAAAoAAgAy
AAQGBAAFAAAABQYEABcAAAAABgIAgAAKBgEAAQAABYAzAAAACgACADMABAYEABcA
AAAFBgQAGAAAAAoGAQABAAAFgDQAAAAKAAIANAAEBgQAFwAAAAUGBAAZAAAAAAYC
AIAACgYBAAEAAAWANQAAAAoAAgA1AAQGBAACAAAABQYEABkAAAAABgIAgAAKBgEA
AQAAB4A4AAAABAIQAApmQQHqtFoCCmZBASOxUQIKAAIANgAACgIABAAECgIAAQAN
AgwAI7FRAgpmQQEAAAAADgIMAOq0WgIKZkEBAAAAAA8CDAAjsVEC0mlKAQAAAAAA
AAeAOQAAAAQCEAC53ywBJpStArnfLAHwH6cCCgACADcAAAoCAAQABAoCAAEADQIM
APAfpwK53ywBAAAAAA4CDAAmlK0Cud8sAQAAAAAPAgwA8B+nAu9TMwEAAAAAAAAH
gDoAAAAEAhAA2DIWAfmWjALYMhYBMpODAgoAAgA4AAAKAgAEAAQKAgABAA0CDAAy
k4MC2DIWAQAAAAAOAgwA+ZaMAtgyFgEAAAAADwIMADKTgwKgNh8BAAAAAAAAAAAA
AAAAAAA=
40 changes: 40 additions & 0 deletions core/indigo-core/molecule/CDXCommons.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,46 @@ enum class ECDXType
CDXFontStyle
};

const std::unordered_map<int, std::string> kBondOrderIntToStr = {{kCDXBondOrder_Single, "1"},
{kCDXBondOrder_Double, "2"},
{kCDXBondOrder_Triple, "3"},
{kCDXBondOrder_Quadruple, "4"},
{kCDXBondOrder_Quintuple, "5"},
{kCDXBondOrder_Sextuple, "6"},
{kCDXBondOrder_Half, "0.5"},
{kCDXBondOrder_OneHalf, "1.5"},
{kCDXBondOrder_TwoHalf, "2.5"},
{kCDXBondOrder_ThreeHalf, "3.5"},
{kCDXBondOrder_FourHalf, "4.5"},
{kCDXBondOrder_FiveHalf, "5.5"},
{kCDXBondOrder_Dative, "dative"},
{kCDXBondOrder_Ionic, "ionic"},
{kCDXBondOrder_Hydrogen, "hydrogen"},
{kCDXBondOrder_ThreeCenter, "threecenter"},
{kCDXBondOrder_SingleOrDouble, "singleordouble"},
{kCDXBondOrder_SingleOrAromatic, "singleoraromatic"},
{kCDXBondOrder_DoubleOrAromatic, "doubleoraromatic"}};

const std::unordered_map<std::string, CDXBondOrder> kBondOrderStrToId = {{"1", kCDXBondOrder_Single},
{"2", kCDXBondOrder_Double},
{"3", kCDXBondOrder_Triple},
{"4", kCDXBondOrder_Quadruple},
{"5", kCDXBondOrder_Quintuple},
{"6", kCDXBondOrder_Sextuple},
{"0.5", kCDXBondOrder_Half},
{"1.5", kCDXBondOrder_OneHalf},
{"2.5", kCDXBondOrder_TwoHalf},
{"3.5", kCDXBondOrder_ThreeHalf},
{"4.5", kCDXBondOrder_FourHalf},
{"5.5", kCDXBondOrder_FiveHalf},
{"dative", kCDXBondOrder_Dative},
{"ionic", kCDXBondOrder_Ionic},
{"hydrogen", kCDXBondOrder_Hydrogen},
{"threecenter", kCDXBondOrder_ThreeCenter},
{"singleordouble", kCDXBondOrder_SingleOrDouble},
{"singleoraromatic", kCDXBondOrder_SingleOrAromatic},
{"doubleoraromatic", kCDXBondOrder_DoubleOrAromatic}};

const std::unordered_map<std::string, CDXArrowType> kCDXProp_Arrow_TypeStrToID = {{"NoHead", kCDXArrowType_NoHead},
{"HalfHead", kCDXArrowType_HalfHead},
{"FullHead", kCDXArrowType_FullHead},
Expand Down
3 changes: 3 additions & 0 deletions core/indigo-core/molecule/molecule_cdxml_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,9 @@ namespace indigo
{
switch (tag)
{
case kCDXProp_Bond_Order: {
return kBondOrderIntToStr.at(val);
}
case kCDXProp_Node_Type: {
return KNodeTypeIntToName.at(val);
}
Expand Down

0 comments on commit a15417c

Please sign in to comment.