NGL@1.0.0-beta.7 Home Manual Reference Source Gallery

Function

Static Public Summary
public

AVHash(atomsX: Float32Array, atomsY: Float32Array, atomsZ: Float32Array, atomsR: Float32Array, min: Float32Array, max: Float32Array, maxDistance: Float)

Modifed from SpatialHash

public
public

BinaryHeap(scoreFunction: Function)

Binary heap implementation

public
public
public
public

Kdtree(points: Float32Array, metric: Function)

Kdtree

public

Kdtree()

public
public
public

Matrix()

public
public

Spline()

public

Stats()

public

Viewer(idOrElement: String | Element)

Viewer class

public
public

Worker()

public
public
public
public
public
public
public
public
public
public
public
public
public
public

Assigns ResidueType bonds.

public
public

autoLoad(file: String | File | Blob, params: LoaderParameters): Promise

Load a file

public

binarySearchIndexOf(array: Array, element: Anything, compareFunction: Function): Number

Does a binary search to get the index of an element in the input array

public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

clamp()

public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

lerp()

public
public
public

m3new()

public
public
public
public
public
public

m4new()

public
public
public

Make image from what is shown in a viewer canvas

public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

open()

public

MeasurementRepresentations take atom[Pair|Triple|Quad] parameters.

public
public
public

pclamp()

public

pick()

public
public
public
public
public
public

quicksortIP(arr: TypedArray, eleSize: Integer, orderElement: Integer, begin: Integer, end: Integer): TypedArray

quicksortIP

public
public
public
public
public
public
public
public
public
public
public
public
public
public
public
public

spline()

public
public
public

submit()

public

Perform structural superposition of two structures, optionally guided by a sequence alignment

public

svd()

public
public
public
public
public
public
public
public
public
public

v3add()

public
public
public

v3ceil()

public
public
public
public

v3dot()

public
public
public
public
public
public
public
public

v3new()

public
public
public

v3sub()

public
public
Static Private Summary
private

Grid()

private

Queue()

private
private
private
private

Static Public

public AVHash(atomsX: Float32Array, atomsY: Float32Array, atomsZ: Float32Array, atomsR: Float32Array, min: Float32Array, max: Float32Array, maxDistance: Float) source

import {AVHash} from 'ngl/src/surface/av-surface.js'

Modifed from SpatialHash

Main differences are:

  • Optimized grid size to ensure we only ever need to look +/-1 cell
  • Aware of atomic radii and will only output atoms within rAtom + rExtra (see withinRadii method)

(Uses rounding rather than bitshifting as consequence of arbitrary grid size)

Params:

NameTypeAttributeDescription
atomsX Float32Array

x coordinates

atomsY Float32Array

y coordinates

atomsZ Float32Array

z coordinates

atomsR Float32Array

atom radii

min Float32Array

xyz min coordinates

max Float32Array

xyz max coordinates

maxDistance Float

max distance

public AVSurface() source

import {AVSurface} from 'ngl/src/surface/av-surface.js'

public BinaryHeap(scoreFunction: Function) source

import BinaryHeap from 'ngl/src/utils/binary-heap.js'

Binary heap implementation

Params:

NameTypeAttributeDescription
scoreFunction Function

the heap scoring function

public EDTSurface() source

import EDTSurface from 'ngl/src/surface/edt-surface.js'

public Helixbundle() source

import Helixbundle from 'ngl/src/geometry/helixbundle.js'

public Helixorient() source

import Helixorient from 'ngl/src/geometry/helixorient.js'

public Kdtree(points: Float32Array, metric: Function) source

import Kdtree from 'ngl/src/utils/kdtree.js'

Kdtree

Params:

NameTypeAttributeDescription
points Float32Array

points

metric Function

metric

Example:

points: [x, y, z, x, y, z, x, y, z, ...]
metric: function(a, b){
   return Math.pow(a[0]-b[0], 2) + Math.pow(a[1]-b[1], 2) + Math.pow(a[2]-b[2], 2);
}

public Kdtree() source

import Kdtree from 'ngl/src/geometry/kdtree.js'

