diff --git a/_extensions/molstar/molstar.lua b/_extensions/molstar/molstar.lua
index 5151afd..38eeaaf 100644
--- a/_extensions/molstar/molstar.lua
+++ b/_extensions/molstar/molstar.lua
@@ -131,6 +131,7 @@ local function createViewer(args)
volumeExtension = args.volumeExtension,
snapshotUrl = args.snapshotUrl,
snapshotExtension = args.snapshotExtension,
+ afdb = args.afdb,
data = args.data,
options = mergeMolstarOptions(args.userOptions)
}
@@ -178,6 +179,8 @@ local function createViewer(args)
]]
elseif args.snapshotUrl and args.snapshotExtension then
viewerFunction = 'viewer.loadSnapshotFromUrl(url="${snapshotUrl}", "${snapshotExtension}");'
+ elseif args.afdb then
+ viewerFunction = 'viewer.loadAlphaFoldDb(afdb="${afdb}")'
else -- otherwise read from url (local or remote)
viewerFunction = 'viewer.loadStructureFromUrl("${url}", format="${urlExtension}");'
end
@@ -204,6 +207,24 @@ return {
})
end,
+ ['mol-afdb'] = function(args, kwargs)
+ -- return early if the output format is unsupported
+ if not quarto.doc.isFormat("html:js") then
+ return pandoc.Null()
+ end
+
+ addDependencies()
+
+ local afdb = pandoc.utils.stringify(args[1])
+ local appId = 'app-' .. afdb
+
+ return pandoc.RawBlock('html', createViewer {
+ appId = appId,
+ afdb = afdb,
+ userOptions = kwargs
+ })
+ end,
+
['mol-url'] = function(args, kwargs, meta)
if not quarto.doc.isFormat("html:js") then
return pandoc.Null()
diff --git a/index.html b/index.html
index 460ffa6..fc81f06 100644
--- a/index.html
+++ b/index.html
@@ -109,6 +109,7 @@
Table of contents
Usage examples for
- RCSB PDB
+ - AlphaFold model.
- Local pdb file
- pdb file from url
- local xyz file
@@ -152,10 +153,21 @@ RCSB PDB
{{< mol-rcsb 7sgl >}}
+
+
+AlphaFold model.
+Load the predicted structure of a protein from the AlphaFold Database using the AlphaFold Database ID. The loaded structure is coloured based on the prediction score.
+{{< mol-afdb Q8W3K0 >}}
+
+
+
Local pdb file
@@ -163,7 +175,7 @@ Local pdb file
{{< mol-url ./www/7sgl.pdb >}}
@@ -174,7 +186,7 @@ pdb file from url
{{< mol-url https://files.rcsb.org/download/7sgl.pdb >}}
@@ -185,7 +197,7 @@ local xyz file
{{< mol-url ./www/example.xyz >} }
@@ -196,7 +208,7 @@ local pdb and tra
{{< mol-traj ./www/example.pdb ./www/example.xtc >}}
@@ -228,7 +240,7 @@ local f
{{< mol-volume ./www/traj.xyz ./www/density.cube >}}
diff --git a/index.qmd b/index.qmd
index 10d6a88..27ff4a1 100644
--- a/index.qmd
+++ b/index.qmd
@@ -17,6 +17,14 @@ Get a protein from the RCSB PDB with:
{{< mol-rcsb 7sgl >}}
+## AlphaFold model.
+
+Load the predicted structure of a protein from the [AlphaFold Database](https://alphafold.com/) using the AlphaFold Database ID. The loaded structure is coloured based on the prediction score.
+
+`{{{< mol-afdb Q8W3K0 >}}}`
+
+{{< mol-afdb Q8W3K0 >}}
+
## Local pdb file
Get a local pdb file with:
@@ -39,7 +47,7 @@ Get a local xyz file with:
`{{{< mol-url ./www/example.xyz >}} }`
-{{< mol-url ./www/example.xyz >}}
+{{< mol-url ./www/example.xyz >}}
## local pdb and trajectory
@@ -51,8 +59,7 @@ Load a topology and a trajectory with:
## snapshot file
-Load a snapshot file, to share a saved Mol* session which will save aesthetic
-parameters and scene setup.
+Load a snapshot file, to share a saved Mol\* session which will save aesthetic parameters and scene setup.
`{{{< mol-snapshot ./www/molstar.molj >}}}`
@@ -60,12 +67,10 @@ parameters and scene setup.
## local file with volume information
-
`{{{< mol-volume ./www/traj.xyz ./www/density.cube >}}}`
{{< mol-volume ./www/traj.xyz ./www/density.cube >}}
-
## Customization
### Molstar options
@@ -88,7 +93,7 @@ Example
To embed plain text files (such as `.pdb`, `.xyz`) into the rendered html, add this to your yml header:
-```yml
+``` yml
molstar: embed
```
@@ -98,11 +103,12 @@ It does not work for binary trajectory formats such as `xtc`.
### CSS
-Each embedded app is inserted into a div with an ID created from the path of the pdb-file or trajectory (please don't embed the same thing twice, it will only show up once). So the first app on this page will respond to css for `#app-7sgl`.
+Each embedded app is inserted into a div with an ID created from the path of the pdb-file or trajectory (please don't embed the same thing twice, it will only show up once).
+So the first app on this page will respond to css for `#app-7sgl`.
All apps have the class `molstar-app` and the following css is included by default:
-```css
+``` css
.molstar-app {
position: relative;
width: 100%;
@@ -112,9 +118,8 @@ All apps have the class `molstar-app` and the following css is included by defau
For example, you might want to make one app a bit shorter because there is text above it:
-```css
+``` css
#app-7sgl {
padding-bottom: 40%;
}
```
-