5151 "cid" : "cid" ,
5252 "formula" : "formula" ,
5353}
54+ # [{'urn': {'label': 'SMILES', 'name': 'Absolute', 'datatype': 1, 'version': '2.3.0', 'software': 'OEChem', 'source': 'OpenEye Scientific Software', 'release': '2025.04.14'}, 'value': {'sval': 'CCCCCCO'}}, {'urn': {'label': 'SMILES', 'name': 'Connectivity', 'datatype': 1, 'version': '2.3.0', 'software': 'OEChem', 'source': 'OpenEye Scientific Software', 'release': '2025.06.30'}, 'value': {'sval': 'CCCCCCO'}}]
5455MOL_PROPERTY_SOURCES = {
5556 "Log P-XLogP3-AA" : "xlogp" ,
5657 "Log P-XLogP3" : "xlogp" ,
57- "SMILES-Isomeric" : "isomeric_smiles" ,
58- "SMILES-Canonical" : "canonical_smiles" ,
58+ # "SMILES-Isomeric": "isomeric_smiles",
59+ # "SMILES-Canonical": "canonical_smiles",
60+ "SMILES-Absolute" : "isomeric_smiles" ,
61+ "SMILES-Connectivity" : "canonical_smiles" ,
5962 "Molecular Weight" : "molecular_weight" ,
6063 "Compound Complexity" : "complexity" ,
6164 "Count-Rotatable Bond" : "rotatable_bond_count" ,
@@ -432,7 +435,6 @@ def _add_pcy_data(smol, smol_pcy, identifier, identifier_type):
432435 synonyms = pcy .get_synonyms (smol_pcy ["iupac_name" ], "name" )
433436 smol ["synonyms" ] = synonyms [0 ].get ("Synonym" ) if synonyms and len (synonyms ) > 0 else []
434437
435- # Add name
436438 if identifier_type == PCY_IDFR ["name" ]:
437439 smol ["identifiers" ]["name" ] = identifier
438440 elif len (smol .get ("synonyms" , [])) > 1 :
@@ -456,13 +458,17 @@ def _add_pcy_data(smol, smol_pcy, identifier, identifier_type):
456458 # - Before: {"source": "pubchem"}
457459 # - After: { 'label': 'IUPAC Name', 'name': 'Preferred', 'datatype': 1, 'version': '2.7.0',
458460 # 'software': 'Lexichem TK', 'source': 'OpenEye Scientific Software', 'release': '2021.10.14'}
461+
459462 for x in SMOL_PROPERTIES :
460463 smol ["property_sources" ][x ] = {"source" : "PubChem" }
461464 for prop_name , prop_name_key in MOL_PROPERTY_SOURCES .items ():
462465 if prop_name_key == x :
463466 if len (prop_name .split ("-" )) > 0 :
467+
464468 for y in smol_pcy ["record" ]["props" ]:
469+
465470 if "label" not in y ["urn" ]:
471+
466472 pass
467473 elif y ["urn" ]["label" ] == prop_name .split ("-" , maxsplit = 1 )[0 ] and "name" not in y ["urn" ]:
468474 smol ["property_sources" ][x ] = y ["urn" ]
@@ -500,6 +506,14 @@ def _sep_identifiers_from_properties(smol: dict) -> dict:
500506 if prop .lower () in molIdfrs :
501507 del smol ["properties" ][prop ]
502508
509+ # This is a Workaround for Pub Chempy and Pubchem being out of sync
510+ for src in smol ["properties" ]["record" ]["props" ]:
511+ if "urn" in src :
512+ if src ["urn" ]["label" ] == "SMILES" and src ["urn" ]["name" ] == "Absolute" :
513+ smol ["identifiers" ]["isomeric_smiles" ] = src ["value" ]["sval" ]
514+ elif src ["urn" ]["label" ] == "SMILES" and src ["urn" ]["name" ] == "Connectivity" :
515+ smol ["identifiers" ]["canonical_smiles" ] = src ["value" ]["sval" ]
516+
503517 return smol
504518
505519
0 commit comments