Consider the molecule defined by the following SMILES string:

example = "C(/C=C/Cl)Cl"

(the slashes indicate cis/trans isomerism). Molecule[] has no problem interpretting this correctly:


returned Molecule

And a manual call to PubChem via the PUG-REST API works fine too:

  {"smiles" -> example}]  (* "24726" *)

BUT the PubChem Service seems to fail on this input, giving an error about being unable to standardize the given structure:

ServiceExecute["PubChem", "CompoundCID", {"SMILES" -> example}]

error from ServiceExecute

It's definitely an error with handling the isomeric specification, because removing the slashes that define the isomer allows ServiceExecute[] to return successfully:

ServiceExecute["PubChem", "CompoundCID", {"SMILES" -> "C(C=CCl)Cl"}]

returns {24883}

(albeit, this is a different molecule, and hence the wrong answer)

  • $\begingroup$ For these types of SMILES strings you have to supply the SMILES string in POST instead of in the URL. The code doesn't take that into account. $\endgroup$ – Jason B. Dec 13 '19 at 22:41
  • $\begingroup$ I see. So to confirm: the PubChem service execute in Mathematica only works for the subset of PubChem calls that use GET? (and does not switch to POST behind the scenes when necessary?) $\endgroup$ – Joshua Schrier Dec 13 '19 at 23:00
  • 3
    $\begingroup$ It does switch to POST but not for SMILES. I guess the SMILES strings they used to test it were lacking in double-bond stereochemistry. I will file a bug report for it $\endgroup$ – Jason B. Dec 13 '19 at 23:02
  • $\begingroup$ This same problem also extends to SMILES strings containing a triple bond ("#"); A minimum breaking example is acetylene "C#C" ; this might also be useful to include in future tests. $\endgroup$ – Joshua Schrier Dec 15 '19 at 20:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.