[name]

A loader for loading a .pdb resource.

The Protein Data Bank file format is a textual file format describing the three-dimensional structures of molecules.

Constructor

[name]( [page:LoadingManager manager] )

[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
Creates a new [name].

Properties

Methods

[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )

[page:String url] — required. URL to the .pdb file
[page:Function onLoad] — Will be called when load completes. The arguments will be an [page:Geometry geometryAtoms], [page:Geometry geometryBonds] and the [page:Object JSON] structure.
[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.
[page:Function onError] — Will be called when load errors.
Begin loading from url and call onLoad with the parsed response content.

[method:Object parsePDB]( [page:String text] )

[page:String text] — The textual pdb structure to parse.
Parse a pdb text and return a JSON structure.

[method:null createModel]( [page:Object json], [page:Function callback] )

[page:Object json] — The (JSON) pdb structure to parse.
[page:Function callback] — Will be called when parse completes, with three arguments: [page:Geometry geometryAtoms], [page:Geometry geometryBonds] and the original [page:Object json].
Parse a (JSON) pdb structure and return two [page:Geometry]: one for atoms, one for bonds.

Example

// instantiate a loader var loader = new THREE.PDBLoader(); // load a PDB resource loader.load( // resource URL 'models/molecules/caffeine.pdb', // Function when resource is loaded function ( geometryAtoms, geometryBonds, json ) { console.log( 'This molecule has ' + json.atoms.length + ' atoms' ); }, // Function called when download progresses function ( xhr ) { console.log( (xhr.loaded / xhr.total * 100) + '% loaded' ); }, // Function called when download errors function ( xhr ) { console.log( 'An error happened' ); } ); [example:webgl_loader_pdb]

Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PDBLoader.js examples/js/loaders/PDBLoader.js]