Wolfram 语言

更丰富的知识库访问

列举 PCB 结构并通过 EntityStore 分享

多氯联苯(PCB)是化学式为 的有机化合物. PCB 原先被用于包括变压器在内的多种工业用途中. 这里展示了在实体库中作为自定义实体生成和存储的所有可能多氯联苯(PCB).

ChemicalData 已经包含了 PCB 支架和二苯基(通常称之为联二苯).

In[1]:=
Click for copyable input
Entity["Chemical", "Biphenyl"]["ColorStructureDiagram"]
Out[1]=

ChemicalData 还包含了特定的 PCB 分子的同源物.

In[2]:=
Click for copyable input
Entity["Chemical", "PCB"][ EntityProperty["Chemical", "ColorStructureDiagram"]]
Out[2]=

一般的 PCB 结构包含了 10 个位次,用 X 进行标记. 为获取从单氯到十氯的所有可能衍生物(即同源物),必须以所有可能的方式在这 10 个位次与氯取代基相连接. 在此,从预先定义的 CloudObject 中导入表示一般结构的 "MOL" 格式.

In[3]:=
Click for copyable input
molString = CloudGet[CloudObject[ "https://www.wolframcloud.com/objects/user-722de5bb-ef39-4cbd-\ 999d-546c888892d6/PCB_scaffold"]][[2]];
In[4]:=
Click for copyable input
ImportString[molString, "MOL"]
Out[4]=

用一些基本的群理论,我们可以列举所有 PCB 结构. 出发点是整个支架的基本对称属性,表示为一个置换群.

In[5]:=
Click for copyable input
biphenylSymmetry = PermutationGroup[{Cycles[{{6, 10}, {7, 9}}], Cycles[{{1, 5}, {2, 4}}], Cycles[{{1, 6}, {2, 7}, {3, 8}, {4, 9}, {5, 10}}]}];

依据 Pólya 计数定理构成循环指标多项式,并通过处理其系数获得 210 种同源物(包括未被取代的碳水结构,由于其缺少氯并不属于 PCB).