public LabelFactory() source

import LabelFactory from 'ngl/src/utils/label-factory.js'

public MarchingCubes() source

import MarchingCubes from 'ngl/src/surface/marching-cubes.js'

public Matrix() source

import {Matrix} from 'ngl/src/math/matrix-utils.js'

public RadiusFactory() source

import RadiusFactory from 'ngl/src/utils/radius-factory.js'

public Spline() source

import Spline from 'ngl/src/geometry/spline.js'

public Stats() source

import Stats from 'ngl/src/viewer/stats.js'

public Viewer(idOrElement: String | Element) source

import Viewer from 'ngl/src/viewer/viewer.js'

Viewer class

Params:

NameTypeAttributeDescription
idOrElement String | Element
  • optional

dom id or element

public VolumeSurface() source

import {VolumeSurface} from 'ngl/src/surface/volume.js'

public Worker() source

import Worker from 'ngl/src/worker/worker.js'

public WorkerPool() source

import WorkerPool from 'ngl/src/worker/worker-pool.js'

public addCols() source

import {addCols} from 'ngl/src/math/matrix-utils.js'

public addRows() source

import {addRows} from 'ngl/src/math/matrix-utils.js'

public almostIdentity() source

import {almostIdentity} from 'ngl/src/math/math-utils.js'

public applyMatrix3toVector3array() source

import {applyMatrix3toVector3array} from 'ngl/src/math/vector-utils.js'

public applyMatrix4toVector3array() source

import {applyMatrix4toVector3array} from 'ngl/src/math/vector-utils.js'

public arrayMax() source

import {arrayMax} from 'ngl/src/math/array-utils.js'

public arrayMean() source

import {arrayMean} from 'ngl/src/math/array-utils.js'

public arrayMin() source

import {arrayMin} from 'ngl/src/math/array-utils.js'

public arrayRms() source

import {arrayRms} from 'ngl/src/math/array-utils.js'

public arraySorted() source

import {arraySorted} from 'ngl/src/math/array-utils.js'

public arraySortedCmp() source

import {arraySortedCmp} from 'ngl/src/math/array-utils.js'

public arraySum() source

import {arraySum} from 'ngl/src/math/array-utils.js'

public assignResidueTypeBonds(structure: Structure): undefined source

import {assignResidueTypeBonds} from 'ngl/src/structure/structure-utils.js'

Assigns ResidueType bonds.

Params:

NameTypeAttributeDescription
structure Structure

the structure object

Return:

undefined

public assignSecondaryStructure() source

import {assignSecondaryStructure} from 'ngl/src/structure/structure-utils.js'

public autoLoad(file: String | File | Blob, params: LoaderParameters): Promise source

import {autoLoad} from 'ngl/src/loader/loader-utils.js'

Load a file

Params:

NameTypeAttributeDescription
file String | File | Blob

either a URL or an object containing the file data

params LoaderParameters

loading parameters

Return:

Promise

Promise resolves to the loaded data

Example:

// load from URL
NGL.autoLoad( "http://files.rcsb.org/download/5IOS.cif" );
// load binary data in CCP4 format via a Blob
var binaryBlob = new Blob( [ ccp4Data ], { type: 'application/octet-binary'} );
NGL.autoLoad( binaryBlob, { ext: "ccp4" } );
// load string data in PDB format via a Blob
var stringBlob = new Blob( [ pdbData ], { type: 'text/plain'} );
NGL.autoLoad( stringBlob, { ext: "pdb" } );
// load a File object
NGL.autoLoad( file );

public binarySearchIndexOf(array: Array, element: Anything, compareFunction: Function): Number source

import {binarySearchIndexOf} from 'ngl/src/utils.js'

Does a binary search to get the index of an element in the input array

Params:

NameTypeAttributeDescription
array Array

sorted array

element Anything

element to search for in the array

compareFunction Function
  • optional

compare function

Return:

Number

the index of the element or -1 if not in the array

Example:

var array = [ 1, 2, 3, 4, 5, 6 ];
var element = 4;
binarySearchIndexOf( array, element );  // returns 3

