Function Repository Resource:

TopolyFunction

Source Notebook

Obtain topological information of polymers or biopolymers and other simple or complex structures

Contributed by: Wolfram Staff

ResourceFunction["TopolyFunction"][{"func",args,opts}]

returns the result of applying the topology function "func" to the specified arguments args using the options opts.

ResourceFunction["TopolyFunction"]["Information",comp]

gives an association with information about the component comp.

ResourceFunction["TopolyFunction"][,session]

uses the specified running ExternalSessionObject session.

Details

ResourceFunction["TopolyFunction"] is a wrapper for the Python package Topoly. The package is installed automatically, as neccessary, using the the resource function PythonEvaluateWithDependencies.
ResourceFunction["TopolyFunction"] distinguishes knots, slipknots, links and spatial graphs through the calculation of topological polynomial invariants of a structure; identifies lasso types; creates minimal spanning surfaces; and generates random closed polymers.
The Python package Topoly and therefore ResourceFunction["TopolyFunction"] are not supported in Windows.
In ResourceFunction["TopolyFunction"][{"func",structure,}] and ResourceFunction["TopolyFunction"][{"func",chain,}], structure or chain can refer to a local or remote file or a Wolfram Language expression.
Files can be specified using a string giving a relative or absolute path to a local file, a File object or a URL object.
Accepted file formats include:
"XYZ"coordinates in the three or four-column format (with index)
"PDB"protein structure
"CIF"crystallographic structure
"WL", "MATH"coordinates in the Wolfram Language format
Accepted forms of expressions include:
{{x1,y1,z1},}list of coordinates
"pdcode"planar diagram code string
"emcode"Ewing–Millett code string
Planar diagram (PD) code and Ewing–Millett (EM) codes are explained in the PD code and EM code section of the Topoly Dictionary.
Structures can be modified using the following functions:
"StructureClose"connects loose ends
"StructureReduce"reduces the number of crossings
Functions that are capable of automatically performing structure modifications accept the options "Closure" and "ReductionMethod" with the same option values as "StructureClose" and "StructureReduce", respectively.
The method for connecting loose ends is chosen using the "Closure" option, which involves either a straight line or a path along an encompassing sphere with the center at the geometric center of the structure. The available methods include:
"CLOSED"straight line
"MASS_CENTER"endpoints projections in the direction from the center of mass
"DIRECTION"parallel segments from the endpoints in a chosen direction
"ONE_POINT"the endpoints connected to a single randomly chosen point
"TWO_POINTS"two random points (default)
"RAYS"parallel segments from the endpoints in a random direction
The structure reduction method is chosen usign the option "ReductionMethod" with the following possible values:
"KMT"Koniaris–Muthukumar–Taylor algorithm
"REIDEMEISTER"Reidemeister moves
"EASY"deterministic Reidemeister moves
ResourceFunction["TopolyFunction"]["Properties"] gives a list of the available function properties.
Functions for calculating topological invariants include:
"AlexanderPolynomial"Alexander polynomial
"APSBracket"APS bracket
"BLMHoPolynomial"BLM/Ho polynomial
"ConwayPolynomial"Conway polynomial
"HOMFLYPolynomial"HOMFLY polynomial
"JonesPolynomial"Jones polynomial
"KauffmanBracket"Kauffman bracket
"KauffmanPolynomial"Kauffman two-variable polynomial
"Writhe"writhe
"YamadaPolynomial"Yamada polynomial
With the default value of the option "Matrix"False, invariant functions generally return the topology type for deterministic values of the option "Closure" and an association of topology types and their probabilities for randomized values of "Closure". For "Matrix"True, these values are returned in an association with subchain indices as keys.
When detected, the polynomial notations for topology type strings returned by the Python code are converted to Wolfram Language expressions as follows:
"n_k"Alexander–Briggs notation nk
"i1 i2 i3"polynomial coefficient lists {i1,i2,i3,}
"polynomial"polynomial as a pure function
Functions for analyzing subchain topology include:
"GaussLinkingNumber"Gauss linking number (GLN) between two chains
"FindSpots"centers of fields in the knotting fingerprint matrix
"MatrixConvert"converts between fingeprint matrix formats
Functions for the lasso type identification include:
"LassoType"lasso types for loops
"MinimalSurfaceMesh"triangulated minimal surface spanning a loop
Functions for finding loops, links, theta-curves and handcuffs include:
"FindLoops"loops
"FindLinks"links
"FindThetas"theta-curves
"FindHandcuffs"handcuffs
Functions for converting between different structure representations include:
{"TopologyTypeToPDCode","type"}topology type to PD code
{"StructureConvert","code"}PD code to EM code and vice versa
{"CoefficientsToTopologyType",coef,"invariant"}polynomial coefficients to topology type
Coefficients coef can be given as:
{c1,c2,}list
"c1 c2 …"string of space-delimited coefficients
<|coef1prob1,|>association of coefficients and their probabilities
Possible specifications for "invariant" include:
"Alexander"Alexander polynomial
"Jones"Jones polynomial
"Conway"Conway polynomial
"HOMFLY"HOMFLY polynomial
"Yamada"Yamada polynomial
"APS"APS bracket
Functions that generate coordinates of n random polygons include:
{"RandomWalk",k,n}k-step random walks
{"RandomLoop",k,n}length k loops
{"RandomLasso",k,l,n}lassos with loop length of k and tail length of l
{"RandomHandcuff",{k,l},m,n}handcuffs with loops of length k and l and tail length of m
{"RandomLink",{k,l},d,n}loop pairs of length k and l and distance between their geometric centers of d
In ResourceFunction["TopolyFunction"]["Information",comp,], comp can be a function name or a parameter class. Possible elements of the returned association include:
"Arguments"arguments of the function
"Options"options of the function
"Values"possible values of the component
ResourceFunction["TopolyFunction"]["PropertyRules"] provides a mapping between the property names and the underlying Python-side names.
ResourceFunction["TopolyFunction"]["RawInformation",func,] returns a string representing the Python-side help for the function func.
In ResourceFunction["TopolyFunction"], strings representing function names, option names and option values can be given as either property names or Python-side names.

