npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pdb-lib

v2.0.6

Published

A library to parse and manipulate pdb coordinates

Downloads

20

Readme

##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

Loading library

var pdbLib = require("pdb-lib")

Invoking parser

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
Parsing example

pdbLib.parse({file : "./test/1Z00.pdb"})       .on("end", function(pdbObjInp){             pdbObject = pdbObjInp;       });

Manipulating coordinates

The pdbObject interface tries to combine object chaining with "pymol-like" selecting expressions. A pdbObject implements the following methods.

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!

pdbObject.resName(coordinateSelectorExpression)

Extract from the current selection all atom records with resName field matching the provided coordinateSelectorExpression. returns: the pdbObject

pdbObject.resSeq(coordinateSelectorExpression)

Extract from the current selection all atom records with resSeq field matching the provided coordinateSelectorExpression. returns: the pdbObject

pdbObject.name(coordinateSelectorExpression)

Extract from the current selection all atom records with name field matching the provided coordinateSelectorExpression. returns: the pdbObject

pdbObject.chain(coordinateSelectorExpression)

Extract from the current selection all atom records with segID field matching the provided coordinateSelectorExpression. returns: the pdbObject

coordinateSelectorExpression specifications

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.

Variable type

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*')
Regular Expression behavior

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 boundaries

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")

Deleting specific atoms

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.

pdbObject.resNameDel(coordinateSelectorExpression)

Delete from the current selection all atom records with resName field matching the provided coordinateSelectorExpression. returns: the pdbObject

pdbObject.resSeqDel(coordinateSelectorExpression)

Delete from the current selection all atom records with resSeq field matching the provided coordinateSelectorExpression. returns: the pdbObject

pdbObject.nameDel(coordinateSelectorExpression)

Delete from the current selection all atom records with name field matching the provided coordinateSelectorExpression. returns: the pdbObject

pdbObject.chainDel(coordinateSelectorExpression)

Delete from the current selection all atom records with segID field matching the provided coordinateSelectorExpression. returns: the pdbObject

Coordinates manipulation exemples

  • Delete atoms from the chain B, then remove two fragments pdbObj.model(1).chainDel('B').resSeqDel("290:301","270:277")

Additional methods

pdbObject.naturalAminoAcidOnly()

A short-cut method to select only the atoms part of the 20 natural amino-acids. returns: the pdbObject

pdbObject.bFactor(value, [Optional type="increment"])

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

pdbObject.selecSize()

Compute the size of the current selection of atoms returns: current selection array length

pdbObject.listChainID()

Extract from current selection a list of non-redundant chain identifiers. returns : Array of single characters