public boolean() source

import {boolean} from 'ngl/src/utils.js'

public buildUnitcellAssembly() source

import {buildUnitcellAssembly} from 'ngl/src/structure/structure-utils.js'

public calcArcPoint() source

public calculateBonds() source

import {calculateBonds} from 'ngl/src/structure/structure-utils.js'

public calculateBondsBetween() source

import {calculateBondsBetween} from 'ngl/src/structure/structure-utils.js'

public calculateBondsWithin() source

import {calculateBondsWithin} from 'ngl/src/structure/structure-utils.js'

public calculateCenterArray() source

import {calculateCenterArray} from 'ngl/src/math/array-utils.js'

public calculateChainnames() source

import {calculateChainnames} from 'ngl/src/structure/structure-utils.js'

public calculateDirectionArray() source

import {calculateDirectionArray} from 'ngl/src/math/array-utils.js'

public calculateMeanArray() source

import {calculateMeanArray} from 'ngl/src/math/array-utils.js'

public calculateMeanVector3() source

import {calculateMeanVector3} from 'ngl/src/math/vector-utils.js'

public calculateMinArray() source

import {calculateMinArray} from 'ngl/src/math/array-utils.js'

public calculateResidueBonds() source

import {calculateResidueBonds} from 'ngl/src/structure/structure-utils.js'

public centerArray3() source

import {centerArray3} from 'ngl/src/math/array-utils.js'

public circularMean() source

import {circularMean} from 'ngl/src/math/array-utils.js'

public clamp() source

import {clamp} from 'ngl/src/math/math-utils.js'

public computeBoundingBox() source

import {computeBoundingBox} from 'ngl/src/math/vector-utils.js'

public computeVertexNormals() source

import {computeVertexNormals} from 'ngl/src/surface/surface-utils.js'

public copyArray() source

import {copyArray} from 'ngl/src/math/array-utils.js'

public copyWithin() source

import {copyWithin} from 'ngl/src/math/array-utils.js'

public countSetBits() source

import {countSetBits} from 'ngl/src/math/math-utils.js'

public dataURItoImage() source

import {dataURItoImage} from 'ngl/src/utils.js'

public deepCopy() source

import {deepCopy} from 'ngl/src/utils.js'

public defaults() source

import {defaults} from 'ngl/src/utils.js'

public download() source

import {download} from 'ngl/src/utils.js'

public ensureArray() source

import {ensureArray} from 'ngl/src/utils.js'

public ensureBuffer() source

import {ensureBuffer} from 'ngl/src/utils.js'

public ensureFloat32Array() source

import {ensureFloat32Array} from 'ngl/src/utils.js'

public ensureMatrix4() source

import {ensureMatrix4} from 'ngl/src/utils.js'

public ensureQuaternion() source

import {ensureQuaternion} from 'ngl/src/utils.js'

public ensureVector2() source

import {ensureVector2} from 'ngl/src/utils.js'

public ensureVector3() source

import {ensureVector3} from 'ngl/src/utils.js'

public flatten() source

import {flatten} from 'ngl/src/utils.js'

public generateUUID() source

import {generateUUID} from 'ngl/src/math/math-utils.js'

public getAbsolutePath() source

import {getAbsolutePath} from 'ngl/src/utils.js'

public getBrowser() source

import {getBrowser} from 'ngl/src/utils.js'

public getChainname() source

import {getChainname} from 'ngl/src/structure/structure-utils.js'

public getDataInfo() source

import {getDataInfo} from 'ngl/src/loader/loader-utils.js'

public getFileInfo() source

import {getFileInfo} from 'ngl/src/utils.js'

public getProtocol() source

import {getProtocol} from 'ngl/src/utils.js'

public getQuery() source

import {getQuery} from 'ngl/src/utils.js'

public getRadiusDict() source

import {getRadiusDict} from 'ngl/src/surface/surface-utils.js'

public getShader() source

import {getShader} from 'ngl/src/shader/shader-utils.js'

public getSurfaceGrid() source

