bionode-ncbi
Advanced tools
Comparing version 1.6.0 to 1.6.1
32
cli.js
#!/usr/bin/env node | ||
var minimist = require('minimist') | ||
var JSONStream = require('JSONStream') | ||
var split = require('split') | ||
var split = require('split2') | ||
var ncbi = require('./') | ||
@@ -15,4 +15,15 @@ | ||
var argv = minimist(process.argv.slice(2), minimistOptions) | ||
var jsonPattern = /\{(.+?)\}/, | ||
args = process.argv.slice(2).join(' '), | ||
options = {}, | ||
match = args.match(jsonPattern) | ||
if (match) { | ||
var jsonLine = match[0].replace(/\'/g, '\"'), | ||
options = JSON.parse(jsonLine), | ||
args = args.replace(match[0], 'obj') | ||
} | ||
var argv = minimist(args.split(' '), minimistOptions) | ||
if (argv.help || argv._.length === 0) { | ||
@@ -40,13 +51,13 @@ console.log('Please check the documentation at http://doc.bionode.io') | ||
var options | ||
if (Object.keys(argv).length > 1) { | ||
options = { | ||
limit: argv.limit, | ||
throughput: argv.throughput, | ||
db: arg1, | ||
term: arg2 | ||
options.limit = argv.limit | ||
options.throughput = argv.throughput | ||
if (arg1 !== 'obj') { | ||
options.db = arg1 | ||
options.term = arg2 | ||
} | ||
} | ||
var ncbiStream = options ? ncbi[command](options) : ncbi[command](arg1, arg2, arg3) | ||
var ncbiStream = Object.keys(options).length ? ncbi[command](options) : ncbi[command](arg1, arg2, arg3) | ||
@@ -62,2 +73,5 @@ ncbiStream.pipe(JSONStream.stringify(false)).pipe(process.stdout) | ||
}) | ||
process.stdin.on('end', function () { | ||
ncbiStream.end() | ||
}) | ||
} | ||
@@ -64,0 +78,0 @@ |
@@ -590,3 +590,3 @@ // # bionode-ncbi | ||
// ## Fetch | ||
// Allows retrieval of records from NCBI databases. Takes the database name, and a search term, | ||
// Allows retrieval of records from NCBI databases. Takes the database name and a search term, | ||
// and returns the records from the database that match the search term. There are optional | ||
@@ -596,3 +596,3 @@ // advanced parameters that allow you to define how many records to retrieve and extra options | ||
// | ||
// i.e it can return a subset of a genetic sequence of a requested species | ||
// It can return a subset of a genetic sequence of a requested species | ||
// | ||
@@ -606,3 +606,3 @@ // ncbi.fetch('sra', 'solenopsis_invicta') | ||
// | ||
// With advanced parameters for sequence databases(all are optional): | ||
// With advanced optional parameters: | ||
// | ||
@@ -613,11 +613,15 @@ // var opts = { | ||
// strand: 1, | ||
// complexity: 4 | ||
// complexity: 4, | ||
// seq_start: 1, | ||
// seq_stop: 50 | ||
// } | ||
// | ||
// ncbi.fetch(opts) | ||
// => { id: 'gi|557436392|gb|HE992975.1|HE992975 HE992975 Guillardia theta CCMP 327 Guillardia theta cDNA clone sg-p_014_h06, mRNA sequence', | ||
// seq: 'GAAGGCGATTCCAATGGTGCGAGCGAGGCAGCGAACAGACGCAGCGGGGAGAG... | ||
// } | ||
// => { id: 'gi|557436392|gb|HE992975.1|HE992975:1-50 HE992975 Guillardia theta CCMP 327 Guillardia theta cDNA clone sg-p_014_h06, mRNA sequence', | ||
// seq: 'GAAGGCGATTCCAATGGTGCGAGCGAGGCAGCGAACAGACGCAGCGGGGA' } | ||
// { id: 'gi|557436391|gb|HE992974.1|HE992974:1-50 HE992974 Guillardia theta CCMP 327 Guillardia theta cDNA clone sg-p_014_h05, mRNA sequence', | ||
// seq: 'GTCGCGGTTGGCATGGCTGAGGAGAATCCGATCCCTCGGCTAGACGCCTG' } | ||
// => [...] | ||
// For some databases there are multiple return types. A default one will be chosen | ||
// automatically, however it is possible to specify this via the rettype option e.g: | ||
// automatically, however it is possible to specify this via the rettype option. | ||
// | ||
@@ -631,3 +635,2 @@ // The NCBI website provides a list of databasese supported by efetch here: | ||
// Default rettypes if user doesn't provide any | ||
var rettypes = { | ||
@@ -634,0 +637,0 @@ bioproject: 'xml', |
{ | ||
"name": "bionode-ncbi", | ||
"description": "Node.js module for working with the NCBI API (aka e-utils) using Streams.", | ||
"version": "1.6.0", | ||
"version": "1.6.1", | ||
"homepage": "http://github.com/bionode/bionode-ncbi", | ||
@@ -17,4 +17,6 @@ "repository": { | ||
"async": "^0.9.0", | ||
"bionode-fasta": "^0.5.3", | ||
"cheerio": "^0.19.0", | ||
"concat-stream": "~1.4.8", | ||
"debug": "^2.1.3", | ||
"minimist": "^1.1.1", | ||
@@ -25,8 +27,6 @@ "mkdirp": "^0.5.0", | ||
"request": "^2.55.0", | ||
"split": "^0.3.3", | ||
"split2": "^2.0.1", | ||
"through2": "^0.6.3", | ||
"tool-stream": "0.2.1", | ||
"debug": "^2.1.3", | ||
"xml2js": "^0.4.6", | ||
"bionode-fasta": "^0.5.3" | ||
"xml2js": "^0.4.6" | ||
}, | ||
@@ -33,0 +33,0 @@ "devDependencies": { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6831
1873404
30
+ Addedsplit2@^2.0.1
- Removedsplit@^0.3.3