diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index ccfd8b2..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,17 +0,0 @@ -name: ci -on: - push: - branches: - - master - - main -jobs: - deploy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v2 - with: - python-version: 3.x - - run: pip install mkdocs-material - - run: git submodule update --init --recursive - - run: mkdocs gh-deploy --force diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 58ec61a..0000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -site/ -.idea -.DS_Store diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 1be205b..0000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "mkdocs-material"] - path = mkdocs-material - url = https://github.com/squidfunk/mkdocs-material \ No newline at end of file diff --git a/README.md b/README.md index 22e95f1..d46746b 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,3 @@ -# Mol* Documentation - -Contributions to the documentations are highly welcome! Please make a pull request with your changes. - -Requires Python 3.x to build. - -``` -pip install mkdocs-material -git clone --recursive https://github.com/molstar/docs.git -cd docs -``` - -For local preview, run - -``` -mkdocs serve -``` +# Mol* Developer Documentation +This is a helper repository for publishing developer documentation from the [main repo](https://github.com/molstar/molstar/tree/master/docs) to https://molstar.org/docs/. \ No newline at end of file diff --git a/docs/data-access-tools/convert-to-bcif.md b/docs/data-access-tools/convert-to-bcif.md deleted file mode 100644 index 294b66b..0000000 --- a/docs/data-access-tools/convert-to-bcif.md +++ /dev/null @@ -1,41 +0,0 @@ -# Convert CIF to BinaryCIF -BinaryCIF is an efficient, binary flavor of the CIF format. See [specification](https://github.com/molstar/BinaryCIF) and [publication](https://doi.org/10.1371/journal.pcbi.1008247) for further details. - -This script reads data in CIF format and converts it lossless to a BinaryCIF file that can be read by Mol* or other -applications. - -## Example -```sh -node lib/commonjs/cli/cif2bcif/index.js file.cif file.bcif -``` - -## Usage -| Argument | Description | -| --- | --- | -| `src` | Source CIF to convert (can be gzipped) | -| `out` | Generated BinaryCIF output path | -| `-c` | Path to optional config file | -| `-f` | Path to optional filter file | - -```sh -index.js [-h] [-c CONFIG] [-f FILTER] src out -``` - -### Config file -Controls how certain columns will be encoded. This is a JSON array of instructions: -```ts -interface EncodingStrategyHint { - categoryName: string, - columnName: string, - encoding: 'pack' | 'rle' | 'delta' | 'delta-rle', - precision?: number -} -``` -Identify a particular CIF columns by its name and override the encoding by Integer Packing, Run-Length Encoding, Delta -Encoding, or Delta & Run-Length Encoding. You can optionally control the precision if dealing with float values. - -### Filter file -Specifies which categories and columns will be written. This is a plain text file, each line represents one entry. -You can specify explicitly which categories or columns to include by adding `category_name` or -`category_name.field_name`. You can also choose to ignore some categories or columns by adding `!category_name` or -`!category_name.field_name`. \ No newline at end of file diff --git a/docs/data-access-tools/create-ccd-table.md b/docs/data-access-tools/create-ccd-table.md deleted file mode 100644 index e55575f..0000000 --- a/docs/data-access-tools/create-ccd-table.md +++ /dev/null @@ -1,25 +0,0 @@ -# Create Table from CCD -The [Chemical Component Dictionary (CCD)](https://www.wwpdb.org/data/ccd) is as an external reference file describing -all residue and small molecule components found in PDB entries. The -[Protonation Variants Companion Dictionary (PVCD)](https://www.wwpdb.org/data/ccd) enumerates protonation variants of -canonical amino acids. - -This script bundles all `chem_comp_bond` information from the CCD and the PVCD into a single file for later use. -Optionally, it can also generate a second output file that contains all `chem_comp_atom` information. - -## Example -```sh -node --max-old-space-size=4096 lib/commonjs/cli/chem-comp-dict/create-table.js build/data/ccb.bcif -b -``` - -## Usage -| Argument | Description | -| --- | --- | -| `out` | Generated file output path | -| `--forceDownload`, `-f` | Force download of CCD and PVCD | -| `--binary`, `-b` | Output as BinaryCIF | -| `--ccaOut`, `-a` | File output path of optionally generated chem_comp_atom | - -```sh -create-table.js [-h] [--forceDownload] [--binary] [--ccaOut CCAOUT] out -``` \ No newline at end of file diff --git a/docs/data-access-tools/extract-ccd-ions.md b/docs/data-access-tools/extract-ccd-ions.md deleted file mode 100644 index 044ae66..0000000 --- a/docs/data-access-tools/extract-ccd-ions.md +++ /dev/null @@ -1,20 +0,0 @@ -# Extract Ions from CCD -The [Chemical Component Dictionary (CCD)](https://www.wwpdb.org/data/ccd) is as an external reference file describing -all residue and small molecule components found in PDB entries. - -This script extracts all ions from the CCD and provides their names as TypeScript set. - -## Example -```sh -node --max-old-space-size=4096 lib/commonjs/cli/chem-comp-dict/create-ions.js src/mol-model/structure/model/types/ions.ts -``` - -## Usage -| Argument | Description | -| --- | --- | -| `out` | Generated file output path | -| `--forceDownload`, `-f` | Force download of CCD | - -```sh -create-ions.js [-h] [--forceDownload] out -``` \ No newline at end of file diff --git a/docs/data-access-tools/model-server.md b/docs/data-access-tools/model-server.md deleted file mode 100644 index 7e9ec8a..0000000 --- a/docs/data-access-tools/model-server.md +++ /dev/null @@ -1,105 +0,0 @@ -# Model Server - -Provides access to molecular 1D, 2D, and 3D (sub-)structure models of molecules. Substructures are described by the -mol-script (MolQL) language. It has the ability to include additional data to mmCIF “on the fly”, e.g. integrate -primary PDB archival data from [Chemical Component Dictionary (CCD)](https://www.wwpdb.org/data/ccd), -[Protonation Variants Companion Dictionary (PVCD)](https://www.wwpdb.org/data/ccd) and -[Biologically Interesting moleculeReference Dictionary (BIRD)](https://www.wwpdb.org/data/bird). - -## Example -```sh -node lib/commonjs/servers/model/server --sourceMap pdb-bcif '/opt/data/bcif/${id}.bcif' -``` - -## Usage -| Argument | Description | -| --- | --- | -| `--version`, `-v` | Show program's version number and exit. | -| `--cfg` | JSON config file path. If a property is not specified, cmd line param/OS variable/default value are used. | -| `--printCfg` | Print current config for validation and exit. | -| `--cfgTemplate` | Prints default JSON config template to be modified and exit. | -| `--apiPrefix` | Specify the prefix of the API, i.e. <host>/<apiPrefix>/<API queries> | -| `--defaultPort` | Specify the port the server is running on | -| `--cacheMaxSizeInBytes` | Read structures are cached, this specifies the cache size, 0 for off. | -| `--cacheEntryTimeoutMs` | Specify in ms how long to keep entries in cache. | -| `--requestTimeoutMs` | The maximum number of ms the server spends on a request. | -| `--queryTimeoutMs` | The maximum time the server dedicates to executing a query in ms. Does not include the time it takes to read and export the data. | -| `--shutdownTimeoutMinutes` | Server will shut down after this amount of minutes, 0 for off. | -| `--shutdownTimeoutVarianceMinutes` | Modifies the shutdown timer by +/- `timeoutVarianceMinutes` (to avoid multiple instances shutting at the same time) | -| `--maxQueryManyQueries` | Maximum number of queries allowed by the query-many at a time | -| `--defaultSource` | modifies which 'sourceMap' source to use by default | -| `--sourceMap` | Map `id`s for a `source` to a file path. Example: `pdb-bcif '../../data/bcif/${id}.bcif'` - JS expressions can be used inside `${}`, e.g. `${id.substr(1, 2)}/${id}.mdb` Can be specified multiple times. The `SOURCE` variable (e.g. `pdb-bcif`) is arbitrary and depends on how you plan to use the server. Supported formats: cif, bcif, cif.gz, bcif.gz | -| `--sourceMapUrl` | Same as `--sourceMap` but for URL. `--sourceMapUrl src url format` Example: `pdb-cif "https://www.ebi.ac.uk/pdbe/entry-files/download/${id}_updated.cif" cif` Supported formats: cif, bcif, cif.gz, bcif.gz | - -```sh -node lib/commonjs/servers/model/server [-h] [-v] - [--cfg CFG] - [--printCfg] - [--cfgTemplate] - [--apiPrefix PREFIX] - [--defaultPort PORT] - [--cacheMaxSizeInBytes CACHE_SIZE] - [--cacheEntryTimeoutMs CACHE_TIMEOUT] - [--requestTimeoutMs REQUEST_TIMEOUT] - [--queryTimeoutMs QUERY_TIMEOUT] - [--shutdownTimeoutMinutes TIME] - [--shutdownTimeoutVarianceMinutes VARIANCE] - [--maxQueryManyQueries QUERY_MANY_LIMIT] - [--defaultSource DEFAULT_SOURCE] - [--sourceMap SOURCE PATH] - [--sourceMapUrl SOURCE PATH SOURCE_MAP_FORMAT] -``` - -### Production Use -In production, it is required to use a service that will keep the server running, such as [forever.js](https://github.com/foreverjs/forever). - -### Memory Issues -Sometimes nodejs might run into problems with memory. This is usually resolved by adding the ``--max-old-space-size=8192`` parameter. - -### Preprocessor Example -The preprocessor application allows addiing custom data to CIF files and/or -[convert CIF to BinaryCIF](./convert-to-bcif.md). -```sh -node lib/commonjs/servers/model/preprocess -``` - -### Preprocessor Usage -| Argument | Description | -| --- | --- | -| `--input`, `-i` | Input filename | -| `--outCIF`, `-oc` | Output CIF filename | -| `--outBCIF`, `-ob` | Output BinaryCIF filename | -| `--cfg`, `-c` | Config file path | -| `--folderIn`, `-fin` | Convert folder | -| `--folderOutCIF`, `-foc` | Convert folder text output | -| `--folderOutBCIF`, `-fob` | Convert folder binary output | -| `--folderNumProcesses`, `-fp` | Convert folder number processes | - -Example cfg.json: -```ts -{ - "numProcesses": 1, - "customProperties": { - "sources": [ "wwpdb" ], - "params": { - "wwPDB": { - "chemCompBondTablePath": "./build/data/ccb.bcif" - } - } - } -} -``` - -### Local Mode -The server can be run in local/file based mode using -```sh -node lib/commonjs/servers/model/query -``` - -### Custom Properties -This feature is still in development. - -It is possible to provide property descriptors that transform data to internal representation and define how it should -be exported into one or mode CIF categories. Examples of this are located in the ``mol-model-props`` module and are -linked to the server in the config and ``servers/model/properties``. - diff --git a/docs/data-access-tools/plugin-state-server.md b/docs/data-access-tools/plugin-state-server.md deleted file mode 100644 index 43859b3..0000000 --- a/docs/data-access-tools/plugin-state-server.md +++ /dev/null @@ -1,22 +0,0 @@ -# Plugin State Server - -Provides a simple backend for online storing and sharing of Mol* sessions used by -[``mol-plugin``](https://github.com/molstar/molstar/tree/master/src/mol-plugin) and -[``mol-state``](https://github.com/molstar/molstar/tree/master/src/mol-state) modules. - -## Example -```sh -node lib/commonjs/servers/plugin-state --workding-folder ~ -``` - -## Usage -| Argument | Description | -| --- | --- | -| `--working-folder` | Working folder path | -| `--port` | Server port. Alternatively, use ENV variable PORT. | -| `--api-prefix` | Server API prefix | -| `--max-states` | Maximum number of states to save | - -```sh -node lib/commonjs/servers/plugin-state [-h] --working-folder WORKING_FOLDER [--port PORT] [--api-prefix API_PREFIX] [--max-states MAX_STATES] -``` \ No newline at end of file diff --git a/docs/data-access-tools/volume-server.md b/docs/data-access-tools/volume-server.md deleted file mode 100644 index a36a8b1..0000000 --- a/docs/data-access-tools/volume-server.md +++ /dev/null @@ -1,40 +0,0 @@ -# Volume Server - -Provides near-instantaneous access to volumetric data including density maps (for instance, from X-ray crystallography -or cryo-electron microscopy experiments), spatial distribution data, output from electrostatic calculations. It works by -utilizing adaptive downsampling (similar to how Google Earth works). - -## Example -```sh -node lib/commonjs/servers/volume/server --idMap x-ray '/opt/data/xray/${id}.mdb' -``` - -## Usage -| Argument= | Description | -| --- | --- | -| `--cfg` | JSON config file path. If a property is not specified, cmd line param/OS variable/default value are used. | -| `--printCfg` | Print current config for validation and exit. | -| `--cfgTemplate` | Prints default JSON config template to be modified and exit. | -| `--apiPrefix` | Specify the prefix of the API, i.e. <host>/<apiPrefix>/<API queries> | -| `--defaultPort` | Specify the port the server is running on | -| `--shutdownTimeoutMinutes` | Server will shut down after this amount of minutes, 0 for off. | -| `--shutdownTimeoutVarianceMinutes` | Modifies the shutdown timer by +/- `timeoutVarianceMinutes` (to avoid multiple instances shutting at the same time) | -| `--idMap` | Map `id`s for a `type` to a file path. Example: `x-ray '../../data/mdb/xray/${id}-ccp4.mdb'` - JS expressions can be used inside `${}`, e.g. `${id.substr(1, 2)}/${id}.mdb` - Can be specified multiple times. - The `TYPE` variable (e.g. `x-ray`) is arbitrary and depends on how you plan to use the server. By default, Mol* Viewer uses `x-ray` and `em`, but any particular use case may vary. | -| `--maxRequestBlockCount` | Maximum number of blocks that could be read in 1 query. This is somewhat tied to the ``maxOutputSizeInVoxelCountByPrecisionLevel`` in that the `<maximum number of voxel> = maxRequestBlockCount * <block size>^3`. The default block size is 96 which corresponds to 28,311,552 voxels with 32 max blocks. | -| `--maxFractionalBoxVolume` | The maximum fractional volume of the query box (to prevent queries that are too big). | -| `--maxOutputSizeInVoxelCountByPrecisionLevel` | What is the (approximate) maximum desired size in voxel count by precision level - Rule of thumb: `<response gzipped size>` in `[<voxel count> / 8, <voxel count> / 4]`. The maximum number of voxels is tied to maxRequestBlockCount. | - -```sh -node lib/commonjs/servers/volume/server [-h] [-v] - [--cfg CFG] - [--printCfg] - [--cfgTemplate] - [--apiPrefix PREFIX] - [--defaultPort PORT] - [--shutdownTimeoutMinutes TIME] - [--shutdownTimeoutVarianceMinutes VARIANCE] - [--idMap TYPE PATH] - [--maxRequestBlockCount COUNT] - [--maxFractionalBoxVolume VOLUME] - [--maxOutputSizeInVoxelCountByPrecisionLevel LEVEL [LEVEL ...]] -``` \ No newline at end of file diff --git a/docs/data-state.md b/docs/data-state.md deleted file mode 100644 index d53ea7b..0000000 --- a/docs/data-state.md +++ /dev/null @@ -1,11 +0,0 @@ -# Data State Management - -## Managers - -## State Tree, Selectors, Transforms - -## State Snapshots - -## Structure, Trajectory, Cell - -## Ref, Representation \ No newline at end of file diff --git a/docs/examples.md b/docs/examples.md deleted file mode 100644 index 5f7ff7b..0000000 --- a/docs/examples.md +++ /dev/null @@ -1,3 +0,0 @@ -# Examples - -Refer to Mol* [Apps](https://github.com/molstar/molstar/tree/master/src/apps) and [Examples](https://github.com/molstar/molstar/tree/master/src/examples). \ No newline at end of file diff --git a/docs/extensions/mvs/index.md b/docs/extensions/mvs/index.md deleted file mode 100644 index c3456d8..0000000 --- a/docs/extensions/mvs/index.md +++ /dev/null @@ -1,3 +0,0 @@ -# MolViewSpec - -Please see the [standalone MolViewSpec documentation](https://molstar.org/mol-view-spec-docs/). diff --git a/docs/extensions/struct-conn.md b/docs/extensions/struct-conn.md deleted file mode 100644 index 47d0846..0000000 --- a/docs/extensions/struct-conn.md +++ /dev/null @@ -1,6 +0,0 @@ -# wwPDB StructConn extension - -**wwPDB StructConn extension** provides functionality to retrieve and visualize the connections from the STRUCT_CONN category in mmCIF files (such as hydrogen bonds, salt bridges, disulfide bridges). - - -Refer to [Documentation for Mol* wwPDB StructConn extension](https://github.com/molstar/molstar/blob/master/docs/extensions/struct-conn.md) diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index ae93313..0000000 --- a/docs/index.md +++ /dev/null @@ -1,43 +0,0 @@ -# Installation - -## NPM Package - -``` -yarn add molstar -``` - -or - -``` -npm install molstar -``` - -Mol* code can then be imported from the ``molstar/lib/...`` namespace, e.g. - -```ts -import { PluginContext } from 'molstar/lib/mol-plugin/context'; -``` - -## Clone from GitHub - - -``` -git clone https://github.com/molstar/molstar.git -cd molstar -npm install -npm build -``` - --------------------- - -For a watch task to automatically rebuild the source code on changes, run - -``` -npm run watch -``` - -or if working just with the Viewer app for better performance - -``` -npm run watch-viewer -``` diff --git a/docs/plugin.md b/docs/plugin.md deleted file mode 100644 index 8f962e6..0000000 --- a/docs/plugin.md +++ /dev/null @@ -1,274 +0,0 @@ -# Creating Plugin Instance - - -## Intro - -What is a plugin? A plugin is a collection of modules that provide functionality to the `Mol*` UI. The plugin is responsible for managing the state of the viewer, internal and user interactions. It has been a previous point of confusion for new users of `Mol*` to associate the __viewer__ part of the library with what is further referred to as the __plugin__. These two are closely connected in the `molstar-plugin-ui` module, which is the user-facing part of the library and ultimately provides the viewer, but they are ultimately distinct. - - -It is recommended that you inspect the general class structure of [`PluginInitWrapper`](https://github.com/molstar/molstar/blob/6edbae80db340134341631f669eec86543a0f1a8/src/mol-plugin-ui/plugin.tsx#L41), [`PluginUIContext`](https://github.com/molstar/molstar/blob/6edbae80db340134341631f669eec86543a0f1a8/src/mol-plugin/context.ts#L71) and [`PluginUIComponent`](https://github.com/molstar/molstar/blob/6edbae80db340134341631f669eec86543a0f1a8/src/mol-plugin-ui/base.tsx#L16) to better understand the flow of data and events in the plugin. -A passing analogy is that a [ `PluginContext` ](https://github.com/molstar/molstar/blob/6edbae80db340134341631f669eec86543a0f1a8/src/mol-plugin/context.ts#L71) is the engine that powers computation, rendering, events and subscriptions inside the molstar UI. All UI components depend on `PluginContext`. - - - -There are 4 basic ways of instantiating the Mol* plugin. - -## ``Viewer`` wrapper - -- The most basic usage is to use the ``Viewer`` wrapper. This is best suited for use cases that do not require much custom behavior and are mostly about just displaying a structure. -- See ``Viewer`` class is defined in [src/apps/viewer/app.ts](https://github.com/molstar/molstar/blob/master/src/apps/viewer/app.ts) for available methods and options. - -Example usage without using WebPack: - -```HTML - - - - - -
- - -``` - -When using WebPack (or possibly other build tool) with the Mol* NPM package installed, the viewer class can be imported using - -```ts -import { Viewer } from 'molstar/build/viewer/molstar' - -function initViewer(target: string | HTMLElement) { - return new Viewer(target, { /* options */}) -} -``` - -## ``PluginContext`` with built-in React UI - -- For more customization options it is possible to use the [``PluginContext``](https://github.com/molstar/molstar/blob/master/src/mol-plugin/context.ts) directly. -- When creating the plugin instance it is possible to customize the [``PluginSpec``](https://github.com/molstar/molstar/blob/master/src/mol-plugin/spec.ts). -- The default [``PluginSpec``](https://github.com/molstar/molstar/blob/master/src/mol-plugin/spec.ts) is available [here](https://github.com/molstar/molstar/blob/master/src/mol-plugin/spec.ts). -- [``PluginConfig``](https://github.com/molstar/molstar/blob/master/src/mol-plugin/config.ts) object provides additional customization options. -- See the [Viewer State Management](viewer-state.md) section for more information on customizing things like background. -- See the [Data State Management](data-state.md) section for more information on build the state. - -```ts -import { DefaultPluginUISpec, PluginUISpec } from 'molstar/lib/mol-plugin-ui/spec'; -import { createPluginUI } from 'molstar/lib/mol-plugin-ui'; -import { renderReact18 } from 'molstar/lib/mol-plugin-ui/react18'; -import { PluginConfig } from 'molstar/lib/mol-plugin/config'; - -const MySpec: PluginUISpec = { - ...DefaultPluginUISpec(), - config: [ - [PluginConfig.VolumeStreaming.Enabled, false] - ] -} - -async function createPlugin(parent: HTMLElement) { - const plugin = await createPluginUI({ - target: parent, - spec: MySpec, - render: renderReact18 - }); - - const data = await plugin.builders.data.download({ url: '...' }, { state: { isGhost: true } }); - const trajectory = await plugin.builders.structure.parseTrajectory(data, format); - await this.plugin.builders.structure.hierarchy.applyPreset(trajectory, 'default'); - - return plugin; -} - -createPlugin(document.getElementById('app')!); // app is a