Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sacdallago/protein
https://github.com/sacdallago/protein
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/sacdallago/protein
- Owner: sacdallago
- License: gpl-3.0
- Created: 2017-11-10T16:48:57.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-04-09T08:41:27.000Z (over 4 years ago)
- Last Synced: 2024-08-09T03:09:35.737Z (4 months ago)
- Language: JavaScript
- Homepage: http://christian.dallago.us/protein
- Size: 1.63 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-inspiration - protein
README
# Protein
***## How to use
Require this package via npm, then:1. In a node application:
```javascript
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));
});
}
```2. For use in web pages
```html
Protein.fromAccession("P12345")
.then(([proteins, raw]) => {
var retrievedProtein = proteins[0];
createElement(JSON.stringify(retrievedProtein));
})
.catch(() => {
console.error("could not GET protein by accession");
});
```3. Use non-transpiled methods (e.g. React)
```javascript
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.