import {getSurfaceGrid} from 'ngl/src/surface/surface-utils.js'

public getSymmetryOperations() source

import {getSymmetryOperations} from 'ngl/src/symmetry/symmetry-utils.js'

public getTypedArray() source

import {getTypedArray} from 'ngl/src/utils.js'

public getUintArray() source

import {getUintArray} from 'ngl/src/utils.js'

public guessElement() source

import {guessElement} from 'ngl/src/structure/structure-utils.js'

public invert3x3() source

import {invert3x3} from 'ngl/src/math/matrix-utils.js'

public isPointOnSegment() source

import {isPointOnSegment} from 'ngl/src/math/vector-utils.js'

public laplacianSmooth() source

import {laplacianSmooth} from 'ngl/src/surface/surface-utils.js'

public lerp() source

import {lerp} from 'ngl/src/math/math-utils.js'

public lineLineIntersect(p1: Vector3, p2: Vector3, p3: Vector3, p4: Vector3): Array<Vector3, Vector3> | null source

import {lineLineIntersect} from 'ngl/src/math/vector-utils.js'

Converted to JavaScript from http://paulbourke.net/geometry/pointlineplane/lineline.c

Params:

NameTypeAttributeDescription
p1 Vector3

point 1

p2 Vector3

point 2

p3 Vector3

point 3

p4 Vector3

point 4

Return:

Array<Vector3, Vector3> | null

the two intersection points

public m3makeNormal() source

import {m3makeNormal} from 'ngl/src/math/matrix-utils.js'

public m3new() source

import {m3new} from 'ngl/src/math/matrix-utils.js'

public m4identity() source

import {m4identity} from 'ngl/src/math/matrix-utils.js'

public m4makeRotationY() source

import {m4makeRotationY} from 'ngl/src/math/matrix-utils.js'

public m4makeScale() source

import {m4makeScale} from 'ngl/src/math/matrix-utils.js'

public m4makeTranslation() source

import {m4makeTranslation} from 'ngl/src/math/matrix-utils.js'

public m4multiply() source

import {m4multiply} from 'ngl/src/math/matrix-utils.js'

public m4new() source

import {m4new} from 'ngl/src/math/matrix-utils.js'

public makeAtomTest() source

import {makeAtomTest} from 'ngl/src/selection/selection-test.js'

public makeChainTest() source

import {makeChainTest} from 'ngl/src/selection/selection-test.js'

public makeImage(viewer: Viewer, params: ImageParameters): Promise source

import {makeImage} from 'ngl/src/viewer/viewer-utils.js'

Make image from what is shown in a viewer canvas

Params:

NameTypeAttributeDescription
viewer Viewer

the viewer

params ImageParameters

parameters object

Return:

Promise

A Promise object that resolves to an image Blob.

public makeModelTest() source

import {makeModelTest} from 'ngl/src/selection/selection-test.js'

public makeRepresentation() source

import {makeRepresentation} from 'ngl/src/representation/representation-utils.js'

public makeResidueTest() source

import {makeResidueTest} from 'ngl/src/selection/selection-test.js'

public makeTrajectory() source

import {makeTrajectory} from 'ngl/src/trajectory/trajectory-utils.js'

public makeWorkerBlob() source

import {makeWorkerBlob} from 'ngl/src/worker/worker-utils.js'

public mat3x3determinant() source

import {mat3x3determinant} from 'ngl/src/math/matrix-utils.js'

public meanCols() source

import {meanCols} from 'ngl/src/math/matrix-utils.js'

public meanRows() source

import {meanRows} from 'ngl/src/math/matrix-utils.js'

public multiply() source

import {multiply} from 'ngl/src/math/matrix-utils.js'

public multiply3x3() source

import {multiply3x3} from 'ngl/src/math/matrix-utils.js'

public multiplyABt() source

import {multiplyABt} from 'ngl/src/math/matrix-utils.js'

public multiplyAtB() source

import {multiplyAtB} from 'ngl/src/math/matrix-utils.js'

public normalize() source

import {normalize} from 'ngl/src/math/math-utils.js'

public normalizeVector3array() source