In[6]:=
Click for copyable input
ci = Factor[ CycleIndexPolynomial[biphenylSymmetry, Array[Subscript[x, #] &, 4]]]
Out[6]=
In[7]:=
Click for copyable input
Total[CoefficientList[Expand[ci /. Subscript[x, i_] -> (x^i + 1)], x]]
Out[7]=

在用简单的字符串替代重新命名位次的位置后,生成了全部 209 个 IUPAC 适用名称.

In[8]:=
Click for copyable input
conPos = Flatten[(PositionIndex /@ First /@ GroupOrbits[biphenylSymmetry, Permutations[#], Permute]) & /@ (LowerTriangularize[ ConstantArray["Cl", {10, 10}]] /. 0 -> "H")] /. Thread[Range[10] -> {"2", "3", "4", "5", "6", "2'", "3'", "4'", "5'", "6'"}];
In[9]:=
Click for copyable input
(names = Flatten[{StringJoin[Riffle[Sort[#["Cl"]], ","]] <> "-" <> (Length[#["Cl"]] /. Thread[Range[10] -> {"Chloro", "Dichloro", "Trichloro", "Tetrachloro", "Pentachloro", "Hexachloro", "Heptachloro", "Octachloro", "Nonachloro", "Decachloro"}]) <> "biphenyl"} & /@ conPos] /. "2,2',3,3',4,4',5,5',6,6'-Decachlorobiphenyl" -> "Decachlorobiphenyl") // Short
Out[9]//Short=

以相同次序,可以详细生成所有同源物的结构.

In[10]:=
Click for copyable input
PCBstruct = ImportString[ StringReplacePart[molString, #, StringPosition[molString, "X"]], "MOL"] & /@ Flatten[(First /@ GroupOrbits[biphenylSymmetry, Permutations[#], Permute]) & /@ (LowerTriangularize[ ConstantArray["Cl", {10, 10}]] /. 0 -> "H"), 1];
In[11]:=
Click for copyable input
TextGrid[Transpose[{names, PCBstruct}] // Take[#, 2] &, Dividers -> All]
Out[11]=

为包括关于同源物更加详细的属性,从一个预先计算的 CloudObject 将 PCB 作为数据集导入.

In[12]:=
Click for copyable input
imp = CloudGet[CloudObject[ "https://www.wolframcloud.com/objects/user-722de5bb-ef39-4cbd-\ 999d-546c888892d6/PCB_congeners_propertylist"]];
In[13]:=
Click for copyable input
TextGrid[Take[imp, 5], Background -> {Automatic, {LightBlue}}, Dividers -> All]
Out[13]=

将导入的数据和以前计算的结构和名称相结合.

In[14]:=
Click for copyable input
TextGrid[(PCBdata = SortBy[MapThread[ Flatten[{#1, Pick[imp[[3 ;;]], imp[[3 ;;, 1]], #2]}] &, {PCBstruct, names}], #[[3]] &]) // Take[#, 2] &, Dividers -> All]
Out[14]=

对这些 PCB 结构创建自定义实体库.

显示完整的 Wolfram 语言输入
In[15]:=
Click for copyable input
entities = Association @@ Map["PCB" <> ToString[#[[3]]] -> <| "ColorStructureDiagram" -> #[[1]], "IUPACName" -> #[[2]], "CASNumber" -> #[[4]], "BZNumber" -> #[[3]], "PCBDescriptors" -> #[[5]], "Label" -> "PCB-BZ#" <> ToString[#[[3]]] |> &, PCBdata];
In[16]:=
Click for copyable input
properties = <| "ColorStructureDiagram" -> <|"Label" -> "structure diagram"|>, "IUPACName" -> <|"Label" -> "IUPAC name"|>, "CASNumber" -> <|"Label" -> "CAS number"|>, "BZNumber" -> <|"Label" -> "Ballschmiter-Zell number"|>, "PCBDescriptors" -> <|"Label" -> "congener shorthand notation"|>, "Toxicity" -> <| "DefaultFunction" -> Function[e, If[StringCount[e["PCBDescriptors"], ","] == 3, "highly toxic", "toxic"]], "Label" -> "dioxin-like toxicity" |>, "NumberOfChlorineSubstituents" -> <| "DefaultFunction" -> Function[e, If[e["IUPACName"] == "Decachlorobiphenyl", 10, StringCount[e["IUPACName"], NumberString]]], "Label" -> "number of chlorine substituents" |> |>;
In[17]:=
Click for copyable input
classes = <| "CoplanarPCB" -> <| "Entities" -> {"IUPACName" -> (StringFreeQ[ "2" | "2'" | "6" | "6'" | "Deca"])}, "Label" -> "Coplanar or non-ortho PCBs" |>, "NoncoplanarPCB" -> <| "Entities" -> {"IUPACName" -> StringContainsQ["2" | "2'" | "6" | "6'"]}, "Label" -> "Noncoplanar PCBs" |> |>;
In[18]:=
Click for copyable input
store = EntityStore[ "PCB" -> <| "Label" -> "polychlorinated biphenyl", "LabelPlural" -> "polychlorinated biphenyls", "Entities" -> entities, "Properties" -> properties, "EntityClasses" -> classes |>]
Out[18]=

注册该部分存储.

In[19]:=
Click for copyable input
PrependTo[$EntityStores, store];

通过调用随机实体测试该实体存储.

In[20]:=
Click for copyable input
EntityValue[RandomEntity["PCB"], "PropertyAssociation"]
Out[20]=

为使所有用户自定义实体可以在未来会话和公开应用中使用,将实体存储写到 CloudObject.

In[21]:=
Click for copyable input
CloudPut[store, "PCB_entity_store", Permissions -> "Public"]
Out[21]=

相关范例

de en es fr ja ko pt-br ru