https://github.com/sacdallago/protein
https://github.com/sacdallago/protein
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/sacdallago/protein
- Owner: sacdallago
- License: gpl-3.0
- Created: 2017-11-10T16:48:57.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-04-09T08:41:27.000Z (about 6 years ago)
- Last Synced: 2025-04-24T01:59:57.463Z (about 1 year 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.