Examples

Basic Examples (4) 

Obtain the topological type of a knot given a list of spatial coordinates:

In[1]:=
coordinates = {{0.3, 1.3, -0.7}, {-1., -0.9, 0.7}, {1., -0.9, -0.7}, {-0.3, 1.3, 0.7}, {-1.3, -0.4, -0.7}, {1.3, -0.4, 0.7}};
In[2]:=
Graphics3D[Tube[BSplineCurve[%], .1]]
Out[2]=
In[3]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", coordinates, "Closure" -> "CLOSED"}]
Out[3]=

Download a PDB file for the human obesity protein 1AX8 from the RCSB server:

In[4]:=
file = URLDownload["https://files.rcsb.org/view/1AX8.pdb"];

Display the molecule:

In[5]:=
Import[file]
Out[5]=

Find all the loops in the structure:

In[6]:=
 ResourceFunction["TopolyFunction"][{"FindLoops", file}] // Short
Out[6]=

Display the loops (in this case, a single loop):

In[7]:=
Graphics3D[Tube[#, .5] & /@ %]
Out[7]=

Construct a wireframe of a minimal surface spanning a chain representing a knot:

In[8]:=
coordinates = CompressedData["
1:eJwBeQSG+yFib1JlAgAAAC8AAAADAAAADvYmhuQEFMDqXbwft58BwIYBS65i
ceU/MSdok8OHE8DB/YAHBtAIwCB8KNGSx7e/yHvVyoSPEcASiNf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v71tpkI80v6/sFjDRe55EkD0Fg/v
ObDIvxr9aDhlTgLAzeUGQx2WDUDzc0NTdvrhPwT/W8mOzQLA6/8c5ssrBUBO
7KF9rCDxP2X7kLdcnQDA6ZjzjH3J+T/wplt2iP/0PyhlUkMbwPe/kL3e/fHe
5T/yXrUy4df1P1+y8WCL3eS/Wf0RhgFLyL/H8q56wLz1P7QfKSLDKtE/6Q5i
Zwod8r+371F/vYL0P5bP8jy4O/E/T+rL0k5tAcBWf4RhwBLwP+wX7IZtC/o/
PL1SliHOCcC1iv7QzJPdPxh7L75oj/0/Tweynlp9EMCEK6BQTx/Uv76lnC/2
nvs/Dwu1pnn3EsDM64hDNtDzvytu3GJ+7vQ/qY04HQ==
"];

Construct the minimal surface mesh:

In[9]:=
mesh = ResourceFunction[
  "TopolyFunction"][{"MinimalSurfaceMesh", coordinates, "LoopIndices" -> {1, Length[coordinates]}}]
Out[9]=

Obtain a list of coordinates for triangles that form the mesh:

In[10]:=
First /@ MeshPrimitives[mesh, 2] // Short
Out[10]=

Display the triangles:

In[11]:=
Graphics3D[Triangle[%]]
Out[11]=

Generate random lasso structures:

In[12]:=
(lassos = ResourceFunction["TopolyFunction"][{"RandomLasso", 4, 2, 3}])
Out[12]=
In[13]:=
Graphics3D[{Thick, Red, BSplineCurve[#]}] & /@ lassos
Out[13]=

Scope (29) 

Accepted structures: Local or remote files (4) 

Use a local PDB file (in this case, downloaded from a URL):

In[14]:=
file = URLDownload["https://files.rcsb.org/view/1AX8.pdb"]
Out[14]=
In[15]:=
 ResourceFunction["TopolyFunction"][{"FindLoops", file}] // Short
Out[15]=

Use a remote file directly by specifying its URL:

In[16]:=
 ResourceFunction[
  "TopolyFunction"][{"FindLoops", URL["https://files.rcsb.org/view/1AX8.pdb"]}] // Short
Out[16]=

Give file specification as a string representing the absolute path to the file:

In[17]:=
file = URLDownload["https://files.rcsb.org/view/1AX8.pdb"];
In[18]:=
CopyFile[file, FileNameJoin[{$TemporaryDirectory, "myFile"}]]
Out[18]=
In[19]:=
 ResourceFunction["TopolyFunction"][{"FindLoops", %}] // Short
Out[19]=

Use a path relative to the current working directory:

In[20]:=
SetDirectory[$TemporaryDirectory];
In[21]:=
 ResourceFunction["TopolyFunction"][{"FindLoops", "myFile"}] // Short
Out[21]=

Reset directory to clean up:

In[22]:=
ResetDirectory[];

Accepted structures: File formats (4) 

Use a PDB file:

In[23]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", URL["https://files.rcsb.org/view/7B6E.pdb"], "Closure" -> "CLOSED"}]
Out[23]=

Use a CIF file:

In[24]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", URL["https://files.rcsb.org/view/7B6E.cif"], "Closure" -> "CLOSED"}]
Out[24]=

Use an XYZ file:

In[25]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", URL["https://people.math.sc.edu/Burkardt/data/xyz/helix_201.xyz"], "Closure" -> "CLOSED"}]
Out[25]=

Use a file containing a string representing a Wolfram Language list of coordinates:

In[26]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", URL["https://raw.githubusercontent.com/ilbsm/topoly_tutorial/master/data/1j85.math"], "Closure" -> "CLOSED"}]
Out[26]=

Accepted structures: Expressions (4) 

Use a Wolfram Language list of 3D coordinates:

In[27]:=
xyz = {{0.3, 1.3, -0.7}, {-1., -0.9, 0.7}, {1., -0.9, -0.7}, {-0.3, 1.3, 0.7}, {-1.3, -0.4, -0.7}, {1.3, -0.4, 0.7}};
In[28]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", xyz, "Closure" -> "CLOSED"}]
Out[28]=

Use coordinates with indices:

In[29]:=
nxyz = {{1, 0.3, 1.3, -0.7}, {2, -1., -0.9, 0.7}, {3, 1., -0.9, -0.7}, {4, -0.3, 1.3, 0.7}, {5, -1.3, -0.4, -0.7}, {6, 1.3, -0.4, 0.7}};
In[30]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", nxyz, "Closure" -> "CLOSED"}]
Out[30]=

Use a PD code string:

In[31]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", "V[1,8];X[1,0,3,2];X[0,6,7,3];X[6,8,2,7]"}]
Out[31]=

Use an EM code string:

In[32]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", "1V2b4a;2+3b1V4d3c;3+4b2a2d4c;4+1V3a3d2c"}]
Out[32]=

Structure manipulation (2) 

Define an auxiliary function to display a closed curve and connect loose ends of a structure using different methods:

In[33]:=
joinEnds[{f_, rest___}] := {f, rest, f}
In[34]:=
coordinates = CompressedData["
1:eJwBeQSG+yFib1JlAgAAAC8AAAADAAAADvYmhuQEFMDqXbwft58BwIYBS65i
ceU/MSdok8OHE8DB/YAHBtAIwCB8KNGSx7e/yHvVyoSPEcASiNf1C7YOwOtv
CcA/Jey/ZohjXdymDMCBBps6j1oRwBFvnX+7bPm/wf7r3LRZBMAqWONsOjIS
wPCICtXNBQHAfZQRF4BG9r+SeeQPBs4RwNydtdsuVAPA3795ceKr0L9cWaKz
zEIQwLMmFviKLgPAyorh6gAI5z89uaZAZqcLwPFFe7yQbgDA93XgnBFl9z+P
3nAfudUFwI+Oq5Fdqfa/yO2XT1bM/z88M8FwrqH/v0aaeAd4UuK/SL99HThH
A0C1+1WA7zbzv1LWbyamC9U/trqcEhATBkAgf2lRn+TSv1RweEFEqvE/kWKA
RBOIB0CYT1YMV4fpPxy2Lcps0Pk/wmosYW3sBkDLMO4G0dr/P9BjlGdejvw/
QS5x5IEIBEBvZ195kP4IQBRAMbJkzvk/taZ5xyk6/j/jVGthFioQQBxDAHDs
WfI/WvROBdxz8T+ZoIZvYX0SQHSWWYRiK94/7wOQ2sTJyT8dd0oH6y8TQDHs
MCb9vdO/YvVHGAas5b9txmmIKiwSQC/Df7qBQvG/uI/cmnQb97+chqjCnyEP
QLYvoBfunPu/Ag02dR4VAMBOYDqt22AHQHkj88gfLAHAYASNmUR9AsBZ+zvb
ozf8P6c8uhEWFQLAAb9GkiCcAsCISiNm9nniP9Ww3xPrNADA7j1cctzJAMBP
yTmxh/bevziEKjV7YPe/V+nuOhuy+78jSnuDL8z1v+0rD9JT5OS/KqkT0ETY
9L+HGK95VScBwBaE8j6O5s4/v5tu2SH+578TZtr+lVUHwNb/OcyXl/A/u0Vg
rG9goj++S6lLxjENwFRXPsvzoPk/Dat4I/PI8D+hTQ6fdPIQwN3vUBTo0/0/
sg3cgTqFAUApdck4RlISwAx4mWGj7Pw/mkS94NOcCkBZi08BMH4SwFPqknGM
ZPc/WU5C6QtREUCBtP8B1moRwJIHIos0cew/O2743XRbFED53An2X2cOwJ8F
obyPo8U/4uoAiLsaFkAz+zxGeSYIwLwH6L6cWeO/944aE2JeFkBvERjrG7gA
wEgyq3e4XfW/iEfi5ekcFUAhV+pZEMrxv71tpkI80v6/sFjDRe55EkD0Fg/v
ObDIvxr9aDhlTgLAzeUGQx2WDUDzc0NTdvrhPwT/W8mOzQLA6/8c5ssrBUBO
7KF9rCDxP2X7kLdcnQDA6ZjzjH3J+T/wplt2iP/0PyhlUkMbwPe/kL3e/fHe
5T/yXrUy4df1P1+y8WCL3eS/Wf0RhgFLyL/H8q56wLz1P7QfKSLDKtE/6Q5i
Zwod8r+371F/vYL0P5bP8jy4O/E/T+rL0k5tAcBWf4RhwBLwP+wX7IZtC/o/
PL1SliHOCcC1iv7QzJPdPxh7L75oj/0/Tweynlp9EMCEK6BQTx/Uv76lnC/2
nvs/Dwu1pnn3EsDM64hDNtDzvytu3GJ+7vQ/qY04HQ==
"];
In[35]:=
Table[Graphics3D[{Line[
    joinEnds@ ResourceFunction[
      "TopolyFunction"][{"StructureClose", coordinates, "Closure" -> closure}]], {Thick, Red, Line[coordinates]}}, PlotLabel -> closure], {closure, ResourceFunction["TopolyFunction"]["Information", "Closure"][
   "Values"]}]
Out[35]=

Obtain randomized closures using one of the last three methods:

In[36]:=
closure = "TWO_POINTS";
In[37]:=
Table[Graphics3D[{Line[
    joinEnds@ ResourceFunction[
      "TopolyFunction"][{"StructureClose", coordinates, "Closure" -> closure}]], {Thick, Red, Line[coordinates]}}, PlotLabel -> closure], {3}]
Out[37]=

Function list (2) 

Available property functions:

In[38]:=
 ResourceFunction["TopolyFunction"]["Properties"]
Out[38]=

Arguments and options of a function:

In[39]:=
 ResourceFunction["TopolyFunction"]["Information", "BLMHoPolynomial"]
Out[39]=

Topological invariants (3) 

Given a list of coordinates of a structure, determine its topology by calculating the Alexander polynomial:

In[40]:=
coordinates = CompressedData["
1:eJwBeQSG+yFib1JlAgAAAC8AAAADAAAADvYmhuQEFMDqXbwft58BwIYBS65i
ceU/MSdok8OHE8DB/YAHBtAIwCB8KNGSx7e/yHvVyoSPEcASiNf1C7YOwOtv
CcA/Jey/ZohjXdymDMCBBps6j1oRwBFvnX+7bPm/wf7r3LRZBMAqWONsOjIS
wPCICtXNBQHAfZQRF4BG9r+SeeQPBs4RwNydtdsuVAPA3795ceKr0L9cWaKz
zEIQwLMmFviKLgPAyorh6gAI5z89uaZAZqcLwPFFe7yQbgDA93XgnBFl9z+P
3nAfudUFwI+Oq5Fdqfa/yO2XT1bM/z88M8FwrqH/v0aaeAd4UuK/SL99HThH
A0C1+1WA7zbzv1LWbyamC9U/trqcEhATBkAgf2lRn+TSv1RweEFEqvE/kWKA
RBOIB0CYT1YMV4fpPxy2Lcps0Pk/wmosYW3sBkDLMO4G0dr/P9BjlGdejvw/
QS5x5IEIBEBvZ195kP4IQBRAMbJkzvk/taZ5xyk6/j/jVGthFioQQBxDAHDs
WfI/WvROBdxz8T+ZoIZvYX0SQHSWWYRiK94/7wOQ2sTJyT8dd0oH6y8TQDHs
MCb9vdO/YvVHGAas5b9txmmIKiwSQC/Df7qBQvG/uI/cmnQb97+chqjCnyEP
QLYvoBfunPu/Ag02dR4VAMBOYDqt22AHQHkj88gfLAHAYASNmUR9AsBZ+zvb
ozf8P6c8uhEWFQLAAb9GkiCcAsCISiNm9nniP9Ww3xPrNADA7j1cctzJAMBP
yTmxh/bevziEKjV7YPe/V+nuOhuy+78jSnuDL8z1v+0rD9JT5OS/KqkT0ETY
9L+HGK95VScBwBaE8j6O5s4/v5tu2SH+578TZtr+lVUHwNb/OcyXl/A/u0Vg
rG9goj++S6lLxjENwFRXPsvzoPk/Dat4I/PI8D+hTQ6fdPIQwN3vUBTo0/0/
sg3cgTqFAUApdck4RlISwAx4mWGj7Pw/mkS94NOcCkBZi08BMH4SwFPqknGM
ZPc/WU5C6QtREUCBtP8B1moRwJIHIos0cew/O2743XRbFED53An2X2cOwJ8F
obyPo8U/4uoAiLsaFkAz+zxGeSYIwLwH6L6cWeO/944aE2JeFkBvERjrG7gA
wEgyq3e4XfW/iEfi5ekcFUAhV+pZEMrxv71tpkI80v6/sFjDRe55EkD0Fg/v
ObDIvxr9aDhlTgLAzeUGQx2WDUDzc0NTdvrhPwT/W8mOzQLA6/8c5ssrBUBO
7KF9rCDxP2X7kLdcnQDA6ZjzjH3J+T/wplt2iP/0PyhlUkMbwPe/kL3e/fHe
5T/yXrUy4df1P1+y8WCL3eS/Wf0RhgFLyL/H8q56wLz1P7QfKSLDKtE/6Q5i
Zwod8r+371F/vYL0P5bP8jy4O/E/T+rL0k5tAcBWf4RhwBLwP+wX7IZtC/o/
PL1SliHOCcC1iv7QzJPdPxh7L75oj/0/Tweynlp9EMCEK6BQTx/Uv76lnC/2
nvs/Dwu1pnn3EsDM64hDNtDzvytu3GJ+7vQ/qY04HQ==
"];
In[41]:=
Graphics3D[{Thick, Red, Line[coordinates]}]
Out[41]=
In[42]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", coordinates, "Closure" -> "CLOSED"}]
Out[42]=

Find polynomial coefficients:

In[43]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", coordinates, "ReducedPolynomials" -> True, "Translate" -> False, "Closure" -> "CLOSED"}]
Out[43]=

Find the explicit pure-function form of the Alexander polynomial for the knot:

In[44]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", coordinates, "ReducedPolynomials" -> False, "Translate" -> False, "Closure" -> "CLOSED"}]
Out[44]=

Given the same structure, find the pure-function forms of the different invariants:

In[45]:=
coordinates = CompressedData["
1:eJwBeQSG+yFib1JlAgAAAC8AAAADAAAADvYmhuQEFMDqXbwft58BwIYBS65i
ceU/MSdok8OHE8DB/YAHBtAIwCB8KNGSx7e/yHvVyoSPEcASiNf1C7YOwOtv
CcA/Jey/ZohjXdymDMCBBps6j1oRwBFvnX+7bPm/wf7r3LRZBMAqWONsOjIS
wPCICtXNBQHAfZQRF4BG9r+SeeQPBs4RwNydtdsuVAPA3795ceKr0L9cWaKz
zEIQwLMmFviKLgPAyorh6gAI5z89uaZAZqcLwPFFe7yQbgDA93XgnBFl9z+P
3nAfudUFwI+Oq5Fdqfa/yO2XT1bM/z88M8FwrqH/v0aaeAd4UuK/SL99HThH
A0C1+1WA7zbzv1LWbyamC9U/trqcEhATBkAgf2lRn+TSv1RweEFEqvE/kWKA
RBOIB0CYT1YMV4fpPxy2Lcps0Pk/wmosYW3sBkDLMO4G0dr/P9BjlGdejvw/
QS5x5IEIBEBvZ195kP4IQBRAMbJkzvk/taZ5xyk6/j/jVGthFioQQBxDAHDs
WfI/WvROBdxz8T+ZoIZvYX0SQHSWWYRiK94/7wOQ2sTJyT8dd0oH6y8TQDHs
MCb9vdO/YvVHGAas5b9txmmIKiwSQC/Df7qBQvG/uI/cmnQb97+chqjCnyEP
QLYvoBfunPu/Ag02dR4VAMBOYDqt22AHQHkj88gfLAHAYASNmUR9AsBZ+zvb
ozf8P6c8uhEWFQLAAb9GkiCcAsCISiNm9nniP9Ww3xPrNADA7j1cctzJAMBP
yTmxh/bevziEKjV7YPe/V+nuOhuy+78jSnuDL8z1v+0rD9JT5OS/KqkT0ETY
9L+HGK95VScBwBaE8j6O5s4/v5tu2SH+578TZtr+lVUHwNb/OcyXl/A/u0Vg
rG9goj++S6lLxjENwFRXPsvzoPk/Dat4I/PI8D+hTQ6fdPIQwN3vUBTo0/0/
sg3cgTqFAUApdck4RlISwAx4mWGj7Pw/mkS94NOcCkBZi08BMH4SwFPqknGM
ZPc/WU5C6QtREUCBtP8B1moRwJIHIos0cew/O2743XRbFED53An2X2cOwJ8F
obyPo8U/4uoAiLsaFkAz+zxGeSYIwLwH6L6cWeO/944aE2JeFkBvERjrG7gA
wEgyq3e4XfW/iEfi5ekcFUAhV+pZEMrxv71tpkI80v6/sFjDRe55EkD0Fg/v
ObDIvxr9aDhlTgLAzeUGQx2WDUDzc0NTdvrhPwT/W8mOzQLA6/8c5ssrBUBO
7KF9rCDxP2X7kLdcnQDA6ZjzjH3J+T/wplt2iP/0PyhlUkMbwPe/kL3e/fHe
5T/yXrUy4df1P1+y8WCL3eS/Wf0RhgFLyL/H8q56wLz1P7QfKSLDKtE/6Q5i
Zwod8r+371F/vYL0P5bP8jy4O/E/T+rL0k5tAcBWf4RhwBLwP+wX7IZtC/o/
PL1SliHOCcC1iv7QzJPdPxh7L75oj/0/Tweynlp9EMCEK6BQTx/Uv76lnC/2
nvs/Dwu1pnn3EsDM64hDNtDzvytu3GJ+7vQ/qY04HQ==
"];
In[46]:=
Table[{poly, ResourceFunction[
    "TopolyFunction"][{poly, coordinates, "ReducedPolynomials" -> False, "Translate" -> False, "Closure" -> "CLOSED"}]}, {poly, Select[ ResourceFunction["TopolyFunction"]["Properties"], StringContainsQ[#, "Polynomial"] &]}] // Grid
Out[46]=

Use the default (stochastic) method to find the probabilities of different topologies:

In[47]:=
coordinates = CompressedData["
1:eJwBeQSG+yFib1JlAgAAAC8AAAADAAAADvYmhuQEFMDqXbwft58BwIYBS65i
ceU/MSdok8OHE8DB/YAHBtAIwCB8KNGSx7e/yHvVyoSPEcASiNf1C7YOwOtv
CcA/Jey/ZohjXdymDMCBBps6j1oRwBFvnX+7bPm/wf7r3LRZBMAqWONsOjIS
wPCICtXNBQHAfZQRF4BG9r+SeeQPBs4RwNydtdsuVAPA3795ceKr0L9cWaKz
zEIQwLMmFviKLg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e/kL3e/fHe
5T/yXrUy4df1P1+y8WCL3eS/Wf0RhgFLyL/H8q56wLz1P7QfKSLDKtE/6Q5i
Zwod8r+371F/vYL0P5bP8jy4O/E/T+rL0k5tAcBWf4RhwBLwP+wX7IZtC/o/
PL1SliHOCcC1iv7QzJPdPxh7L75oj/0/Tweynlp9EMCEK6BQTx/Uv76lnC/2
nvs/Dwu1pnn3EsDM64hDNtDzvytu3GJ+7vQ/qY04HQ==
"];
In[48]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", coordinates}]
Out[48]=

List the most probable topology first:

In[49]:=
Sort[%] // Reverse
Out[49]=

Subchain topology: Fingerprint matrix (6) 

Construct a list of coordinates of a 51 knot:

In[50]:=
g = KnotData[{5, 1}, "SpaceCurve"]
Out[50]=
In[51]:=
coordinates51 = Table[g[t], {t, 0, 2 Pi, .1}];
In[52]:=
Graphics3D[Tube[coordinates51, .1]]
Out[52]=

Find the subchain matrix in the form of an association, storing the fingerprint matrix in the home directory:

In[53]:=
filename = "map_knot_5_1";
In[54]:=
PrintTemporary["This may take a while..."];
(assoc = ResourceFunction[
    "TopolyFunction"][{"ConwayPolynomial", coordinates51, "Tries" -> 10, "Matrix" -> True, "MatrixMap" -> True, "MapFilename" -> filename}]) // Short
Out[54]=

Combine inner associations of the subchains into sparse arrays for each topology:

In[55]:=
arrays = ResourceFunction[
  "TopolyFunction"][{"MatrixConvert", assoc, "OutputFormat" -> "Matrix"}]
Out[55]=

Find representative subchains:

In[56]:=
spots = ResourceFunction[
  "TopolyFunction"][{"FindSpots", assoc, "GapSize" -> 0, "SpotSize" -> 10}]
Out[56]=

Plot fingerprint matrices of the representative subchains:

In[57]:=
KeyValueMap[
 MatrixPlot[#2, PlotLabel -> #1, ColorFunction -> "TemperatureMap"] &,
  KeyTake[arrays, Keys[spots]]]
Out[57]=

Obtain a Topoly plot of the fingerprint matrix:

In[58]:=
Import[FileNameJoin[{$HomeDirectory, filename <> ".png"}]]
Out[58]=

Subchain topology: Gauss linking number (2) 

Download coordinates of the Hopf link from the Knot Server and obtain a representation of the linked chains:

In[59]:=
(Drop[Import[
     "http://www.colab.sfu.ca/KnotPlot/KnotServer/coord/253.html", "Table"], 5] // Most) // Short
Out[59]=
In[60]:=
({link1, link2} = DeleteCases[SplitBy[%, Length], {{}}]) // Short
Out[60]=
In[61]:=
Graphics3D[Tube /@ {link1, link2}]
Out[61]=

Find the Gauss linking number (GLN) between the chains:

In[62]:=
 ResourceFunction[
 "TopolyFunction"][{"GaussLinkingNumber", link1, link2}]
Out[62]=

Reversing one of the chains changes the sign of the Gauss linking number:

In[63]:=
 ResourceFunction[
 "TopolyFunction"][{"GaussLinkingNumber", Reverse[link1], link2}]
Out[63]=

Create a matrix of GLN values between link1 and all possible subchains of link2:

In[64]:=
(gln = ResourceFunction[
    "TopolyFunction"][{"GaussLinkingNumber", link1, link2, "Matrix" -> True}]) // Short
Out[64]=

Plot the matrix:

In[65]:=
MatrixPlot[gln["matrix"]]
Out[65]=

Obtain a Topoly plot of the same matrix, saved under a chosen filename in the home directory:

In[66]:=
filename = "gln_map_hl";
In[67]:=
 ResourceFunction[
  "TopolyFunction"][{"GaussLinkingNumber", link1, link2, "MatrixMap" -> True, "MapFilename" -> filename}] // Short
Out[67]=
In[68]:=
Import[FileNameJoin[{$HomeDirectory, filename <> ".png"}]]
Out[68]=

More strongly entangled links:

In[69]:=
(Drop[Import[
     "http://www.colab.sfu.ca/KnotPlot/KnotServer/coord/267.html", "Table"], 5] // Most) // Short
Out[69]=
In[70]:=
({link1, link2} = DeleteCases[SplitBy[%, Length], {{}}]) // Short
Out[70]=
In[71]:=
Graphics3D[Tube[#, .25] & /@ {link1, link2}]
Out[71]=
In[72]:=
 ResourceFunction[
 "TopolyFunction"][{"GaussLinkingNumber", link1, link2}]
Out[72]=

External session (2) 

Make several calls to TopolyFunction in the same external session:

In[73]:=
session = StartExternalSession["Python"]
Out[73]=
In[74]:=
coordinates = {{0.3, 1.3, -0.7}, {-1., -0.9, 0.7}, {1., -0.9, -0.7}, {-0.3, 1.3, 0.7}, {-1.3, -0.4, -0.7}, {1.3, -0.4, 0.7}};
In[75]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", coordinates, "Closure" -> "CLOSED"}]
Out[75]=
In[76]:=
 ResourceFunction[
 "TopolyFunction"][{"ConwayPolynomial", coordinates, "Closure" -> "CLOSED"}]
Out[76]=

End the session:

In[77]:=
DeleteObject[session]

Options (3) 

OutputType (3) 

Possible values of some common options:

In[78]:=
 ResourceFunction["TopolyFunction"]["Information", "Closure"]
Out[78]=
In[79]:=
 ResourceFunction["TopolyFunction"]["Information", "ReductionMethod"]
Out[79]=
In[80]:=
 ResourceFunction["TopolyFunction"]["Information", "OutputType"]
Out[80]=

With the default "OutputType""Mathematica", the result is in the Wolfram Language List format:

In[81]:=
 ResourceFunction[
  "TopolyFunction"][{"FindLoops", URL["https://files.rcsb.org/view/1AX8.pdb"]}] // Short
Out[81]=

Obtain some debugging information:

In[82]:=
coordinates = CompressedData["
1:eJwBeQSG+yFib1JlAgAAAC8AAAADAAAADvYmhuQEFMDqXbwft58BwIYBS65i
ceU/MSdok8OHE8DB/YAHBtAIwCB8KNGSx7e/yHvVyoSPEcASiNf1C7YOwOtv
CcA/Jey/ZohjXdymDMCBBps6j1oRwBFvnX+7bPm/wf7r3LRZBMAqWONsOjIS
wPCICtXNBQHAfZQRF4BG9r+SeeQPBs4RwNydtdsuVAPA3795ceKr0L9cWaKz
zEIQwLMmFviKLgPAyorh6gAI5z89uaZAZqcLwPFFe7yQbgDA93XgnBFl9z+P
3nAfudUFwI+Oq5Fdqfa/yO2XT1bM/z88M8FwrqH/v0aaeAd4UuK/SL99HThH
A0C1+1WA7zbzv1LWbyamC9U/trqcEhATBkAgf2lRn+TSv1RweEFEqvE/kWKA
RBOIB0CYT1YMV4fpPxy2Lcps0Pk/wmosYW3sBkDLMO4G0dr/P9BjlGdejvw/
QS5x5IEIBEBvZ195kP4IQBRAMbJkzvk/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ction[
 "TopolyFunction"][{"AlexanderPolynomial", coordinates, "Debug" -> True}]
Out[83]=

Applications (2) 

TopolyFunction can calculate knot topology for UCH protein (PDB code 2len, chain A, model 2).

First, obtain a PDB file from the RCSB server:

In[84]:=
file = URLDownload["https://files.rcsb.org/view/2LEN.pdb"]
Out[84]=
In[85]:=
Import[file]
Out[85]=

Using the Conway polynomial, obtain the statistics of knots occurring in different closures:

In[86]:=
 ResourceFunction[
 "TopolyFunction"][{"ConwayPolynomial", file, "PDBChain" -> "A", "PDBModel" -> 2}]
Out[86]=

Arrange in the order of probabilities:

In[87]:=
stats = Sort[%] // Reverse
Out[87]=

Display a histogram of discovered knots in the protein:

In[88]:=
Module[{keys = Keys[stats], iconF},
 iconF[sub_Subscript] := KnotData[List @@ sub];
 iconF[_] := ""; ListStepPlot[KeyValueMap[Labeled[#2, iconF[#], Top] &, stats], Center, Ticks -> {Transpose[{Range[Length[keys]], keys}], Automatic}, PlotRangePadding -> {Automatic, {0, 0.15}}, Filling -> Bottom, Frame -> True, FrameLabel -> {"Observed knot", "Knot probablility"}]]
Out[88]=

TopolyFunction can calculate the lasso types for all the loops in cerato-platanin (PDB code 3sum).

First, obtain a PDB file from the RCSB server:

In[89]:=
file = URLDownload["https://files.rcsb.org/view/3SUM.pdb"]
Out[89]=
In[90]:=
Import[file]
Out[90]=

Find lasso types for the loops in the structure:

In[91]:=
 ResourceFunction["TopolyFunction"][{"LassoType", file}]
Out[91]=

Obtain additional information about the lassos:

In[92]:=
lassos = ResourceFunction[
  "TopolyFunction"][{"LassoType", file, "MoreInfo" -> True}]
Out[92]=
In[93]:=
Dataset[lassos]
Out[93]=

Plot the minimal spanning surfaces for each loop:

In[94]:=
meshes = KeyValueMap[
  Show[ ResourceFunction[
     "TopolyFunction"][{"MinimalSurfaceMesh", file, "LoopIndices" -> #}], PlotLabel -> #2["class"]] &, lassos]
Out[94]=

Properties and Relations (4) 

TopolyFunction finds topology information given spatial coordinates of a curve, while some additional information for known knots can then be found with Kn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HpS
LHcNVBltdG75Yx3NCQKOslNocG9yoslWKxn49A0VFpSxNIjO5AvpcJyfUhg4
sApMjyQmf+NNwZ/SY5sx4CN/5V+LDi2AqRLqgJ1AGz807PNQo9Ph4Pf7tbjb
34L/AyVOJD0=
"];
In[96]:=
Graphics3D[Tube[BSplineCurve[coordinates], .2]]
Out[96]=
In[97]:=
 ResourceFunction[
 "TopolyFunction"][{"ConwayPolynomial", coordinates, "Closure" -> "CLOSED"}]
Out[97]=
In[98]:=
KnotData[List @@ %, {"StandardName", "ConwayPolynomial", "Image"}]
Out[98]=

The mapping between the curated TopolyFunction names and the Python-side names:

In[99]:=
 ResourceFunction["TopolyFunction"]["PropertyRules"]
Out[99]=

Python-side help of a function:

In[100]:=
Snippet[ ResourceFunction["TopolyFunction"]["RawInformation", "AlexanderPolynomial"], 15]
Out[100]=

Python-side names, such as given in the Topoly documentation or available in the literature, can be used in TopolyFunction directly:

In[101]:=
coordinates = CompressedData["
1:eJwtlHs4FGgbxsdpHGYwxsxghpWzJa6EVcT7mj7HlmKU1CKKLBrVSpdJIsWQ
Ze1WOqK1lbLR7seK1b5vTusUWaTE7Kc1Rs6EGYzx6br2j/vf5/rdz/3cj1Fk
QmCUPIFA8NiUwqaIiw13SRwGzuKMjbFeUOEsK/xctM8wMpPvB/xjOlismD09
80IDWjtQOqL9F5HnbBB23WDg8qnfjSXFRGiXyhSPnZUhtunuvCdedGzG02s+
TZICeUvP653zctjOsjfm9D0qDjtaWCa4JQKv2/RyXIrksIES/6IeRxPfeB7v
cuJbjNJS/0bJdlIkJ5BXzTFUw8+ZJQ59lpPoYOKko2vZLIpF1dpm6UT8xL9r
39AvEiRyIFW5/FSGAuKV/PaQFbHhHsO6Epk8vqpzMy28dALs/ZkjPBcth93/
EzvYTCPh5WpbRzYQAy8XrmR4cRVpoNvctyNaWLSjRlXsuwYulBo4SWdm0fuz
vTYufXTMMc4O87RbAYRTwZXGpY1oxPSlYW+dLrYJ20ou6J0H+49X489+GAc9
otL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OBU8H60uCBZ2
gjHiboMDOwjQ+KTpqyPaKlgvT2RfUjQHWgJNw1VNVWGbsV+9Qr0yHgxZ9Fca
koAQyeqhwkNa8H7xyaS4nUT8gtN6jfd6FcSlu5oHttPhz+Xy1bpSedxVtmK1
cmMZULVkHq926MHiTrBqri5F2talBd3lE+BT/WKsWLCS3b738foM2v3ka8Gp
nArQnp1EDwxjwdfNJxzSap4hI6FFv9vdcURMs+IO/aUH/8pJsEz5bRzcPtMi
bjaToNw3FmmRTQwYnyzkveuUgK01VUzq5t5ucKkZ+DEVGnVOh81w5OC/941p
7neytA+S4QY7X9e1RhEahKxEbTMn4ABflQP9kwpQXOEezntHhNe8nBp+NBaj
tqc5Ttu7V8CYEcdNsVoFhtqvRN9m/YN4ea1nP1+aBCdavuZbpZBg3e9dmVL7
1yD/vf6ZxK+eg+BXVU3tZZqwh3hEwbhpASzVDuasR31AlbsdzUK8qDAw/HpS
LHcNVBltdG75Yx3NCQKOslNocG9yoslWKxn49A0VFpSxNIjO5AvpcJyfUhg4
sApMjyQmf+NNwZ/SY5sx4CN/5V+LDi2AqRLqgJ1AGz807PNQo9Ph4Pf7tbjb
34L/AyVOJD0=
"];
In[102]:=
 ResourceFunction[
 "TopolyFunction"][{"alexander", coordinates, "closure" -> "Closure.CLOSED"}]
Out[102]=

Compare with the corresponding curated names:

In[103]:=
 ResourceFunction[
 "TopolyFunction"][{"AlexanderPolynomial", coordinates, "Closure" -> "CLOSED"}]
Out[103]=

Version History

  • 1.0.0 – 27 July 2021

Source Metadata

Related Resources

Author Notes

There's no Windows distribution of Topoly at the moment (June 2021), but there might be a way to use the TopolyDetect on Windows via WSL.

Currently includes only documented top-level Topoly functions. Does not include classes (AlexanderGraph, ConwayGraph, etc.); or polynomial classes (Alexander, etc. and their import/export). Also does not support plotting functions plot_graph, plot_matrix, etc.) and a few others (topoly.create and topoly.is_aa).

The documentation is static. It will need to be updated for future versions of Topoly. The information returned with "Information" and "RawInformation", on the other hand, is dynamic, retrieved from the Python side in each WL session.

The current documentation is sketchy. TopolyFunction["RawInformation",] is intended to partially alleviate the pain.

The option "Output" is not currently supported.

Some other options should benefit from specific pre- and post-processing.

Option values are not curated strings yet.

Directory setting, and random seed does not currently affect the Python side. The latter is especially important as one would often want stochastic methods to be reproducible.

Not all topology strings are currently parsed (e.g. , composite knots "3_1#3_1" or "3_1#3_1|8_20" would require typesetting, etc.).

Also, not all polynomial coefficients are given in a usable WL forms, eg (for 31):

Some function do not seem to accept certain PDB files, while accepting others:

There must be some incantation to obtain integer numbers in the GLN examples above .

License Information