##Another library to parse and manipulate "Protein Data Bank" files Last revision : GL -- 06042016 Version tag : 0.2
###1. Installation and test
To install package and dependencies
npm install pdb-lib
Launch test within the test folder
node ./test.js -f ./1Z00.pdb
###2. API
var pdbLib = require("pdb-lib")
pdbLib.parse({"ValidKey" : input).on('end', callback)
Where callback is passed the created pdbObject as single parameter.
The inputs must be passed along with key used for source identification. Following {key, input} pairs are supported:
- file : path to a file following the PDB standard
- rStream : a reference to a node readable stream
pdbLib.parse({file : "./test/1Z00.pdb"})
.on("end", function(pdbObjInp){
pdbObject = pdbObjInp;
});
The pdbObject interface tries to combine object chaining with "pymol-like" selecting expressions. A pdbObject implements the following methods.
###### pdbObject.model(int) The mandatory method used to initialize or reset atom selections. Assign to the **current selection**, the coordinates model designated by provided number. If the input featured no alternative structure (no "model ID" ), a default "number one" model is created so that `pdbObject.model(1)` will always work. The previous **current selection** is effectively erased. **returns** : the pdbObject
Note: Internally, the pdbObject performs most operations on a record of atoms named current selection. On any fresh pdbObject, current selection must be initialized by calling the model method!
Extract from the current selection all atom records with resName field matching the provided coordinateSelectorExpression. returns: the pdbObject
Extract from the current selection all atom records with resSeq field matching the provided coordinateSelectorExpression. returns: the pdbObject
Extract from the current selection all atom records with name field matching the provided coordinateSelectorExpression. returns: the pdbObject
Extract from the current selection all atom records with segID field matching the provided coordinateSelectorExpression. returns: the pdbObject
The coordinateSelectorExpressions are strings used to generate regular expressions. Theses are used by the pdbObject to scan its current selection of atom records. The subset of matching records are consequently deleted from the current section or used to replace the current selection.
coordinateSelectorExpression are passed to a pdbObject method as single or multiple arguments. In the latter case, the OR-logic is employed.
- Select all Lys, Leu, Asp, Asn, Arg :
pdbObj.resName('L*','A*')
The character "*" specifies a unix-like wildcard (/.*/
re-like)
Chaining selector methods allows to apply the AND-logic.
- Select atoms of Lys AND chain A :
pdbObj.resName('LYS').chain('A')
Interval of values can be specified for serial and resSeq fields. Omit one boundary to specify a half-opened interval.
- Select residues between positions 16 and 54 :
pdbObj.resSeq("16:54")
- Select all residues up to number 54 :
pdbObj.resSeq(":54")
The same logic is employed to delete atom selections. Selecting atoms based on atom attributes is achieved through similar methods suffixed with the Del string.
Delete from the current selection all atom records with resName field matching the provided coordinateSelectorExpression. returns: the pdbObject
Delete from the current selection all atom records with resSeq field matching the provided coordinateSelectorExpression. returns: the pdbObject
Delete from the current selection all atom records with name field matching the provided coordinateSelectorExpression. returns: the pdbObject
Delete from the current selection all atom records with segID field matching the provided coordinateSelectorExpression. returns: the pdbObject
- Delete atoms from the chain B, then remove two fragments
pdbObj.model(1).chainDel('B').resSeqDel("290:301","270:277")
A short-cut method to select only the atoms part of the 20 natural amino-acids. returns: the pdbObject
Update the bFactor fields of the current selection of atoms to specified value. By default, any previous value is erased. If the optional parameter is set to "increment", the current bFactor values are incremented of value. returns: null
Compute the size of the current selection of atoms returns: current selection array length
Extract from current selection a list of non-redundant chain identifiers. returns : Array of single characters