import {normalizeVector3array} from 'ngl/src/math/vector-utils.js'

public open() source

import {open} from 'ngl/src/utils.js'

public parseNestedAtoms(sview: Structure, atoms: Array): Float32Array source

MeasurementRepresentations take atom[Pair|Triple|Quad] parameters.

Parses nested array of either integer atom indices or selection expressions into a flat array of coordinates.

NB: Unlike previous version, this peeks at first entry to determine if atoms are given by int index or selection expression. It cannot cope with mixtures

Params:

NameTypeAttributeDescription
sview Structure

The structure to which the atoms refer

atoms Array

Nested array of atom pairs|triples|quads as Integer indices or selection expressions

Return:

Float32Array

Flattened array of position coordinates

public parseSele() source

import {parseSele} from 'ngl/src/selection/selection-parser.js'

public parseXml() source

import {parseXml} from 'ngl/src/utils/parse-xml.js'

public pclamp() source

import {pclamp} from 'ngl/src/math/math-utils.js'

public pick() source

import {pick} from 'ngl/src/utils.js'

public polarBackboneContacts() source

import {polarBackboneContacts} from 'ngl/src/geometry/contact-utils.js'

public polarContacts() source

import {polarContacts} from 'ngl/src/geometry/contact-utils.js'

public projectPointOnVector() source

import {projectPointOnVector} from 'ngl/src/math/vector-utils.js'

public quickselectCmp() source

import {quickselectCmp} from 'ngl/src/math/array-utils.js'

public quicksortCmp() source

import {quicksortCmp} from 'ngl/src/math/array-utils.js'

public quicksortIP(arr: TypedArray, eleSize: Integer, orderElement: Integer, begin: Integer, end: Integer): TypedArray source

import {quicksortIP} from 'ngl/src/math/array-utils.js'

quicksortIP

Params:

NameTypeAttributeDescription
arr TypedArray

array to be sorted

eleSize Integer

element size

orderElement Integer

index of element used for sorting, < eleSize

begin Integer
  • optional

start index for range to be sorted

end Integer
  • optional

end index for range to be sorted

Return:

TypedArray

the input array

Example:

points: [x, y, z, x, y, z, x, y, z, ...]
eleSize: 3 //because of (x, y, z)
orderElement: 0 //order according to x

public radToDeg() source

import {radToDeg} from 'ngl/src/math/math-utils.js'

public randomColorArray() source

import {randomColorArray} from 'ngl/src/math/array-utils.js'

public rangeInSortedArray() source

import {rangeInSortedArray} from 'ngl/src/utils.js'

public reorderAtoms() source

import {reorderAtoms} from 'ngl/src/structure/structure-utils.js'

public replicateArray3Entries() source

import {replicateArray3Entries} from 'ngl/src/math/array-utils.js'

public saturate() source

import {saturate} from 'ngl/src/math/math-utils.js'

public serialArray() source

import {serialArray} from 'ngl/src/math/array-utils.js'

public serialBlockArray() source

import {serialBlockArray} from 'ngl/src/math/array-utils.js'

public setDebug() source

import {setDebug} from 'ngl/src/globals.js'

public setExtensionFragDepth() source

import {setExtensionFragDepth} from 'ngl/src/globals.js'

public setSupportsReadPixelsFloat() source

import {setSupportsReadPixelsFloat} from 'ngl/src/globals.js'

public smootherstep() source

import {smootherstep} from 'ngl/src/math/math-utils.js'

public smootheststep() source

import {smootheststep} from 'ngl/src/math/math-utils.js'

public smoothstep() source

import {smoothstep} from 'ngl/src/math/math-utils.js'

public sortProjectedPosition() source

import {sortProjectedPosition} from 'ngl/src/viewer/viewer-utils.js'

public spline() source

import {spline} from 'ngl/src/math/math-utils.js'

public subCols() source

import {subCols} from 'ngl/src/math/matrix-utils.js'

public subRows() source

import {subRows} from 'ngl/src/math/matrix-utils.js'

public submit() source

import {submit} from 'ngl/src/utils.js'

