Skip to content

Commit 357a9ee

Browse files
authored
Look for Absolute SMILES instead of Canonical
It appears that PubChem has updated their API and they no longer provide a "Canonical" SMILES. Instead, they provide an "Absolute" SMILES with the same info in the same place. Without this fix, the Canvas cannot create Molecule entities, as it raises an error saying that it can't find the SMILES string
1 parent 3616fff commit 357a9ee

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • examples/chem-sync-local-flask/local_app/lib

examples/chem-sync-local-flask/local_app/lib/pub_chem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def get_by_cid(cid: str) -> dict[str, Any]:
4545
synonyms_json = _pubchem_get(f"cid/{cid}/synonyms/JSON")
4646
compound_json = result_json["PC_Compounds"][0]
4747
name = synonyms_json["InformationList"]["Information"][0]["Synonym"][0]
48-
smiles = _get_compound_string_prop(compound_json, label="SMILES", name="Canonical")
48+
smiles = _get_compound_string_prop(compound_json, label="SMILES", name="Absolute")
4949
mono_isotopic_weight = _get_compound_string_prop(compound_json, label="Weight", name="MonoIsotopic")
5050
molecular_weight = _get_compound_string_prop(compound_json, label="Molecular Weight")
5151
return {

0 commit comments

Comments
 (0)