https://github.com/bionode/bionode-vcf
vcf parser using javascript
https://github.com/bionode/bionode-vcf
bioinformatics bionode nodejs parser tool
Last synced: 10 months ago
JSON representation
vcf parser using javascript
- Host: GitHub
- URL: https://github.com/bionode/bionode-vcf
- Owner: bionode
- License: mit
- Created: 2015-12-04T10:25:04.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-22T17:56:13.000Z (almost 8 years ago)
- Last Synced: 2024-04-13T16:34:12.759Z (almost 2 years ago)
- Topics: bioinformatics, bionode, nodejs, parser, tool
- Language: JavaScript
- Size: 45.9 KB
- Stars: 5
- Watchers: 19
- Forks: 7
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# bionode-vcf
> a vcf parser in javascript
[](http://npmjs.org/package/bionode-vcf)
[](https://travis-ci.org/bionode/bionode-vcf)
[](http://coveralls.io/r/bionode/bionode-vcf)
[](http://david-dm.org/bionode/bionode-vcf)
[](https://www.npmjs.com/package/bionode-vcf)
[](https://gitter.im/bionode/bionode)
## Install
You need to install the latest Node.JS first, please check [nodejs.org](http://nodejs.org) or do the following:
```bash
# Ubuntu
sudo apt-get install npm
# Mac
brew install node
# Both
npm install -g n
n stable
```
To use `bionode-vcf` as a command line tool, you can install it globally with `-g`.
```bash
npm install bionode-vcf -g
```
Or, if you want to use it as a JavaScript library, you need to install it in your local project folder inside the `node_modules` directory by doing the same command **without** `-g`.
```bash
npm i bionode-vcf # 'i' can be used as shortcut to 'install'
```
### Usage
#### vcf.read
- `vcf.read` takes params: `path`
- The supported filetypes are `vcf`, `zip` and `gz`.
```javascript
var vcf = require('bionode-vcf');
vcf.read("/path/sample.vcf");
vcf.on('data', function(feature){
console.log(feature);
})
vcf.on('end', function(){
console.log('end of file')
})
vcf.on('error', function(err){
console.error('it\'s not a vcf', err)
})
```
#### vcf.readStream
- `vcf.readStream` takes params: `stream` and `extension`
- The supported extension are `vcf`, `zip` and `gz`.
```javascript
var vcf = require('bionode-vcf');
var fileStream = s3.getObject({
Bucket: [BUCKETNAME],
Key: [FILENAME]
}).createReadStream(); // or stream data from any other source
vcf.read(filestream, 'zip'); // default value is `vcf`
vcf.on('data', function(feature){
console.log(feature);
})
vcf.on('end', function(){
console.log('end of file')
})
vcf.on('error', function(err){
console.error('it\'s not a vcf', err)
})
```
## Documentation
VCF format specifications and more information about the fileds can be found at
[1000 genomes webpage](http://www.1000genomes.org/wiki/analysis/variant%20call%20format/vcf-variant-call-format-version-41) and
[samtools github page](https://github.com/samtools/hts-specs)
## Contributing
We welcome all kinds of contributions at all levels of experience, please read the [CONTRIBUTING.md](CONTRIBUTING.md) to get started!