‹›외부 서비스두개의 광학 이성질체 비교
화합물은 그것을 특징짓는 특성이 있으며, 조금이라도 그 성질에 변화가 생기면 다른 특성이 나타납니다. Wolfram 언어를 사용하면 PubChem 데이터에 액세스하여 이러한 특징을 탐구할 수 있습니다.
PubChem API에 연결합니다.
pubchem = ServiceConnect["PubChem"]
Vicks 흡입기와 메스암페타민이라는 두 가지 약물을 예로 들지면, 이 둘 모두 잘 알려진 약물인 동시에 의외로 서로 연관되어 있습니다.
compounds =
pubchem["CompoundProperties", "Name" -> {"Vicks Inhaler", "Meth"},
"Property" -> {"MolecularFormula", "IUPACName"}]
각각의 3D 구조를 찾아 비교합니다.
{vicksid, methid} = Normal[compounds[All, "CompoundID"]];
Row[{pubchem["CompoundSDF", "CompoundID" -> vicksid]["Graphics3D", 1],
pubchem["CompoundSDF", "CompoundID" -> methid]["Graphics3D", 1]}]
위 두 구조는 동일한 것처럼 보이지만 실은 광학 이성질체임을 입증할 수 있습니다. 즉 각각의 결합 구조를 플롯해 보면, 두 구조는 사실 거울에 비친 좌우 반대의 상인 것을 알 수 있습니다.
전체 Wolfram 언어 입력 표시하기
{edgerule1, edgetype1, vertextype1} =
Flatten[Values[
Normal[pubchem["CompoundSDF",
"CompoundID" -> vicksid][{"EdgeRules", "EdgeTypes",
"VertexTypes"}]]], 1];
vertexcoord1 =
Thread[Rule[Range[1, Length[#]], #]] &@
Flatten[Normal[
pubchem["CompoundSDF", "CompoundID" -> vicksid][
"VertexCoordinates"]], 1];
{edgerule2, edgetype2, vertextype2} =
Flatten[Values[
Normal[pubchem["CompoundSDF",
"CompoundID" -> methid][{"EdgeRules", "EdgeTypes",
"VertexTypes"}]]], 1];
vertexcoord2 =
Thread[Rule[Range[1, Length[#]], #]] &@
Flatten[Normal[
pubchem["CompoundSDF", "CompoundID" -> methid][
"VertexCoordinates"]], 1];
normal[{x_, y_}] := 2.5*{-y, x}/Norm[{x, y}];
(Block[{name = #name, edgerule = #edgerules, vertextype = #vertextype,
vertexcoord = #vertexcoord, edgetype = #edgetype},
name -> GraphPlot[edgerule,
VertexRenderingFunction -> (Text[
Style[vertextype[[#2]], Bold], #1, Background -> White] &),
VertexCoordinateRules -> vertexcoord,
EdgeRenderingFunction -> (Switch[
Extract[edgetype,
Position[
edgerule, (Rule @@ #) &@#2]], {"Single"}, {Purple,
Line[#1]}, {"Double"},
norm = normal[First[#1] - Last[#1]]; {Orange,
Thickness[0.005],
Line[{First[#1] + norm, Last[#1] + norm}],
Line[{First[#1] - norm, Last[#1] - norm}]}] &),
ImageSize -> 200]] & /@ {<|"name" -> "Vicks Inhaler",
"edgerules" -> edgerule1, "edgetype" -> edgetype1,
"vertextype" -> vertextype1, "vertexcoord" -> vertexcoord1|>, <|
"name" -> "Methamphetamine", "edgerules" -> edgerule2,
"edgetype" -> edgetype2, "vertextype" -> vertextype2,
"vertexcoord" -> vertexcoord2|>}) // Dataset