protein-parser
v0.1.1
Published
A collecection of utilities to parse and represent proteins in js
Downloads
7
Readme
Protein
How to use
Require this package via npm, then:
In a node application:
const Protein = require('protein'); let testText = "ABBABABABABABABA"; let parsingFunction = Protein.autodetect(testText); if(parsingFunction !== undefined){ parsingFunction(testText) .then(([proteins, _]) => { proteins.forEach(p => console.log(p)); }); }
For use in web pages
<script src="path/to/build/protein-browser.js"></script> <script> Protein.fromAccession("P12345") .then(([proteins, raw]) => { var retrievedProtein = proteins[0]; createElement(JSON.stringify(retrievedProtein)); }) .catch(() => { console.error("could not GET protein by accession"); }); </script>
Use non-transpiled methods (e.g. React)
import { fromAccession } from 'protein/lib/browser'; Protein.fromAccession("P12345") .then(([proteins, raw]) => { var retrievedProtein = proteins[0]; createElement(JSON.stringify(retrievedProtein)); }) .catch(() => { console.error("could not GET protein by accession"); });
You can refer to the examples
folder for complete examples and the docs
for documentation.