public superpose(s1: Structure | StructureView, s2: Structure | StructureView, align: Boolean, sele1: String, sele2: String): undefined source

import {superpose} from 'ngl/src/align/align-utils.js'

Perform structural superposition of two structures, optionally guided by a sequence alignment

Params:

NameTypeAttributeDescription
s1 Structure | StructureView

structure 1 which is superposed onto structure 2

s2 Structure | StructureView

structure 2 onto which structure 1 is superposed

align Boolean
  • optional

guide the superposition by a sequence alignment

sele1 String
  • optional

selection string for structure 1

sele2 String
  • optional

selection string for structure 2

Return:

undefined

public svd() source

import {svd} from 'ngl/src/math/matrix-utils.js'

public testTextureSupport() source

import {testTextureSupport} from 'ngl/src/viewer/viewer-utils.js'

public throttle() source

import {throttle} from 'ngl/src/utils.js'

public transpose() source

import {transpose} from 'ngl/src/math/matrix-utils.js'

public uint8ToLines() source

import {uint8ToLines} from 'ngl/src/utils.js'

public uint8ToString() source

import {uint8ToString} from 'ngl/src/utils.js'

public uniformArray() source

import {uniformArray} from 'ngl/src/math/array-utils.js'

public uniformArray3() source

import {uniformArray3} from 'ngl/src/math/array-utils.js'

public uniqueArray() source

import {uniqueArray} from 'ngl/src/utils.js'

public updateMaterialUniforms() source

import {updateMaterialUniforms} from 'ngl/src/viewer/viewer-utils.js'

public v3add() source

import {v3add} from 'ngl/src/math/vector-utils.js'

public v3addScalar() source

import {v3addScalar} from 'ngl/src/math/vector-utils.js'

public v3angle() source

import {v3angle} from 'ngl/src/math/vector-utils.js'

public v3ceil() source

import {v3ceil} from 'ngl/src/math/vector-utils.js'

public v3cross() source

import {v3cross} from 'ngl/src/math/vector-utils.js'

public v3divide() source

import {v3divide} from 'ngl/src/math/vector-utils.js'

public v3divideScalar() source

import {v3divideScalar} from 'ngl/src/math/vector-utils.js'

public v3dot() source

import {v3dot} from 'ngl/src/math/vector-utils.js'

public v3floor() source

import {v3floor} from 'ngl/src/math/vector-utils.js'

public v3forEach() source

import {v3forEach} from 'ngl/src/math/vector-utils.js'

public v3fromArray() source

import {v3fromArray} from 'ngl/src/math/vector-utils.js'

public v3length() source

import {v3length} from 'ngl/src/math/vector-utils.js'

public v3multiply() source

import {v3multiply} from 'ngl/src/math/vector-utils.js'

public v3multiplyScalar() source

import {v3multiplyScalar} from 'ngl/src/math/vector-utils.js'

public v3negate() source

import {v3negate} from 'ngl/src/math/vector-utils.js'

public v3new() source

import {v3new} from 'ngl/src/math/vector-utils.js'

public v3normalize() source

import {v3normalize} from 'ngl/src/math/vector-utils.js'

public v3round() source

import {v3round} from 'ngl/src/math/vector-utils.js'

public v3sub() source

import {v3sub} from 'ngl/src/math/vector-utils.js'

public v3subScalar() source

import {v3subScalar} from 'ngl/src/math/vector-utils.js'

public v3toArray() source

import {v3toArray} from 'ngl/src/math/vector-utils.js'

Static Private

private Grid() source

import Grid from 'ngl/src/geometry/grid.js'

private Queue() source

import Queue from 'ngl/src/utils/queue.js'

private SpatialHash() source

import SpatialHash from 'ngl/src/geometry/spatial-hash.js'

private StructureBuilder() source

import StructureBuilder from 'ngl/src/structure/structure-builder.js'

private TiledRenderer() source

import TiledRenderer from 'ngl/src/viewer/tiled-renderer.js'

private degToRad() source

import {degToRad} from 'ngl/src/math/math-utils.js'