├── .gitignore ├── .npmignore ├── index.js ├── test ├── test.fasta.gz ├── test.fasta ├── data.json └── bionode-fasta.js ├── Dockerfile ├── docs ├── public │ ├── fonts │ │ ├── aller-bold.eot │ │ ├── aller-bold.ttf │ │ ├── aller-bold.woff │ │ ├── aller-light.eot │ │ ├── aller-light.ttf │ │ ├── aller-light.woff │ │ ├── novecento-bold.eot │ │ ├── novecento-bold.ttf │ │ └── novecento-bold.woff │ └── stylesheets │ │ └── normalize.css ├── docco.css └── bionode-fasta.html ├── contributors.md ├── .travis.yml ├── .jshintrc ├── LICENSE ├── cli.js ├── package.json ├── CODE_OF_CONDUCT.md ├── README.md └── lib └── bionode-fasta.js /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | coverage 4 | tmp -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | coverage 4 | tmp -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/bionode-fasta') 2 | -------------------------------------------------------------------------------- /test/test.fasta.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-fasta/HEAD/test/test.fasta.gz -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:argon 2 | MAINTAINER Bruno Vieira 3 | 4 | RUN npm install -g bionode-fasta 5 | -------------------------------------------------------------------------------- /docs/public/fonts/aller-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-fasta/HEAD/docs/public/fonts/aller-bold.eot -------------------------------------------------------------------------------- /docs/public/fonts/aller-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-fasta/HEAD/docs/public/fonts/aller-bold.ttf -------------------------------------------------------------------------------- /docs/public/fonts/aller-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-fasta/HEAD/docs/public/fonts/aller-bold.woff -------------------------------------------------------------------------------- /docs/public/fonts/aller-light.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-fasta/HEAD/docs/public/fonts/aller-light.eot -------------------------------------------------------------------------------- /docs/public/fonts/aller-light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-fasta/HEAD/docs/public/fonts/aller-light.ttf -------------------------------------------------------------------------------- /docs/public/fonts/aller-light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-fasta/HEAD/docs/public/fonts/aller-light.woff -------------------------------------------------------------------------------- /docs/public/fonts/novecento-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-fasta/HEAD/docs/public/fonts/novecento-bold.eot -------------------------------------------------------------------------------- /docs/public/fonts/novecento-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-fasta/HEAD/docs/public/fonts/novecento-bold.ttf -------------------------------------------------------------------------------- /docs/public/fonts/novecento-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-fasta/HEAD/docs/public/fonts/novecento-bold.woff -------------------------------------------------------------------------------- /contributors.md: -------------------------------------------------------------------------------- 1 | ## Contributors 2 | ##### [Generated](https://github.com/jakeleboeuf/contributor) on Sun Aug 10 2014 00:55:50 GMT+0100 (WEST) 3 | - [Alan Rice](https://github.com/alanrice) 4 | - [Bruno Vieira](https://github.com/bmpvieira) -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | after_script: 5 | - npm run coveralls 6 | notifications: 7 | irc: 8 | channels: 9 | - "chat.freenode.net#bionode" 10 | template: 11 | - "%{message}: %{repository}#%{build_number}: %{commit_message} (%{branch} - %{commit} : %{author})" 12 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "asi": true, // Tolerate Automatic Semicolon Insertion (no semicolons). 3 | "browser": true, // Standard browser globals e.g. `window`, `document`. 4 | "dojo": true, // Enable globals exposed by Dojo Toolkit. 5 | "jquery": true, // Enable globals exposed by jQuery JavaScript library. 6 | "node": true, // Enable globals available when code is running inside of the NodeJS runtime environment. 7 | "shadow": true, // This option suppresses warnings about variable shadowing i.e. declaring a variable that had been already declared somewhere in the outer scope. 8 | "laxcomma": true, // This option suppresses warnings about comma-first coding style. 9 | "laxbreak": true // This option suppresses most of the warnings about possibly unsafe line breakings in your code. 10 | } -------------------------------------------------------------------------------- /test/test.fasta: -------------------------------------------------------------------------------- 1 | >contig1 2 | TCACCAACTACGAGATATGAGGTAAGCCAAAAAAGCACGTGGTGGCGCTCACCGACTGTTCCCAAACTGTAACTCATCGTT 3 | CCGTCAAGGCCTGACTTACTTCCCGGCCCTTTCCATGCGCGGACCATACCGTCCTAGTTCTTCGGTTATGTTTCCGATGTA 4 | GGAGTGAGCCTACCTCCGTTTGCGTCTTGTTACCAATGAAAAAGCTATGCACTTTGTACAGGGTGCCATCGGGTTTCTGAA 5 | CTCTCAGATAGTGGGGATCCCGGGAAAGGGCCTATATTTGCGGTCCAACTTAGGCGTAAACCTCGATGCTACCTACTCAGA 6 | CCCACCCCGCGCGGGGTAAATATGGCACTCATCCCAGCTGGTTCTTGGCGTTCTACGCAGCCACATGTTCATTAACAGTTG 7 | TCTGGTAGCACAAAAGTATTACCATGGTCCTAGAAGCCCGGCAGAGTTAGTTCGAACCTAATGCCACAAATGAGACAGGAC 8 | 9 | >contig2 10 | GCCAATGGGTACCGGACATTAGGTCGAGCTCAGTTCGGTAACGGAGAGACCCTGCGGCGTACTTAATTATGCATATGAAAC 11 | GCGCCCAAGTGACGCCAGGCAAGTCTCAGCAGGTTCCCGTGTTAGCTCGAGGGTAAACATACAAGCCGATTGAACATGGGT 12 | TGGGGGCTTCAAATCGTCGAGGACCCCACAGTACCTCGGAGACCAAGTAGGGCACCCTATAGTTCGAAGCAGAACTATTTC 13 | GAGGGGCGAGCCCTCATCGTCTCTTCTGCGGATGACTTAACACGCTAGGGACGTGGAGTCGATTCCATCGATGGTTATAAA 14 | 15 | > contig3 with | "strange" chars > in the header % 123 16 | TCAAAGATTCGGAATGCTGTCTGGAGGGTGAATCTAACGGTGCGTATCTCGATTGCTCAGTCGCTTTTCGTACTGCGCGAA 17 | AGTTCGTACCGCTCATTCACTTGGTTCCGAAGCCTGTCCTGATATATGAATCCAAACTAGAGCGGGGCTCTTGACATTTGG 18 | AGTTGTAAATATCTAATACTCCAATCGG 19 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Bruno Vieira 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /test/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "fasta": [ 3 | { 4 | "id":"contig1", 5 | "seq":"TCACCAACTACGAGATATGAGGTAAGCCAAAAAAGCACGTGGTGGCGCTCACCGACTGTTCCCAAACTGTAACTCATCGTTCCGTCAAGGCCTGACTTACTTCCCGGCCCTTTCCATGCGCGGACCATACCGTCCTAGTTCTTCGGTTATGTTTCCGATGTAGGAGTGAGCCTACCTCCGTTTGCGTCTTGTTACCAATGAAAAAGCTATGCACTTTGTACAGGGTGCCATCGGGTTTCTGAACTCTCAGATAGTGGGGATCCCGGGAAAGGGCCTATATTTGCGGTCCAACTTAGGCGTAAACCTCGATGCTACCTACTCAGACCCACCCCGCGCGGGGTAAATATGGCACTCATCCCAGCTGGTTCTTGGCGTTCTACGCAGCCACATGTTCATTAACAGTTGTCTGGTAGCACAAAAGTATTACCATGGTCCTAGAAGCCCGGCAGAGTTAGTTCGAACCTAATGCCACAAATGAGACAGGAC" 6 | }, 7 | { 8 | "id":"contig2", 9 | "seq":"GCCAATGGGTACCGGACATTAGGTCGAGCTCAGTTCGGTAACGGAGAGACCCTGCGGCGTACTTAATTATGCATATGAAACGCGCCCAAGTGACGCCAGGCAAGTCTCAGCAGGTTCCCGTGTTAGCTCGAGGGTAAACATACAAGCCGATTGAACATGGGTTGGGGGCTTCAAATCGTCGAGGACCCCACAGTACCTCGGAGACCAAGTAGGGCACCCTATAGTTCGAAGCAGAACTATTTCGAGGGGCGAGCCCTCATCGTCTCTTCTGCGGATGACTTAACACGCTAGGGACGTGGAGTCGATTCCATCGATGGTTATAAA" 10 | }, 11 | { 12 | "id":"contig3 with | \"strange\" chars > in the header % 123", 13 | "seq":"TCAAAGATTCGGAATGCTGTCTGGAGGGTGAATCTAACGGTGCGTATCTCGATTGCTCAGTCGCTTTTCGTACTGCGCGAAAGTTCGTACCGCTCATTCACTTGGTTCCGAAGCCTGTCCTGATATATGAATCCAAACTAGAGCGGGGCTCTTGACATTTGGAGTTGTAAATATCTAATACTCCAATCGG" 14 | } 15 | ] 16 | } 17 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var fs = require('fs') 3 | var minimist = require('minimist') 4 | var fasta = require('./') 5 | 6 | var argv = minimist(process.argv.slice(2), { 7 | boolean: ['path', 'file'], 8 | alias: { 9 | file: 'f', 10 | path: 'p' 11 | } 12 | }) 13 | 14 | if (argv.help) { 15 | console.log( 16 | 'Usage: bionode-fasta \n\n' + 17 | 'You can also use fasta files compressed with gzip\n' + 18 | 'If no output is provided, the result will be printed to stdout\n\n' + 19 | 'Options: -p, --path: Includes the path of the original file as a property of the output objects\n\n' 20 | ) 21 | } 22 | 23 | var options = { 24 | includePath: argv.path, 25 | filenameMode: argv.file && !argv.write 26 | } 27 | 28 | var output = argv._[1] ? fs.createWriteStream(argv._[1]) : process.stdout 29 | 30 | var parser = argv.write ? fasta.write() : fasta(options, argv._[0]) 31 | 32 | parser.pipe(output) 33 | 34 | process.stdin.setEncoding('utf8') 35 | 36 | if (!process.stdin.isTTY) { 37 | process.stdin.on('data', function (data) { 38 | if (data.trim() === '') { return } 39 | parser.write(data) 40 | }) 41 | process.stdin.on('end', function () { 42 | parser.end() 43 | }) 44 | } 45 | 46 | process.stdout.on('error', function (err) { 47 | if (err.code === 'EPIPE') { process.exit(0) } 48 | }) 49 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bionode-fasta", 3 | "description": "Streamable FASTA parser", 4 | "version": "0.5.6", 5 | "homepage": "http://bionode.io", 6 | "repository": { 7 | "type": "git", 8 | "url": "git://github.com/bionode/bionode-fasta.git" 9 | }, 10 | "author": { 11 | "name": "Bruno Vieira", 12 | "email": "mail@bmpvieira.com" 13 | }, 14 | "license": "MIT", 15 | "dependencies": { 16 | "concat-stream": "~1.6.0", 17 | "fasta-parser": "0.1.0", 18 | "minimist": "~1.2.0", 19 | "pumpify": "~1.3.5", 20 | "split2": "^2.1.1", 21 | "through2": "~2.0.3" 22 | }, 23 | "devDependencies": { 24 | "async": "~2.3.0", 25 | "beefy": "^2.1.8", 26 | "browserify": "git+https://github.com/bmpvieira/node-browserify#3.46.1/http-browserify-1.6.0-pull-53-61-62", 27 | "browserify-fs": "~1.0.0", 28 | "contributor": "~0.1.25", 29 | "coveralls": "~2.13.0", 30 | "docco": "~0.7.0", 31 | "istanbul": "~0.4.5", 32 | "request": "~2.81.0", 33 | "standard": "^10.0.2", 34 | "tap-spec": "~4.1.1", 35 | "tape": "~4.6.3", 36 | "testling": "^1.7.1", 37 | "uglify-js": "~2.8.22" 38 | }, 39 | "keywords": [ 40 | "bio", 41 | "biology", 42 | "bioinformatics", 43 | "bionode", 44 | "fasta", 45 | "parser", 46 | "streams", 47 | "cli", 48 | "science" 49 | ], 50 | "main": "index.js", 51 | "bin": { 52 | "bionode-fasta": "cli.js" 53 | }, 54 | "browser": { 55 | "fs": "browserify-fs" 56 | }, 57 | "scripts": { 58 | "test": "standard && node test/bionode-fasta.js | tap-spec", 59 | "test-browser": "browserify test/bionode-fasta.js | testling -x 'open -a \"Google Chrome\"' | tap-spec", 60 | "coverage": "istanbul cover test/bionode-fasta.js --report lcovonly -- | tap-spec && rm -rf ./coverage", 61 | "coveralls": "istanbul cover test/bionode-fasta.js --report lcovonly -- | tap-spec && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf ./coverage", 62 | "build-browser": "browserify index.js -r ./index.js:bionode-fasta | uglifyjs > bionode-fasta.min.js", 63 | "build-docs": "docco ./lib/bionode-fasta.js" 64 | }, 65 | "testling": { 66 | "files": "test/bionode-fasta.js", 67 | "browsers": [ 68 | "ie/8..latest", 69 | "firefox/17..latest", 70 | "firefox/nightly", 71 | "chrome/22..latest", 72 | "chrome/canary", 73 | "opera/12..latest", 74 | "opera/next", 75 | "safari/5.1..latest", 76 | "ipad/6.0..latest", 77 | "iphone/6.0..latest", 78 | "android-browser/4.2..latest" 79 | ] 80 | }, 81 | "contributors": [ 82 | { 83 | "name": "Alan Rice", 84 | "email": "alanmrice@gmail.com", 85 | "url": "https://github.com/alanrice", 86 | "contributions": 12, 87 | "hireable": false 88 | }, 89 | { 90 | "name": "Bruno Vieira", 91 | "email": "mail@bmpvieira.com", 92 | "url": "https://github.com/bmpvieira", 93 | "contributions": 1, 94 | "hireable": false 95 | } 96 | ] 97 | } 98 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Contributor Covenant Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to making participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, gender identity and expression, level of experience, 9 | nationality, personal appearance, race, religion, or sexual identity and 10 | orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies both within project spaces and in public spaces 49 | when an individual is representing the project or its community. Examples of 50 | representing a project or community include using an official project e-mail 51 | address, posting via an official social media account, or acting as an appointed 52 | representative at an online or offline event. Representation of a project may be 53 | further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at mail@bionode.io. All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at [http://contributor-covenant.org/version/1/4][version] 72 | 73 | [homepage]: http://contributor-covenant.org 74 | [version]: http://contributor-covenant.org/version/1/4/ 75 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | bionode logo 4 | 5 |
6 | bionode.io 7 |

8 | 9 | # bionode-fasta 10 | > Streamable FASTA parser. 11 | 12 | [![NPM version][npm-image]][npm-url] 13 | [![Build Status][travis-image]][travis-url] 14 | [![Coveralls Status][coveralls-image]][coveralls-url] 15 | [![Dependency Status][depstat-image]][depstat-url] 16 | [![Gitter chat][gitter-image]][gitter-url] 17 | [![DOI][doi-image]][doi-url] 18 | 19 | 20 | Install 21 | ------- 22 | 23 | Install ```bionode-fasta``` with [npm](//npmjs.org): 24 | 25 | ```sh 26 | $ npm install bionode-fasta 27 | ``` 28 | To use it as a command line tool, you can install it globally by adding ```-g``` . 29 | 30 | Alternatively, just include `bionode-fasta.min.js` via a `