├── 31868 └── GCF_000010365.1_ASM1036v1_genomic.fna.gz ├── .gitignore ├── index.js ├── .npmignore ├── .travis.yml ├── 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 │ │ ├── roboto-black.eot │ │ ├── roboto-black.ttf │ │ ├── roboto-black.woff │ │ └── novecento-bold.woff │ └── stylesheets │ │ └── normalize.css └── docco.css ├── Dockerfile ├── lib ├── anonymous-tracking.js ├── valid-dbs.js └── bionode-ncbi.js ├── .jshintrc ├── test ├── valid-dbs.js ├── fixtures │ ├── Link sra to bioproject_.json │ ├── Link bioproject to assembly_.json │ ├── Search sra with limit to one_.json │ ├── Search assembly_.json │ ├── Download list for assembly_.json │ ├── Download_.json │ └── Download unless file exists_.json ├── bionode-ncbi.js ├── data.json └── guillardia-theta.sra.json ├── LICENSE ├── package.json ├── README.md ├── CODE_OF_CONDUCT.md ├── cli.js └── CONTRIBUTING.md /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | coverage 4 | tmp 5 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | module.exports = require('./lib/bionode-ncbi') 2 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | coverage 4 | tmp 5 | 503988 6 | test/fixtures 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "7" 4 | after_script: 5 | - npm run coveralls 6 | env: DEBUG="" 7 | -------------------------------------------------------------------------------- /docs/public/fonts/aller-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-ncbi/HEAD/docs/public/fonts/aller-bold.eot -------------------------------------------------------------------------------- /docs/public/fonts/aller-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-ncbi/HEAD/docs/public/fonts/aller-bold.ttf -------------------------------------------------------------------------------- /docs/public/fonts/aller-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-ncbi/HEAD/docs/public/fonts/aller-bold.woff -------------------------------------------------------------------------------- /docs/public/fonts/aller-light.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-ncbi/HEAD/docs/public/fonts/aller-light.eot -------------------------------------------------------------------------------- /docs/public/fonts/aller-light.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-ncbi/HEAD/docs/public/fonts/aller-light.ttf -------------------------------------------------------------------------------- /docs/public/fonts/aller-light.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-ncbi/HEAD/docs/public/fonts/aller-light.woff -------------------------------------------------------------------------------- /docs/public/fonts/novecento-bold.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-ncbi/HEAD/docs/public/fonts/novecento-bold.eot -------------------------------------------------------------------------------- /docs/public/fonts/novecento-bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-ncbi/HEAD/docs/public/fonts/novecento-bold.ttf -------------------------------------------------------------------------------- /docs/public/fonts/roboto-black.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-ncbi/HEAD/docs/public/fonts/roboto-black.eot -------------------------------------------------------------------------------- /docs/public/fonts/roboto-black.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-ncbi/HEAD/docs/public/fonts/roboto-black.ttf -------------------------------------------------------------------------------- /docs/public/fonts/roboto-black.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-ncbi/HEAD/docs/public/fonts/roboto-black.woff -------------------------------------------------------------------------------- /docs/public/fonts/novecento-bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-ncbi/HEAD/docs/public/fonts/novecento-bold.woff -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:argon 2 | MAINTAINER Julian Mazzitelli 3 | 4 | RUN npm install -g bionode-ncbi 5 | -------------------------------------------------------------------------------- /31868/GCF_000010365.1_ASM1036v1_genomic.fna.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bionode/bionode-ncbi/HEAD/31868/GCF_000010365.1_ASM1036v1_genomic.fna.gz -------------------------------------------------------------------------------- /lib/anonymous-tracking.js: -------------------------------------------------------------------------------- 1 | // Anonymous usage metrics for debug and funding, if user agrees 2 | const Insight = require('insight') 3 | const pkg = require('../package.json') 4 | 5 | const insight = new Insight({ 6 | // Google Analytics tracking code 7 | trackingCode: 'UA-54802258-3', 8 | pkg 9 | }) 10 | if (insight.optOut === undefined) { 11 | insight.askPermission('Bionode is open and free. Can we anonymously report usage statistics for improvement and funding purposes?') 12 | } 13 | 14 | module.exports = insight 15 | -------------------------------------------------------------------------------- /.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 | } 11 | -------------------------------------------------------------------------------- /test/valid-dbs.js: -------------------------------------------------------------------------------- 1 | var tape = require('tape') 2 | var tapeNock = require('tape-nock') 3 | var validDbs = require('../lib/valid-dbs') 4 | var ncbi = require('../lib/bionode-ncbi') 5 | 6 | var test = tapeNock(tape) 7 | 8 | test('valid-dbs printDbs', t => { 9 | var dummy = {fakedb: 'Fake!', another: 'Another'} 10 | 11 | var expected = 'fakedb (Fake!)\nanother (Another)' 12 | 13 | t.equals(validDbs.printDbs(dummy), expected, 'printDbs returns the expected string') 14 | 15 | t.end() 16 | }) 17 | 18 | // TODO move this test to a suite just for bionode-ncbi search 19 | test('bionode-ncbi search', t => { 20 | t.plan(1) 21 | 22 | try { 23 | ncbi.search('invalid', 'human') 24 | } catch (err) { 25 | t.assert(err instanceof validDbs.InvalidDbError, 'call search with wrong db throws InvalidDbError') 26 | } 27 | }) 28 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/valid-dbs.js: -------------------------------------------------------------------------------- 1 | 2 | var dbs = { 3 | gquery: 'All Databases', 4 | assembly: 'Assembly', 5 | bioproject: 'BioProject', 6 | biosample: 'BioSample', 7 | biosystems: 'BioSystems', 8 | books: 'Books', 9 | clinvar: 'ClinVar', 10 | clone: 'Clone', 11 | cdd: 'Conserved Domains', 12 | gap: 'dbGaP', 13 | dbvar: 'dbVar', 14 | nucest: 'EST', 15 | gene: 'Gene', 16 | genome: 'Genome', 17 | gds: 'GEO DataSets', 18 | geoprofiles: 'GEO Profiles', 19 | nucgss: 'GSS', 20 | gtr: 'GTR', 21 | homologene: 'HomoloGene', 22 | medgen: 'MedGen', 23 | mesh: 'MeSH', 24 | ncbisearch: 'NCBI Web Site', 25 | nlmcatalog: 'NLM Catalog', 26 | nuccore: 'Nucleotide', 27 | omim: 'OMIM', 28 | pmc: 'PMC', 29 | popset: 'PopSet', 30 | probe: 'Probe', 31 | protein: 'Protein', 32 | proteinclusters: 'Protein Clusters', 33 | pcassay: 'PubChem BioAssay', 34 | pccompound: 'PubChem Compound', 35 | pcsubstance: 'PubChem Substance', 36 | pubmed: 'PubMed', 37 | pubmedhealth: 'PubMed Health', 38 | snp: 'SNP', 39 | sparcle: 'Sparcle', 40 | sra: 'SRA', 41 | structure: 'Structure', 42 | taxonomy: 'Taxonomy', 43 | toolkit: 'ToolKit', 44 | toolkitall: 'ToolKitAll', 45 | toolkitbook: 'ToolKitBook', 46 | toolkitbookgh: 'ToolKitBookgh', 47 | unigene: 'UniGene' 48 | } 49 | 50 | function printDbs (dbsObject) { 51 | dbsObject = dbsObject || dbs 52 | 53 | var keys = Object.keys(dbsObject) 54 | return keys.reduce((acc, k, i) => { 55 | acc = acc + k + ' (' + dbsObject[k] + ')' 56 | if (i < keys.length - 1) { 57 | acc = acc + '\n' 58 | } 59 | return acc 60 | }, '') 61 | } 62 | 63 | function InvalidDbError (msg) { 64 | this.name = 'InvalidDbError' 65 | this.message = msg 66 | } 67 | 68 | InvalidDbError.prototype = new Error('Invalid database') 69 | 70 | module.exports.dbs = dbs 71 | module.exports.InvalidDbError = InvalidDbError 72 | module.exports.printDbs = printDbs 73 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bionode-ncbi", 3 | "description": "Node.js module for working with the NCBI API (aka e-utils) using Streams.", 4 | "version": "2.0.0", 5 | "homepage": "http://github.com/bionode/bionode-ncbi", 6 | "repository": { 7 | "type": "git", 8 | "url": "http://github.com/bionode/bionode-ncbi.git" 9 | }, 10 | "author": { 11 | "name": "Bruno Vieira", 12 | "email": "mail@bmpvieira.com" 13 | }, 14 | "dependencies": { 15 | "JSONStream": "^1.3.1", 16 | "async": "^2.3.0", 17 | "bionode-fasta": "^0.5.6", 18 | "cheerio": "^0.22.0", 19 | "concat-stream": "~1.6.0", 20 | "debug": "^2.6.4", 21 | "insight": "^0.8.4", 22 | "mkdirp": "^0.5.1", 23 | "nugget": "^2.0.1", 24 | "pumpify": "^1.3.5", 25 | "request": "^2.81.0", 26 | "split2": "^2.1.1", 27 | "through2": "^2.0.3", 28 | "tool-stream": "0.2.1", 29 | "xml2js": "^0.4.17", 30 | "yargs": "^7.1.0" 31 | }, 32 | "devDependencies": { 33 | "browserify": "^14.3.0", 34 | "contributor": "~0.1.25", 35 | "coveralls": "~2.13.0", 36 | "dependency-check": "^2.8.0", 37 | "docco": "~0.7.0", 38 | "istanbul": "~0.4.5", 39 | "standard": "^10.0.2", 40 | "tap-spec": "^4.1.1", 41 | "tape": "^4.6.3", 42 | "tape-nock": "^1.6.0", 43 | "testling": "^1.7.1", 44 | "uglify-js": "^2.8.22" 45 | }, 46 | "keywords": [ 47 | "bio", 48 | "bionode", 49 | "bioinformatics", 50 | "biology", 51 | "ncbi", 52 | "api", 53 | "streams", 54 | "client", 55 | "server", 56 | "cli" 57 | ], 58 | "main": "index.js", 59 | "bin": { 60 | "bionode-ncbi": "cli.js" 61 | }, 62 | "scripts": { 63 | "test": "standard && dependency-check . && tape test/**/*.js | tap-spec", 64 | "test-browser": "browserify test/*.js -d | testling -x 'open -a \"Google Chrome\"' | tap-spec", 65 | "coverage": "standard && dependency-check . && istanbul cover tape test/**/*.js --report lcovonly -- | tap-spec && rm -rf ./coverage", 66 | "coveralls": "istanbul cover tape test/**/*.js --report lcovonly -- | tap-spec && cat ./coverage/lcov.info | ./node_modules/.bin/coveralls && rm -rf ./coverage", 67 | "build-browser": "browserify -r ./index.js:bionode-ncbi | uglifyjs > bionode-ncbi.min.js", 68 | "build-docs": "docco ./lib/bionode-ncbi.js" 69 | }, 70 | "license": "MIT" 71 | } 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

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

8 | 9 | 10 | # bionode-ncbi 11 | 12 | > Node.js module to get data from the NCBI API (aka e-utils) 13 | 14 | [![npm](https://img.shields.io/npm/v/bionode-ncbi.svg?style=flat-square)](http://npmjs.org/package/bionode-ncbi) 15 | [![Travis](https://img.shields.io/travis/bionode/bionode-ncbi.svg?style=flat-square)](https://travis-ci.org/bionode/bionode-ncbi) 16 | [![Coveralls](https://img.shields.io/coveralls/bionode/bionode-ncbi.svg?style=flat-square)](http://coveralls.io/r/bionode/bionode-ncbi) 17 | [![Dependencies](http://img.shields.io/david/bionode/bionode-ncbi.svg?style=flat-square)](http://david-dm.org/bionode/bionode-ncbi) 18 | [![npm](https://img.shields.io/npm/dt/bionode-ncbi.svg?style=flat-square)](https://www.npmjs.com/package/bionode-ncbi) 19 | [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg?style=flat-square)](https://gitter.im/bionode/bionode) 20 | 21 | 22 | ## Install 23 | 24 | You need to install the latest Node.JS first, please check [nodejs.org](http://nodejs.org) or do the following: 25 | 26 | ```bash 27 | # Ubuntu 28 | sudo apt-get install npm 29 | # Mac 30 | brew install node 31 | # Both 32 | npm install -g n 33 | n stable 34 | ``` 35 | 36 | To use `bionode-ncbi` as a command line tool, you can install it globally with `-g`. 37 | 38 | ```bash 39 | npm install bionode-ncbi -g 40 | ``` 41 | 42 | 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`. 43 | 44 | ```bash 45 | npm i bionode-ncbi # 'i' can be used as shortcut to 'install' 46 | ``` 47 | 48 | 49 | ## Documentation 50 | 51 | Check our documentation at [doc.bionode.io](http://doc.bionode.io) or do: 52 | 53 | ```bash 54 | bionode-ncbi --help 55 | ``` 56 | 57 | 58 | ## Contributing 59 | 60 | We welcome all kinds of contributions at all levels of experience, please read the [CONTRIBUTING.md](CONTRIBUTING.md) to get started! 61 | 62 | 63 | ## Communication channels 64 | 65 | Don't be shy! Come talk to us :smiley: 66 | 67 | * **Email** [mail@bionode.io](mailto:mail@bionode.io) 68 | * **Chat room** [http://gitter.im/bionode/bionode](http://gitter.im/bionode/bionode) 69 | * **IRC** #bionode on Freenode 70 | * **Twitter** [@bionode](http://twitter.com/@bionode) 71 | 72 | 73 | ## Acknowledgements 74 | 75 | We would like to thank all the people and institutions listed below! 76 | 77 | * [graphs/contributors](https://github.com/bionode/bionode-ncbi/graphs/contributors) 78 | * [bionode/people](https://github.com/orgs/bionode/people) 79 | * [WurmLab](http://wurmlab.github.io) 80 | * [Mozilla Science Lab](https://science.mozilla.org) 81 | -------------------------------------------------------------------------------- /test/fixtures/Link sra to bioproject_.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 4 | "method": "GET", 5 | "path": "/entrez/eutils/elink.fcgi?&dbfrom=sra&db=bioproject&id=35533", 6 | "body": "", 7 | "status": 301, 8 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 9 | "rawHeaders": [ 10 | "Date", 11 | "Sat, 15 Apr 2017 08:53:24 GMT", 12 | "Server", 13 | "Apache", 14 | "Referrer-Policy", 15 | "origin-when-cross-origin", 16 | "Location", 17 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?&dbfrom=sra&db=bioproject&id=35533", 18 | "Content-Length", 19 | "311", 20 | "Connection", 21 | "close", 22 | "Content-Type", 23 | "text/html; charset=iso-8859-1" 24 | ] 25 | }, 26 | { 27 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 28 | "method": "GET", 29 | "path": "/entrez/eutils/elink.fcgi?&dbfrom=sra&db=bioproject&id=35533", 30 | "body": "", 31 | "status": 200, 32 | "response": "\n\n\n\n \n sra\n \n 35533\n \n \n bioproject\n sra_bioproject\n \n \n\t\t\t\t53577\n\t\t\t\n \n \n \n bioproject\n sra_bioproject_all\n \n \n\t\t\t\t53577\n\t\t\t\n \n \n \n \n\n", 33 | "rawHeaders": [ 34 | "Date", 35 | "Sat, 15 Apr 2017 08:53:24 GMT", 36 | "Server", 37 | "Apache", 38 | "Strict-Transport-Security", 39 | "max-age=31536000; includeSubDomains; preload", 40 | "Content-Security-Policy", 41 | "upgrade-insecure-requests", 42 | "Access-Control-Allow-Origin", 43 | "*", 44 | "Cache-Control", 45 | "private", 46 | "NCBI-PHID", 47 | "03ED8AA98F1DE1C1000000000061005F", 48 | "NCBI-SID", 49 | "03ED8AA98F1DF841_0097SID", 50 | "Content-Type", 51 | "text/xml; charset=UTF-8", 52 | "Set-Cookie", 53 | "ncbi_sid=03ED8AA98F1DF841_0097SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 08:53:24 GMT", 54 | "Vary", 55 | "Accept-Encoding", 56 | "X-UA-Compatible", 57 | "IE=Edge", 58 | "X-XSS-Protection", 59 | "1; mode=block", 60 | "Connection", 61 | "close", 62 | "Transfer-Encoding", 63 | "chunked" 64 | ] 65 | } 66 | ] -------------------------------------------------------------------------------- /test/fixtures/Link bioproject to assembly_.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 4 | "method": "GET", 5 | "path": "/entrez/eutils/elink.fcgi?&dbfrom=bioproject&db=assembly&id=53577", 6 | "body": "", 7 | "status": 301, 8 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 9 | "rawHeaders": [ 10 | "Date", 11 | "Sat, 15 Apr 2017 08:53:27 GMT", 12 | "Server", 13 | "Apache", 14 | "Referrer-Policy", 15 | "origin-when-cross-origin", 16 | "Location", 17 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/elink.fcgi?&dbfrom=bioproject&db=assembly&id=53577", 18 | "Content-Length", 19 | "316", 20 | "Connection", 21 | "close", 22 | "Content-Type", 23 | "text/html; charset=iso-8859-1" 24 | ] 25 | }, 26 | { 27 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 28 | "method": "GET", 29 | "path": "/entrez/eutils/elink.fcgi?&dbfrom=bioproject&db=assembly&id=53577", 30 | "body": "", 31 | "status": 200, 32 | "response": "\n\n\n\n \n bioproject\n \n 53577\n \n \n assembly\n bioproject_assembly\n \n \n\t\t\t\t503988\n\t\t\t\n \n \n \n assembly\n bioproject_assembly_all\n \n \n\t\t\t\t503988\n\t\t\t\n \n \n \n\n", 33 | "rawHeaders": [ 34 | "Date", 35 | "Sat, 15 Apr 2017 08:53:27 GMT", 36 | "Server", 37 | "Apache", 38 | "Strict-Transport-Security", 39 | "max-age=31536000; includeSubDomains; preload", 40 | "Content-Security-Policy", 41 | "upgrade-insecure-requests", 42 | "Access-Control-Allow-Origin", 43 | "*", 44 | "Cache-Control", 45 | "private", 46 | "NCBI-PHID", 47 | "03EEBEF38F1DE99100000000003E003E", 48 | "NCBI-SID", 49 | "03EEBEF38F1DF871_0062SID", 50 | "Content-Type", 51 | "text/xml; charset=UTF-8", 52 | "Set-Cookie", 53 | "ncbi_sid=03EEBEF38F1DF871_0062SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 08:53:27 GMT", 54 | "Vary", 55 | "Accept-Encoding", 56 | "X-UA-Compatible", 57 | "IE=Edge", 58 | "X-XSS-Protection", 59 | "1; mode=block", 60 | "Connection", 61 | "close", 62 | "Transfer-Encoding", 63 | "chunked" 64 | ] 65 | } 66 | ] -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | var JSONStream = require('JSONStream') 3 | var split = require('split2') 4 | var ncbi = require('./') 5 | var insight = require('./lib/anonymous-tracking') 6 | var validDbs = require('./lib/valid-dbs') 7 | 8 | var argv = require('yargs') 9 | .strict() 10 | .demandCommand(1) 11 | .version() 12 | .help() 13 | .alias('help', 'h') 14 | .alias('verbose', 'v') 15 | .epilogue('For more information, check our documentation at http://doc.bionode.io') 16 | .usage('Usage: bionode-ncbi [arguments] --limit [num] --pretty') 17 | .command( 18 | 'search [term]', 19 | `Takes a database name and a query term. Returns the metadata.` 20 | ) 21 | .example('search', `taxonomy 'solenopsis invicta'`) 22 | .example('search', `sra human --limit 1 --pretty`) 23 | .command( 24 | 'fetch [term]', 25 | `Takes a database name and a query term. Returns the data.` 26 | ) 27 | .example('fetch', `nucest p53 -l 1 --pretty`) 28 | .command( 29 | 'urls [term]', 30 | `Takes either sra or assembly db name and query term. Returns URLs of datasets.` 31 | ) 32 | .example('urls', `sra solenopsis invicta`) 33 | .example('urls', `assembly solenopsis invicta | json genomic.fna`) 34 | .command( 35 | 'download [term]', 36 | `Takes either sra or assembly db name and query term. Downloads the corresponding \ 37 | SRA or assembly (genomic.fna) file into a folder named after the unique ID (UID).` 38 | ) 39 | .example('download', `assembly solenopsis invicta --pretty`) 40 | .command( 41 | 'link [srcUID]', 42 | `Returns a unique ID (UID) from a destination database linked to another UID \ 43 | from a source database.` 44 | ) 45 | .example('link', `assembly bioproject 244018 --pretty`) 46 | .command( 47 | 'expand [destProperty]', 48 | `Takes a property (e.g. biosample) and an optional destination property 49 | (e.g. sample) and looks for a field named property+id (e.g. biosampleid) 50 | in the Streamed object. Then it will do a ncbi.search for that id and save the 51 | result under Streamed object.property.` 52 | ) 53 | .example('expand', 54 | `bionode-ncbi search genome 'solenopsis invicta' -l 1 | \\ 55 | bionode-ncbi expand tax -s --pretty` 56 | ) 57 | .command( 58 | 'plink ', 59 | `Similar to Link but takes the srcUID from a property of the Streamed object 60 | and attaches the result to a property with the name of the destination DB.` 61 | ) 62 | .example('plink', 63 | `bionode-ncbi search genome 'solenopsis invicta' -l 1 | \\ 64 | bionode-ncbi expand tax -s | \\ 65 | bionode-ncbi plink tax sra -s --pretty` 66 | ) 67 | .alias('stdin', 's') 68 | .boolean('stdin') 69 | .describe('stdin', 'Read STDIN') 70 | .alias('limit', 'l') 71 | .number('limit') 72 | .describe('limit', 'Limit number of results') 73 | .alias('throughput', 't') 74 | .number('throughput') 75 | .describe('throughput', 'Number of items per API request') 76 | .alias('pretty', 'p') 77 | .boolean('pretty') 78 | .describe('pretty', 'Print human readable output instead of NDJSON') 79 | .choices('dlsource', ['assembly', 'sra']) 80 | .choices('db', Object.keys(validDbs.dbs)) 81 | .example('databases available', validDbs.printDbs()) 82 | .example(`DEBUG mode: export DEBUG='*'`) 83 | .argv 84 | 85 | if (argv.dlsource) { argv.db = argv.dlsource } 86 | 87 | insight.track('ncbi', 'cli') 88 | 89 | try { 90 | var ncbiStream = ncbi[argv._[0]](argv) 91 | 92 | var jsonStream 93 | if (argv.pretty) { 94 | jsonStream = JSONStream.stringify(false, null, null, 2) 95 | } else { 96 | jsonStream = JSONStream.stringify(false) 97 | } 98 | 99 | ncbiStream.pipe(jsonStream).pipe(process.stdout) 100 | 101 | if (argv.stdin) { 102 | insight.track('ncbi', 'stdin') 103 | process.stdin.setEncoding('utf8') 104 | 105 | process.stdin 106 | .pipe(split()) 107 | .pipe(JSONStream.parse()) 108 | .pipe(ncbiStream) 109 | 110 | process.stdin.on('end', function () { 111 | ncbiStream.end() 112 | }) 113 | } 114 | 115 | process.stdout.on('error', function (err) { 116 | if (err.code === 'EPIPE') { process.exit(0) } 117 | }) 118 | 119 | ncbiStream.on('error', function (error) { 120 | console.error(error.message) 121 | process.exit() 122 | }) 123 | } catch (err) { 124 | if (err instanceof validDbs.InvalidDbError) { 125 | console.error(err.message) 126 | console.log('Run "bionode-ncbi --help" to check the available dbs') 127 | } else { 128 | console.error(err) 129 | } 130 | } 131 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to Bionode 2 | 3 | Thank you for your interest in contributing to Bionode :tada:! 4 | 5 | Bionode is an Open Source community that aims at building highly reusable code and tools for bioinformatics by leveraging the Node.JS ecosystem. We use Node.JS Streams to process big genomic data. 6 | 7 | We welcome all kinds of contributions at all levels of experience, either code, knowledge, questions or suggestions. Many of our goals and GitHub issues do not require biology knowledge (e.g. very technical, coding) and some don't even require JavaScript knowledge (e.g. events, community, documentation). 8 | 9 | This document has a set of guidelines for contributing to Bionode on GitHub. These are guidelines, not rules. This guide is meant to make it easier for you to get involved. 10 | 11 | * [Participation guidelines](#participation-guidelines) 12 | * [What we're working on](#what-were-working-on) 13 | * [How to submit changes](#how-to-submit-changes) 14 | * [How to report bugs](#how-to-report-bugs) 15 | * [Communication channels](#communication-channels) 16 | 17 | ## Participation guidelines 18 | 19 | This project adheres to a [code of conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [mail@bionode.io](mailto:mail@bionode.io). 20 | 21 | ## What we're working on 22 | 23 | Take a look at the GitHub issues in our organisation wide project board at [project.bionode.io](http://project.bionode.io). Here's what each column means: 24 | * **Backlog** All the issues we have open (sorted by most recent). You'll find a lot in here and maybe something you could help us with. 25 | * **Next** What we want to work on next! Picking something to solve here would be greatly appreciated!! 26 | * **In Progress** Things we are currently working on, come help us! The person assigned to each issue is the one in charge and who you can ask any question. 27 | * **Done** Solved issues (sorted by closed date). Here you can check what we've been up to in the past. 28 | 29 | If you want to have a view of where all of this is going in the long run, check out our [Roadmap issue](https://github.com/bionode/bionode/issues/35), where we discuss our vision. 30 | 31 | ## How to submit changes 32 | 33 | Each bionode tool and library has its own repository (like a folder). 34 | Once you've identified one of the issues above that you feel you can contribute to, you're ready to make a change to the repository of that issue! However, it's always a good idea to [talk to us first](#communication-channels). Specially if you intend to take on something big, just to make sure we're on the same track. :wink: 35 | 36 | 1. **[Fork](https://help.github.com/articles/fork-a-repo/) the repository** that the issue belongs to. This makes your own version of the tool/library that you can edit and use. If you were invited to the [Bionode organisation](https://github.com/orgs/bionode/people) on GitHub, you can just `git clone` the repo and use a `git branch` instead of `forking`. 37 | 2. **[Make your changes](https://guides.github.com/activities/forking/#making-changes)**! You can do this in the GitHub interface on your own local machine. Once you're happy with your changes... 38 | 3. **Submit a [pull request](https://help.github.com/articles/proposing-changes-to-a-project-with-pull-requests/)**. This opens a discussion around your project and lets the project lead know you are proposing changes. 39 | 40 | First time contributing to open source? Check out this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github). 41 | 42 | ## How to report bugs 43 | 44 | Any general Bionode bug or question should be reported on the issue tracker of [bionode/bionode](https://github.com/bionode/bionode/issues). Anything that is specific to one of the tools, e.g. `bionode-ncbi`, should be reported under [that tool issue tracker](https://github.com/bionode/bionode-ncbi). 45 | 46 | ## Communication channels 47 | 48 | Don't be shy! Come talk to us :smiley: 49 | 50 | * **Email** [mail@bionode.io](mailto:mail@bionode.io) 51 | * **Chat room** [http://gitter.im/bionode/bionode](http://gitter.im/bionode/bionode) 52 | * **IRC** #bionode on Freenode 53 | * **Twitter** [@bionode](http://twitter.com/@bionode) 54 | 55 | ## Node.JS specific commands 56 | If you're new to Node.JS we highly recommend checking the [NodeSchool workshop](https://nodeschool.io/#workshopper-list) that you can install and run in your command line. Example: 57 | 58 | ```bash 59 | npm install -g learnyounode 60 | learnyounode 61 | ``` 62 | 63 | To install a local version of a bionode tool that you are modifying (e.g. bionode-ncbi): 64 | 65 | ```bash 66 | git clone git@github.com:bionode/bionode-ncbi.git 67 | cd bionode-ncbi 68 | npm install # Install all dependencies defined in the package.json file 69 | npm link # Setup bionode-ncbi in your PATH to point to this local version 70 | ``` 71 | 72 | You can now modify the code in the `bionode-ncbi` folder and test the effect of those changes when you run the `bionode-ncbi` command in your terminal. 73 | 74 | To run a bionode tool suite of tests and check their code coverage, you can do: 75 | 76 | ```bash 77 | npm test 78 | npm run coverage 79 | ``` 80 | 81 | To rebuild and minify a bionode module for the browser (if supported) do: 82 | 83 | ```bash 84 | npm run build-browser 85 | ``` 86 | 87 | To rebuild the documentation using the comments in the code do: 88 | 89 | ```sh 90 | npm run build-docs 91 | ``` 92 | 93 | # Style guide 94 | We currently recommend using the [JavaScript Standard Style](https://github.com/feross/standard) to check your code. You can run it in the folder you're working (see below) and install it as an extension for your text editor (e.g. [Atom](https://atom.io/packages/linter-js-standard) or [Visual Studio Code](https://marketplace.visualstudio.com/items?itemName=chenxsan.vscode-standardjs)). 95 | 96 | ```bash 97 | npm install -g standard 98 | standard 99 | ``` 100 | 101 | # Testing 102 | We use [tape](https://github.com/substack/tape) with [tape-nock](https://github.com/Flet/tape-nock) for testing. Code coverage is checked with [istanbul](https://github.com/gotwarlost/istanbul). 103 | -------------------------------------------------------------------------------- /test/bionode-ncbi.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs') 2 | var crypto = require('crypto') 3 | var tape = require('tape') 4 | var tapeNock = require('tape-nock') 5 | var test = tapeNock(tape) 6 | var nock = test.nock 7 | 8 | var ncbi = require('../') 9 | 10 | var testData = require('./data') 11 | var guillardiaThetaSRAData = require('./guillardia-theta.sra') 12 | var efetchTestData = require('./p53-nucest') 13 | 14 | test('Download list for assembly', function (t) { 15 | var msg = 'should take a database name (assembly) and search term (Guillardia theta), and list datasets URLs' 16 | var db = 'assembly' 17 | var expResult = [testData.assembly['guillardia-theta'].urls] 18 | var results = [] 19 | var stream = ncbi.urls(db, 'Guillardia theta') 20 | stream.on('data', function (data) { results.push(data) }) 21 | stream.on('end', function () { 22 | t.deepEqual(results, expResult, msg) 23 | setTimeout(t.end, 2000) 24 | }) 25 | }) 26 | 27 | test('Download list for sra', function (t) { 28 | var msg = 'should take a database name (sra) and search term (Guillardia theta), and list datasets URLs' 29 | var db = 'sra' 30 | var expResult = testData.sra['guillardia-theta'].urls 31 | var results = [] 32 | var stream = ncbi.urls(db, 'Guillardia theta') 33 | stream.on('data', function (data) { results.push(data) }) 34 | stream.on('end', function () { 35 | t.deepEqual(results, expResult, msg) 36 | setTimeout(t.end, 2000) 37 | }) 38 | }) 39 | 40 | test('Download', function (t) { 41 | var msg = 'should take a database name and search term, and download' 42 | var path = '' 43 | var stream = ncbi.download('assembly', 'ASM1036v1') 44 | stream.on('data', function (data) { path = data.path }) 45 | stream.on('end', function () { 46 | var file = fs.createReadStream(path) 47 | var shasum = crypto.createHash('sha1') 48 | file.on('data', function (d) { shasum.update(d) }) 49 | file.on('end', function () { 50 | var sha1 = shasum.digest('hex') 51 | var hash = testData['sra-sha1'] 52 | t.equal(sha1, hash, msg) 53 | setTimeout(t.end, 2000) 54 | }) 55 | }) 56 | }) 57 | 58 | test('Download unless file exists', function (t) { 59 | var msg = 'repeat same download to cover already downloaded branch' 60 | var path = '' 61 | var stream = ncbi.download('assembly', 'ASM1036v1') 62 | stream.on('data', function (data) { path = data.path }) 63 | stream.on('end', function () { 64 | var file = fs.createReadStream(path) 65 | var shasum = crypto.createHash('sha1') 66 | file.on('data', function (d) { shasum.update(d) }) 67 | file.on('end', function () { 68 | var sha1 = shasum.digest('hex') 69 | var hash = testData['sra-sha1'] 70 | t.equal(sha1, hash, msg) 71 | setTimeout(t.end, 2000) 72 | }) 73 | }) 74 | }) 75 | 76 | test('Search assembly', function (t) { 77 | var results1 = [] 78 | var stream = ncbi.search('assembly', 'Guillardia theta') 79 | stream.on('data', function (data) { results1.push(data) }) 80 | stream.on('end', function (data) { 81 | var msg = 'should take a database name and search term, and return the data' 82 | t.deepEqual(results1[0], testData.assembly['guillardia-theta'].search, msg) 83 | setTimeout(t.end, 2000) 84 | }) 85 | }) 86 | 87 | test('Search sra', function (t) { 88 | var results2 = [] 89 | var stream = ncbi.search('sra', 'Guillardia theta') 90 | stream.on('data', function (data) { results2.push(data) }) 91 | stream.on('end', function () { 92 | var msg = 'same as previous but searching sra instead of assembly' 93 | t.deepEqual(results2, guillardiaThetaSRAData, msg) 94 | setTimeout(t.end, 2000) 95 | }) 96 | }) 97 | 98 | test('Search sra with limit to one', function (t) { 99 | var results3 = [] 100 | var stream = ncbi.search({ db: 'sra', term: 'Guillardia theta', limit: 1 }) 101 | stream.on('data', function (data) { 102 | results3.push(data) 103 | }) 104 | stream.on('end', function () { 105 | var msg = 'same as previous but with a limit of 1' 106 | guillardiaThetaSRAData.forEach(findMatchAndTest) 107 | function findMatchAndTest (sradata) { 108 | if (sradata.uid === results3[0].uid) { 109 | t.deepEqual(results3, [sradata], msg) 110 | setTimeout(t.end, 2000) 111 | } 112 | } 113 | }) 114 | }) 115 | 116 | test('Link sra to bioproject', function (t) { 117 | var results = [] 118 | var stream = ncbi.link('sra', 'bioproject', '35533') 119 | stream.on('data', function (data) { results.push(data) }) 120 | stream.on('end', function () { 121 | var msg = 'should take names for source database, destination database and a NCBI UID, and return the link' 122 | t.deepEqual(results, testData.link['sra-bioproject']['35533'], msg) 123 | setTimeout(t.end, 2000) 124 | }) 125 | }) 126 | 127 | test('Link bioproject to assembly', function (t) { 128 | var results = [] 129 | var stream = ncbi.link('bioproject', 'assembly', '53577') 130 | stream.on('data', function (data) { results.push(data) }) 131 | stream.on('end', function () { 132 | var msg = 'same as previous, but doing bioproject->assembly instead of sra->assembly to try get same assembly UID as Search' 133 | t.deepEqual(results[0].destUIDs[0], testData.assembly['guillardia-theta'].search.uid, msg) 134 | setTimeout(t.end, 2000) 135 | }) 136 | }) 137 | 138 | test('Fetch', function (t) { 139 | var results = [] 140 | var stream = ncbi.fetch('nucest', 'p53') 141 | stream.on('data', function (data) { results.push(data) }) 142 | stream.on('end', function () { 143 | var msg = 'Should retrieve the FASTA sequence from the nucest database that match the search term \'p53\'' 144 | t.deepEqual(results, efetchTestData, msg) 145 | setTimeout(t.end, 2000) 146 | }) 147 | }) 148 | 149 | test('Error Handling', function (t) { 150 | var base = 'http://eutils.ncbi.nlm.nih.gov' 151 | var path = '/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia_theta&usehistory=y' 152 | var results = [] 153 | var msg = 'Should detect invalid return object and throw an error stating so, showing request URL' 154 | 155 | nock(base) 156 | .get(path) 157 | .reply(200, {esearchresult: {webenv: 'Fake Results'}}) 158 | 159 | var stream = ncbi.search('assembly', 'Guillardia_theta') 160 | stream.on('data', function (data) { results.push(data) }) 161 | stream.on('error', function (err) { 162 | t.equal(err.message, testData.error.message, msg) 163 | }) 164 | stream.on('end', function () { 165 | t.fail(msg) 166 | }) 167 | setTimeout(t.end, 2000) 168 | }) 169 | -------------------------------------------------------------------------------- /docs/public/stylesheets/normalize.css: -------------------------------------------------------------------------------- 1 | /*! normalize.css v2.0.1 | MIT License | git.io/normalize */ 2 | 3 | /* ========================================================================== 4 | HTML5 display definitions 5 | ========================================================================== */ 6 | 7 | /* 8 | * Corrects `block` display not defined in IE 8/9. 9 | */ 10 | 11 | article, 12 | aside, 13 | details, 14 | figcaption, 15 | figure, 16 | footer, 17 | header, 18 | hgroup, 19 | nav, 20 | section, 21 | summary { 22 | display: block; 23 | } 24 | 25 | /* 26 | * Corrects `inline-block` display not defined in IE 8/9. 27 | */ 28 | 29 | audio, 30 | canvas, 31 | video { 32 | display: inline-block; 33 | } 34 | 35 | /* 36 | * Prevents modern browsers from displaying `audio` without controls. 37 | * Remove excess height in iOS 5 devices. 38 | */ 39 | 40 | audio:not([controls]) { 41 | display: none; 42 | height: 0; 43 | } 44 | 45 | /* 46 | * Addresses styling for `hidden` attribute not present in IE 8/9. 47 | */ 48 | 49 | [hidden] { 50 | display: none; 51 | } 52 | 53 | /* ========================================================================== 54 | Base 55 | ========================================================================== */ 56 | 57 | /* 58 | * 1. Sets default font family to sans-serif. 59 | * 2. Prevents iOS text size adjust after orientation change, without disabling 60 | * user zoom. 61 | */ 62 | 63 | html { 64 | font-family: sans-serif; /* 1 */ 65 | -webkit-text-size-adjust: 100%; /* 2 */ 66 | -ms-text-size-adjust: 100%; /* 2 */ 67 | } 68 | 69 | /* 70 | * Removes default margin. 71 | */ 72 | 73 | body { 74 | margin: 0; 75 | } 76 | 77 | /* ========================================================================== 78 | Links 79 | ========================================================================== */ 80 | 81 | /* 82 | * Addresses `outline` inconsistency between Chrome and other browsers. 83 | */ 84 | 85 | a:focus { 86 | outline: thin dotted; 87 | } 88 | 89 | /* 90 | * Improves readability when focused and also mouse hovered in all browsers. 91 | */ 92 | 93 | a:active, 94 | a:hover { 95 | outline: 0; 96 | } 97 | 98 | /* ========================================================================== 99 | Typography 100 | ========================================================================== */ 101 | 102 | /* 103 | * Addresses `h1` font sizes within `section` and `article` in Firefox 4+, 104 | * Safari 5, and Chrome. 105 | */ 106 | 107 | h1 { 108 | font-size: 2em; 109 | } 110 | 111 | /* 112 | * Addresses styling not present in IE 8/9, Safari 5, and Chrome. 113 | */ 114 | 115 | abbr[title] { 116 | border-bottom: 1px dotted; 117 | } 118 | 119 | /* 120 | * Addresses style set to `bolder` in Firefox 4+, Safari 5, and Chrome. 121 | */ 122 | 123 | b, 124 | strong { 125 | font-weight: bold; 126 | } 127 | 128 | /* 129 | * Addresses styling not present in Safari 5 and Chrome. 130 | */ 131 | 132 | dfn { 133 | font-style: italic; 134 | } 135 | 136 | /* 137 | * Addresses styling not present in IE 8/9. 138 | */ 139 | 140 | mark { 141 | background: #ff0; 142 | color: #000; 143 | } 144 | 145 | 146 | /* 147 | * Corrects font family set oddly in Safari 5 and Chrome. 148 | */ 149 | 150 | code, 151 | kbd, 152 | pre, 153 | samp { 154 | font-family: monospace, serif; 155 | font-size: 1em; 156 | } 157 | 158 | /* 159 | * Improves readability of pre-formatted text in all browsers. 160 | */ 161 | 162 | pre { 163 | white-space: pre; 164 | white-space: pre-wrap; 165 | word-wrap: break-word; 166 | } 167 | 168 | /* 169 | * Sets consistent quote types. 170 | */ 171 | 172 | q { 173 | quotes: "\201C" "\201D" "\2018" "\2019"; 174 | } 175 | 176 | /* 177 | * Addresses inconsistent and variable font size in all browsers. 178 | */ 179 | 180 | small { 181 | font-size: 80%; 182 | } 183 | 184 | /* 185 | * Prevents `sub` and `sup` affecting `line-height` in all browsers. 186 | */ 187 | 188 | sub, 189 | sup { 190 | font-size: 75%; 191 | line-height: 0; 192 | position: relative; 193 | vertical-align: baseline; 194 | } 195 | 196 | sup { 197 | top: -0.5em; 198 | } 199 | 200 | sub { 201 | bottom: -0.25em; 202 | } 203 | 204 | /* ========================================================================== 205 | Embedded content 206 | ========================================================================== */ 207 | 208 | /* 209 | * Removes border when inside `a` element in IE 8/9. 210 | */ 211 | 212 | img { 213 | border: 0; 214 | } 215 | 216 | /* 217 | * Corrects overflow displayed oddly in IE 9. 218 | */ 219 | 220 | svg:not(:root) { 221 | overflow: hidden; 222 | } 223 | 224 | /* ========================================================================== 225 | Figures 226 | ========================================================================== */ 227 | 228 | /* 229 | * Addresses margin not present in IE 8/9 and Safari 5. 230 | */ 231 | 232 | figure { 233 | margin: 0; 234 | } 235 | 236 | /* ========================================================================== 237 | Forms 238 | ========================================================================== */ 239 | 240 | /* 241 | * Define consistent border, margin, and padding. 242 | */ 243 | 244 | fieldset { 245 | border: 1px solid #c0c0c0; 246 | margin: 0 2px; 247 | padding: 0.35em 0.625em 0.75em; 248 | } 249 | 250 | /* 251 | * 1. Corrects color not being inherited in IE 8/9. 252 | * 2. Remove padding so people aren't caught out if they zero out fieldsets. 253 | */ 254 | 255 | legend { 256 | border: 0; /* 1 */ 257 | padding: 0; /* 2 */ 258 | } 259 | 260 | /* 261 | * 1. Corrects font family not being inherited in all browsers. 262 | * 2. Corrects font size not being inherited in all browsers. 263 | * 3. Addresses margins set differently in Firefox 4+, Safari 5, and Chrome 264 | */ 265 | 266 | button, 267 | input, 268 | select, 269 | textarea { 270 | font-family: inherit; /* 1 */ 271 | font-size: 100%; /* 2 */ 272 | margin: 0; /* 3 */ 273 | } 274 | 275 | /* 276 | * Addresses Firefox 4+ setting `line-height` on `input` using `!important` in 277 | * the UA stylesheet. 278 | */ 279 | 280 | button, 281 | input { 282 | line-height: normal; 283 | } 284 | 285 | /* 286 | * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio` 287 | * and `video` controls. 288 | * 2. Corrects inability to style clickable `input` types in iOS. 289 | * 3. Improves usability and consistency of cursor style between image-type 290 | * `input` and others. 291 | */ 292 | 293 | button, 294 | html input[type="button"], /* 1 */ 295 | input[type="reset"], 296 | input[type="submit"] { 297 | -webkit-appearance: button; /* 2 */ 298 | cursor: pointer; /* 3 */ 299 | } 300 | 301 | /* 302 | * Re-set default cursor for disabled elements. 303 | */ 304 | 305 | button[disabled], 306 | input[disabled] { 307 | cursor: default; 308 | } 309 | 310 | /* 311 | * 1. Addresses box sizing set to `content-box` in IE 8/9. 312 | * 2. Removes excess padding in IE 8/9. 313 | */ 314 | 315 | input[type="checkbox"], 316 | input[type="radio"] { 317 | box-sizing: border-box; /* 1 */ 318 | padding: 0; /* 2 */ 319 | } 320 | 321 | /* 322 | * 1. Addresses `appearance` set to `searchfield` in Safari 5 and Chrome. 323 | * 2. Addresses `box-sizing` set to `border-box` in Safari 5 and Chrome 324 | * (include `-moz` to future-proof). 325 | */ 326 | 327 | input[type="search"] { 328 | -webkit-appearance: textfield; /* 1 */ 329 | -moz-box-sizing: content-box; 330 | -webkit-box-sizing: content-box; /* 2 */ 331 | box-sizing: content-box; 332 | } 333 | 334 | /* 335 | * Removes inner padding and search cancel button in Safari 5 and Chrome 336 | * on OS X. 337 | */ 338 | 339 | input[type="search"]::-webkit-search-cancel-button, 340 | input[type="search"]::-webkit-search-decoration { 341 | -webkit-appearance: none; 342 | } 343 | 344 | /* 345 | * Removes inner padding and border in Firefox 4+. 346 | */ 347 | 348 | button::-moz-focus-inner, 349 | input::-moz-focus-inner { 350 | border: 0; 351 | padding: 0; 352 | } 353 | 354 | /* 355 | * 1. Removes default vertical scrollbar in IE 8/9. 356 | * 2. Improves readability and alignment in all browsers. 357 | */ 358 | 359 | textarea { 360 | overflow: auto; /* 1 */ 361 | vertical-align: top; /* 2 */ 362 | } 363 | 364 | /* ========================================================================== 365 | Tables 366 | ========================================================================== */ 367 | 368 | /* 369 | * Remove most spacing between table cells. 370 | */ 371 | 372 | table { 373 | border-collapse: collapse; 374 | border-spacing: 0; 375 | } -------------------------------------------------------------------------------- /docs/docco.css: -------------------------------------------------------------------------------- 1 | /*--------------------- Typography ----------------------------*/ 2 | 3 | @font-face { 4 | font-family: 'aller-light'; 5 | src: url('public/fonts/aller-light.eot'); 6 | src: url('public/fonts/aller-light.eot?#iefix') format('embedded-opentype'), 7 | url('public/fonts/aller-light.woff') format('woff'), 8 | url('public/fonts/aller-light.ttf') format('truetype'); 9 | font-weight: normal; 10 | font-style: normal; 11 | } 12 | 13 | @font-face { 14 | font-family: 'aller-bold'; 15 | src: url('public/fonts/aller-bold.eot'); 16 | src: url('public/fonts/aller-bold.eot?#iefix') format('embedded-opentype'), 17 | url('public/fonts/aller-bold.woff') format('woff'), 18 | url('public/fonts/aller-bold.ttf') format('truetype'); 19 | font-weight: normal; 20 | font-style: normal; 21 | } 22 | 23 | @font-face { 24 | font-family: 'roboto-black'; 25 | src: url('public/fonts/roboto-black.eot'); 26 | src: url('public/fonts/roboto-black.eot?#iefix') format('embedded-opentype'), 27 | url('public/fonts/roboto-black.woff') format('woff'), 28 | url('public/fonts/roboto-black.ttf') format('truetype'); 29 | font-weight: normal; 30 | font-style: normal; 31 | } 32 | 33 | /*--------------------- Layout ----------------------------*/ 34 | html { height: 100%; } 35 | body { 36 | font-family: "aller-light"; 37 | font-size: 14px; 38 | line-height: 18px; 39 | color: #30404f; 40 | margin: 0; padding: 0; 41 | height:100%; 42 | } 43 | #container { min-height: 100%; } 44 | 45 | a { 46 | color: #000; 47 | } 48 | 49 | b, strong { 50 | font-weight: normal; 51 | font-family: "aller-bold"; 52 | } 53 | 54 | p { 55 | margin: 15px 0 0px; 56 | } 57 | .annotation ul, .annotation ol { 58 | margin: 25px 0; 59 | } 60 | .annotation ul li, .annotation ol li { 61 | font-size: 14px; 62 | line-height: 18px; 63 | margin: 10px 0; 64 | } 65 | 66 | h1, h2, h3, h4, h5, h6 { 67 | color: #112233; 68 | line-height: 1em; 69 | font-weight: normal; 70 | font-family: "roboto-black"; 71 | text-transform: uppercase; 72 | margin: 30px 0 15px 0; 73 | } 74 | 75 | h1 { 76 | margin-top: 40px; 77 | } 78 | h2 { 79 | font-size: 1.26em; 80 | } 81 | 82 | hr { 83 | border: 0; 84 | background: 1px #ddd; 85 | height: 1px; 86 | margin: 20px 0; 87 | } 88 | 89 | pre, tt, code { 90 | font-size: 12px; line-height: 16px; 91 | font-family: Menlo, Monaco, Consolas, "Lucida Console", monospace; 92 | margin: 0; padding: 0; 93 | } 94 | .annotation pre { 95 | display: block; 96 | margin: 0; 97 | padding: 7px 10px; 98 | background: #fcfcfc; 99 | -moz-box-shadow: inset 0 0 10px rgba(0,0,0,0.1); 100 | -webkit-box-shadow: inset 0 0 10px rgba(0,0,0,0.1); 101 | box-shadow: inset 0 0 10px rgba(0,0,0,0.1); 102 | overflow-x: auto; 103 | } 104 | .annotation pre code { 105 | border: 0; 106 | padding: 0; 107 | background: transparent; 108 | } 109 | 110 | 111 | blockquote { 112 | border-left: 5px solid #ccc; 113 | margin: 0; 114 | padding: 1px 0 1px 1em; 115 | } 116 | .sections blockquote p { 117 | font-family: Menlo, Consolas, Monaco, monospace; 118 | font-size: 12px; line-height: 16px; 119 | color: #999; 120 | margin: 10px 0 0; 121 | white-space: pre-wrap; 122 | } 123 | 124 | ul.sections { 125 | list-style: none; 126 | padding:0 0 5px 0;; 127 | margin:0; 128 | } 129 | 130 | /* 131 | Force border-box so that % widths fit the parent 132 | container without overlap because of margin/padding. 133 | 134 | More Info : http://www.quirksmode.org/css/box.html 135 | */ 136 | ul.sections > li > div { 137 | -moz-box-sizing: border-box; /* firefox */ 138 | -ms-box-sizing: border-box; /* ie */ 139 | -webkit-box-sizing: border-box; /* webkit */ 140 | -khtml-box-sizing: border-box; /* konqueror */ 141 | box-sizing: border-box; /* css3 */ 142 | } 143 | 144 | 145 | /*---------------------- Jump Page -----------------------------*/ 146 | #jump_to, #jump_page { 147 | margin: 0; 148 | background: white; 149 | -webkit-box-shadow: 0 0 25px #777; -moz-box-shadow: 0 0 25px #777; 150 | -webkit-border-bottom-left-radius: 5px; -moz-border-radius-bottomleft: 5px; 151 | font: 16px Arial; 152 | cursor: pointer; 153 | text-align: right; 154 | list-style: none; 155 | } 156 | 157 | #jump_to a { 158 | text-decoration: none; 159 | } 160 | 161 | #jump_to a.large { 162 | display: none; 163 | } 164 | #jump_to a.small { 165 | font-size: 22px; 166 | font-weight: bold; 167 | color: #676767; 168 | } 169 | 170 | #jump_to, #jump_wrapper { 171 | position: fixed; 172 | right: 0; top: 0; 173 | padding: 10px 15px; 174 | margin:0; 175 | } 176 | 177 | #jump_wrapper { 178 | display: none; 179 | padding:0; 180 | } 181 | 182 | #jump_to:hover #jump_wrapper { 183 | display: block; 184 | } 185 | 186 | #jump_page_wrapper{ 187 | position: fixed; 188 | right: 0; 189 | top: 0; 190 | bottom: 0; 191 | } 192 | 193 | #jump_page { 194 | padding: 5px 0 3px; 195 | margin: 0 0 25px 25px; 196 | max-height: 100%; 197 | overflow: auto; 198 | } 199 | 200 | #jump_page .source { 201 | display: block; 202 | padding: 15px; 203 | text-decoration: none; 204 | border-top: 1px solid #eee; 205 | } 206 | 207 | #jump_page .source:hover { 208 | background: #f5f5ff; 209 | } 210 | 211 | #jump_page .source:first-child { 212 | } 213 | 214 | /*---------------------- Low resolutions (> 320px) ---------------------*/ 215 | @media only screen and (min-width: 320px) { 216 | .pilwrap { display: none; } 217 | 218 | ul.sections > li > div { 219 | display: block; 220 | padding:5px 10px 0 10px; 221 | } 222 | 223 | ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol { 224 | padding-left: 30px; 225 | } 226 | 227 | ul.sections > li > div.content { 228 | overflow-x:auto; 229 | -webkit-box-shadow: inset 0 0 5px #e5e5ee; 230 | box-shadow: inset 0 0 5px #e5e5ee; 231 | border: 1px solid #dedede; 232 | margin:5px 10px 5px 10px; 233 | padding-bottom: 5px; 234 | } 235 | 236 | ul.sections > li > div.annotation pre { 237 | margin: 7px 0 7px; 238 | padding-left: 15px; 239 | } 240 | 241 | ul.sections > li > div.annotation p tt, .annotation code { 242 | background: #f8f8ff; 243 | border: 1px solid #dedede; 244 | font-size: 12px; 245 | padding: 0 0.2em; 246 | } 247 | } 248 | 249 | /*---------------------- (> 481px) ---------------------*/ 250 | @media only screen and (min-width: 481px) { 251 | #container { 252 | position: relative; 253 | } 254 | body { 255 | background-color: #F5F5FF; 256 | font-size: 15px; 257 | line-height: 21px; 258 | } 259 | pre, tt, code { 260 | line-height: 18px; 261 | } 262 | p, ul, ol { 263 | margin: 0 0 15px; 264 | } 265 | 266 | 267 | #jump_to { 268 | padding: 5px 10px; 269 | } 270 | #jump_wrapper { 271 | padding: 0; 272 | } 273 | #jump_to, #jump_page { 274 | font: 10px Arial; 275 | text-transform: uppercase; 276 | } 277 | #jump_page .source { 278 | padding: 5px 10px; 279 | } 280 | #jump_to a.large { 281 | display: inline-block; 282 | } 283 | #jump_to a.small { 284 | display: none; 285 | } 286 | 287 | 288 | 289 | #background { 290 | position: absolute; 291 | top: 0; bottom: 0; 292 | width: 350px; 293 | background: #fff; 294 | border-right: 1px solid #e5e5ee; 295 | z-index: -1; 296 | } 297 | 298 | ul.sections > li > div.annotation ul, ul.sections > li > div.annotation ol { 299 | padding-left: 40px; 300 | } 301 | 302 | ul.sections > li { 303 | white-space: nowrap; 304 | } 305 | 306 | ul.sections > li > div { 307 | display: inline-block; 308 | } 309 | 310 | ul.sections > li > div.annotation { 311 | max-width: 350px; 312 | min-width: 350px; 313 | min-height: 5px; 314 | padding: 13px; 315 | overflow-x: hidden; 316 | white-space: normal; 317 | vertical-align: top; 318 | text-align: left; 319 | } 320 | ul.sections > li > div.annotation pre { 321 | margin: 15px 0 15px; 322 | padding-left: 15px; 323 | } 324 | 325 | ul.sections > li > div.content { 326 | padding: 13px; 327 | vertical-align: top; 328 | border: none; 329 | -webkit-box-shadow: none; 330 | box-shadow: none; 331 | } 332 | 333 | .pilwrap { 334 | position: relative; 335 | display: inline; 336 | } 337 | 338 | .pilcrow { 339 | font: 12px Arial; 340 | text-decoration: none; 341 | color: #454545; 342 | position: absolute; 343 | top: 3px; left: -20px; 344 | padding: 1px 2px; 345 | opacity: 0; 346 | -webkit-transition: opacity 0.2s linear; 347 | } 348 | .for-h1 .pilcrow { 349 | top: 47px; 350 | } 351 | .for-h2 .pilcrow, .for-h3 .pilcrow, .for-h4 .pilcrow { 352 | top: 35px; 353 | } 354 | 355 | ul.sections > li > div.annotation:hover .pilcrow { 356 | opacity: 1; 357 | } 358 | } 359 | 360 | /*---------------------- (> 1025px) ---------------------*/ 361 | @media only screen and (min-width: 1025px) { 362 | 363 | body { 364 | font-size: 16px; 365 | line-height: 24px; 366 | } 367 | 368 | #background { 369 | width: 525px; 370 | } 371 | ul.sections > li > div.annotation { 372 | max-width: 525px; 373 | min-width: 525px; 374 | padding: 10px 25px 1px 50px; 375 | } 376 | ul.sections > li > div.content { 377 | padding: 9px 15px 16px 25px; 378 | } 379 | } 380 | 381 | /*---------------------- Syntax Highlighting -----------------------------*/ 382 | 383 | td.linenos { background-color: #f0f0f0; padding-right: 10px; } 384 | span.lineno { background-color: #f0f0f0; padding: 0 5px 0 5px; } 385 | /* 386 | 387 | github.com style (c) Vasily Polovnyov 388 | 389 | */ 390 | 391 | pre code { 392 | display: block; padding: 0.5em; 393 | color: #000; 394 | background: #f8f8ff 395 | } 396 | 397 | pre .hljs-comment, 398 | pre .hljs-template_comment, 399 | pre .hljs-diff .hljs-header, 400 | pre .hljs-javadoc { 401 | color: #408080; 402 | font-style: italic 403 | } 404 | 405 | pre .hljs-keyword, 406 | pre .hljs-assignment, 407 | pre .hljs-literal, 408 | pre .hljs-css .hljs-rule .hljs-keyword, 409 | pre .hljs-winutils, 410 | pre .hljs-javascript .hljs-title, 411 | pre .hljs-lisp .hljs-title, 412 | pre .hljs-subst { 413 | color: #954121; 414 | /*font-weight: bold*/ 415 | } 416 | 417 | pre .hljs-number, 418 | pre .hljs-hexcolor { 419 | color: #40a070 420 | } 421 | 422 | pre .hljs-string, 423 | pre .hljs-tag .hljs-value, 424 | pre .hljs-phpdoc, 425 | pre .hljs-tex .hljs-formula { 426 | color: #219161; 427 | } 428 | 429 | pre .hljs-title, 430 | pre .hljs-id { 431 | color: #19469D; 432 | } 433 | pre .hljs-params { 434 | color: #00F; 435 | } 436 | 437 | pre .hljs-javascript .hljs-title, 438 | pre .hljs-lisp .hljs-title, 439 | pre .hljs-subst { 440 | font-weight: normal 441 | } 442 | 443 | pre .hljs-class .hljs-title, 444 | pre .hljs-haskell .hljs-label, 445 | pre .hljs-tex .hljs-command { 446 | color: #458; 447 | font-weight: bold 448 | } 449 | 450 | pre .hljs-tag, 451 | pre .hljs-tag .hljs-title, 452 | pre .hljs-rules .hljs-property, 453 | pre .hljs-django .hljs-tag .hljs-keyword { 454 | color: #000080; 455 | font-weight: normal 456 | } 457 | 458 | pre .hljs-attribute, 459 | pre .hljs-variable, 460 | pre .hljs-instancevar, 461 | pre .hljs-lisp .hljs-body { 462 | color: #008080 463 | } 464 | 465 | pre .hljs-regexp { 466 | color: #B68 467 | } 468 | 469 | pre .hljs-class { 470 | color: #458; 471 | font-weight: bold 472 | } 473 | 474 | pre .hljs-symbol, 475 | pre .hljs-ruby .hljs-symbol .hljs-string, 476 | pre .hljs-ruby .hljs-symbol .hljs-keyword, 477 | pre .hljs-ruby .hljs-symbol .hljs-keymethods, 478 | pre .hljs-lisp .hljs-keyword, 479 | pre .hljs-tex .hljs-special, 480 | pre .hljs-input_number { 481 | color: #990073 482 | } 483 | 484 | pre .hljs-builtin, 485 | pre .hljs-constructor, 486 | pre .hljs-built_in, 487 | pre .hljs-lisp .hljs-title { 488 | color: #0086b3 489 | } 490 | 491 | pre .hljs-preprocessor, 492 | pre .hljs-pi, 493 | pre .hljs-doctype, 494 | pre .hljs-shebang, 495 | pre .hljs-cdata { 496 | color: #999; 497 | font-weight: bold 498 | } 499 | 500 | pre .hljs-deletion { 501 | background: #fdd 502 | } 503 | 504 | pre .hljs-addition { 505 | background: #dfd 506 | } 507 | 508 | pre .hljs-diff .hljs-change { 509 | background: #0086b3 510 | } 511 | 512 | pre .hljs-chunk { 513 | color: #aaa 514 | } 515 | 516 | pre .hljs-tex .hljs-formula { 517 | opacity: 0.5; 518 | } 519 | -------------------------------------------------------------------------------- /test/data.json: -------------------------------------------------------------------------------- 1 | { 2 | "assembly": { 3 | "guillardia-theta": { 4 | "search":{ 5 | "uid": "503988", 6 | "rsuid": "1011608", 7 | "gbuid": "503988", 8 | "assemblyaccession": "GCF_000315625.1", 9 | "lastmajorreleaseaccession": "GCF_000315625.1", 10 | "chainid": "315625", 11 | "assemblyname": "Guith1", 12 | "ucscname": "", 13 | "ensemblname": "", 14 | "taxid": "905079", 15 | "organism": "Guillardia theta CCMP2712 (cryptomonads)", 16 | "speciestaxid": "55529", 17 | "speciesname": "Guillardia theta", 18 | "assemblytype": "haploid", 19 | "assemblyclass": "haploid", 20 | "assemblystatus": "Scaffold", 21 | "wgs": "AEIE01", 22 | "gb_bioprojects": [ 23 | { 24 | "bioprojectaccn": "PRJNA53577", 25 | "bioprojectid": 53577 26 | } 27 | ], 28 | "gb_projects": [ 29 | "53577" 30 | ], 31 | "rs_bioprojects": [ 32 | { 33 | "bioprojectaccn": "PRJNA223305", 34 | "bioprojectid": 223305 35 | } 36 | ], 37 | "rs_projects": [ 38 | "223305" 39 | ], 40 | "biosampleaccn": "SAMN00116900", 41 | "biosampleid": "116900", 42 | "biosource": { 43 | "infraspecieslist": [ 44 | { 45 | "sub_type": "strain", 46 | "sub_value": "CCMP2712" 47 | } 48 | ], 49 | "sex": "", 50 | "isolate": "" 51 | }, 52 | "coverage": "23.66", 53 | "partialgenomerepresentation": "false", 54 | "primary": "1011598", 55 | "assemblydescription": "", 56 | "releaselevel": "Major", 57 | "asmreleasedate_genbank": "2012/12/06 00:00", 58 | "asmreleasedate_refseq": "2014/04/22 00:00", 59 | "seqreleasedate": "2012/12/05 00:00", 60 | "asmupdatedate": "2014/04/22 00:00", 61 | "submissiondate": "2012/12/05 00:00", 62 | "lastupdatedate": "2014/04/22 00:00", 63 | "submitterorganization": "JGI", 64 | "refseq_category": "representative genome", 65 | "anomalouslist": [], 66 | "exclfromrefseq": [], 67 | "propertylist": [ 68 | "full-genome-representation", 69 | "latest", 70 | "latest_genbank", 71 | "latest_refseq", 72 | "representative", 73 | "wgs" 74 | ], 75 | "fromtype": "", 76 | "synonym": { 77 | "genbank": "GCA_000315625.1", 78 | "refseq": "GCF_000315625.1", 79 | "similarity": "identical" 80 | }, 81 | "ftppath_genbank": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/315/625/GCA_000315625.1_Guith1", 82 | "ftppath_refseq": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1", 83 | "ftppath_assembly_rpt": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_report.txt", 84 | "ftppath_stats_rpt": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_stats.txt", 85 | "ftppath_regions_rpt": "", 86 | "sortorder": "2C50003156259898", 87 | "meta": { 88 | "Stats": { 89 | "Stat": [ 90 | { 91 | "_": "0", 92 | "category": "alt_loci_count", 93 | "sequence_tag": "all" 94 | }, 95 | { 96 | "_": "0", 97 | "category": "chromosome_count", 98 | "sequence_tag": "all" 99 | }, 100 | { 101 | "_": "5126", 102 | "category": "contig_count", 103 | "sequence_tag": "all" 104 | }, 105 | { 106 | "_": "587", 107 | "category": "contig_l50", 108 | "sequence_tag": "all" 109 | }, 110 | { 111 | "_": "40445", 112 | "category": "contig_n50", 113 | "sequence_tag": "all" 114 | }, 115 | { 116 | "_": "0", 117 | "category": "non_chromosome_replicon_count", 118 | "sequence_tag": "all" 119 | }, 120 | { 121 | "_": "0", 122 | "category": "replicon_count", 123 | "sequence_tag": "all" 124 | }, 125 | { 126 | "_": "669", 127 | "category": "scaffold_count", 128 | "sequence_tag": "all" 129 | }, 130 | { 131 | "_": "0", 132 | "category": "scaffold_count", 133 | "sequence_tag": "placed" 134 | }, 135 | { 136 | "_": "0", 137 | "category": "scaffold_count", 138 | "sequence_tag": "unlocalized" 139 | }, 140 | { 141 | "_": "669", 142 | "category": "scaffold_count", 143 | "sequence_tag": "unplaced" 144 | }, 145 | { 146 | "_": "52", 147 | "category": "scaffold_l50", 148 | "sequence_tag": "all" 149 | }, 150 | { 151 | "_": "545808", 152 | "category": "scaffold_n50", 153 | "sequence_tag": "all" 154 | }, 155 | { 156 | "_": "87145349", 157 | "category": "total_length", 158 | "sequence_tag": "all" 159 | }, 160 | { 161 | "_": "83457412", 162 | "category": "ungapped_length", 163 | "sequence_tag": "all" 164 | } 165 | ] 166 | }, 167 | "FtpSites": { 168 | "FtpPath": [ 169 | { 170 | "_": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_report.txt", 171 | "type": "Assembly_rpt" 172 | }, 173 | { 174 | "_": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/315/625/GCA_000315625.1_Guith1", 175 | "type": "GenBank" 176 | }, 177 | { 178 | "_": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1", 179 | "type": "RefSeq" 180 | }, 181 | { 182 | "_": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_stats.txt", 183 | "type": "Stats_rpt" 184 | } 185 | ] 186 | }, 187 | "assembly-level": "2", 188 | "assembly-status": "Scaffold", 189 | "representative-status": "representative genome", 190 | "submitter-organization": "JGI" 191 | } 192 | }, 193 | "urls": { 194 | "uid": "503988", 195 | "assembly_structure": { 196 | "dir": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_structure/" 197 | }, 198 | "assembly_report": { 199 | "txt": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_report.txt" 200 | }, 201 | "assembly_stats": { 202 | "txt": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_stats.txt" 203 | }, 204 | "cds_from_genomic": { 205 | "fna": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_cds_from_genomic.fna.gz" 206 | }, 207 | "feature_table": { 208 | "txt": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_feature_table.txt.gz" 209 | }, 210 | "genomic": { 211 | "fna": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_genomic.fna.gz", 212 | "gbff": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_genomic.gbff.gz", 213 | "gff": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_genomic.gff.gz" 214 | }, 215 | "protein": { 216 | "faa": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_protein.faa.gz", 217 | "gpff": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_protein.gpff.gz" 218 | }, 219 | "rm": { 220 | "out": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_rm.out.gz", 221 | "run": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_rm.run" 222 | }, 223 | "rna": { 224 | "fna": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_rna.fna.gz", 225 | "gbff": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_rna.gbff.gz" 226 | }, 227 | "rna_from_genomic": { 228 | "fna": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_rna_from_genomic.fna.gz" 229 | }, 230 | "README": { 231 | "txt": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/README.txt" 232 | }, 233 | "annotation_hashes": { 234 | "txt": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/annotation_hashes.txt" 235 | }, 236 | "assembly_status": { 237 | "txt": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/assembly_status.txt" 238 | }, 239 | "md5checksums": { 240 | "txt": "http://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/md5checksums.txt" 241 | } 242 | } 243 | } 244 | }, 245 | "sra": { 246 | "guillardia-theta": { 247 | "urls": [ 248 | {"url":"http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR070/SRR070672/SRR070672.sra","uid":"35523"}, 249 | {"url":"http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR070/SRR070673/SRR070673.sra","uid":"35524"}, 250 | {"url":"http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR070/SRR070674/SRR070674.sra","uid":"35525"}, 251 | {"url":"http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR070/SRR070675/SRR070675.sra","uid":"35526"}, 252 | {"url":"http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR070/SRR070676/SRR070676.sra","uid":"35527"}, 253 | {"url":"http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR070/SRR070677/SRR070677.sra","uid":"35528"}, 254 | {"url":"http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR070/SRR070678/SRR070678.sra","uid":"35529"}, 255 | {"url":"http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR070/SRR070679/SRR070679.sra","uid":"35530"}, 256 | {"url":"http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR070/SRR070680/SRR070680.sra","uid":"35531"}, 257 | {"url":"http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR070/SRR070681/SRR070681.sra","uid":"35532"}, 258 | {"url":"http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR070/SRR070682/SRR070682.sra","uid":"35533"}, 259 | {"url":"http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR747/SRR747855/SRR747855.sra","uid":"333627"}, 260 | {"url":"http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/SRR/SRR129/SRR1294409/SRR1294409.sra","uid":"785981"} 261 | ] 262 | } 263 | }, 264 | "link": { 265 | "sra-bioproject": { 266 | "35533": [ 267 | { 268 | "srcDB" : "sra", 269 | "srcUID" : "35533", 270 | "destUIDs" : ["53577"], 271 | "destDB" : "bioproject" 272 | } 273 | ] 274 | }, 275 | "biproject-assembly": { 276 | "53577": [ 277 | { 278 | "srcDB" : "bioproject", 279 | "srcUID" : "53577", 280 | "destUIDs" : ["503988"], 281 | "destDB" : "assembly" 282 | } 283 | ] 284 | } 285 | }, 286 | "error" : { 287 | "message" : "NCBI returned invalid results, this could be a temporary issue with NCBI servers.\nRequest URL: http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia_theta&usehistory=y" 288 | }, 289 | "sra-sha1": "0b38d7bb2ee9cbfb575a07ff5e2c243a3f129d8d" 290 | } 291 | -------------------------------------------------------------------------------- /test/fixtures/Search sra with limit to one_.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 4 | "method": "GET", 5 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=sra&term=Guillardia%20theta&usehistory=y", 6 | "body": "", 7 | "status": 301, 8 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 9 | "rawHeaders": [ 10 | "Date", 11 | "Sat, 15 Apr 2017 08:53:19 GMT", 12 | "Server", 13 | "Apache", 14 | "Referrer-Policy", 15 | "origin-when-cross-origin", 16 | "Location", 17 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=sra&term=Guillardia%20theta&usehistory=y", 18 | "Content-Length", 19 | "356", 20 | "Connection", 21 | "close", 22 | "Content-Type", 23 | "text/html; charset=iso-8859-1" 24 | ] 25 | }, 26 | { 27 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 28 | "method": "GET", 29 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=sra&term=Guillardia%20theta&usehistory=y", 30 | "body": "", 31 | "status": 200, 32 | "response": { 33 | "header": { 34 | "type": "esearch", 35 | "version": "0.3" 36 | }, 37 | "esearchresult": { 38 | "count": "13", 39 | "retmax": "13", 40 | "retstart": "0", 41 | "querykey": "1", 42 | "webenv": "NCID_1_451000323_130.14.18.34_9001_1492246399_1590245674_0MetA0_S_MegaStore_F_1", 43 | "idlist": [ 44 | "785981", 45 | "333627", 46 | "35533", 47 | "35532", 48 | "35531", 49 | "35530", 50 | "35529", 51 | "35528", 52 | "35527", 53 | "35526", 54 | "35525", 55 | "35524", 56 | "35523" 57 | ], 58 | "translationset": [ 59 | { 60 | "from": "Guillardia theta", 61 | "to": "\"Guillardia theta\"[Organism] OR Guillardia theta[All Fields]" 62 | } 63 | ], 64 | "translationstack": [ 65 | { 66 | "term": "\"Guillardia theta\"[Organism]", 67 | "field": "Organism", 68 | "count": "13", 69 | "explode": "Y" 70 | }, 71 | { 72 | "term": "Guillardia theta[All Fields]", 73 | "field": "All Fields", 74 | "count": "13", 75 | "explode": "N" 76 | }, 77 | "OR", 78 | "GROUP" 79 | ], 80 | "querytranslation": "\"Guillardia theta\"[Organism] OR Guillardia theta[All Fields]" 81 | } 82 | }, 83 | "rawHeaders": [ 84 | "Date", 85 | "Sat, 15 Apr 2017 08:53:19 GMT", 86 | "Server", 87 | "Apache", 88 | "Strict-Transport-Security", 89 | "max-age=31536000; includeSubDomains; preload", 90 | "Content-Security-Policy", 91 | "upgrade-insecure-requests", 92 | "Access-Control-Allow-Origin", 93 | "*", 94 | "Cache-Control", 95 | "private", 96 | "NCBI-PHID", 97 | "990C5AEB8F1DF71100000000000B000B", 98 | "NCBI-SID", 99 | "990C5AEB8F1DF7F1_0011SID", 100 | "Content-Type", 101 | "application/json; charset=UTF-8", 102 | "Set-Cookie", 103 | "ncbi_sid=990C5AEB8F1DF7F1_0011SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 08:53:19 GMT", 104 | "Vary", 105 | "Accept-Encoding", 106 | "X-UA-Compatible", 107 | "IE=Edge", 108 | "X-XSS-Protection", 109 | "1; mode=block", 110 | "Connection", 111 | "close", 112 | "Transfer-Encoding", 113 | "chunked" 114 | ] 115 | }, 116 | { 117 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 118 | "method": "GET", 119 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=sra&term=Guillardia%20theta&query_key=1&WebEnv=NCID_1_451000323_130.14.18.34_9001_1492246399_1590245674_0MetA0_S_MegaStore_F_1&retmax=1&retstart=0", 120 | "body": "", 121 | "status": 301, 122 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 123 | "rawHeaders": [ 124 | "Date", 125 | "Sat, 15 Apr 2017 08:53:20 GMT", 126 | "Server", 127 | "Apache", 128 | "Referrer-Policy", 129 | "origin-when-cross-origin", 130 | "Location", 131 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=sra&term=Guillardia%20theta&query_key=1&WebEnv=NCID_1_451000323_130.14.18.34_9001_1492246399_1590245674_0MetA0_S_MegaStore_F_1&retmax=1&retstart=0", 132 | "Content-Length", 133 | "474", 134 | "Connection", 135 | "close", 136 | "Content-Type", 137 | "text/html; charset=iso-8859-1" 138 | ] 139 | }, 140 | { 141 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 142 | "method": "GET", 143 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=sra&term=Guillardia%20theta&query_key=1&WebEnv=NCID_1_451000323_130.14.18.34_9001_1492246399_1590245674_0MetA0_S_MegaStore_F_1&retmax=1&retstart=0", 144 | "body": "", 145 | "status": 200, 146 | "response": { 147 | "header": { 148 | "type": "esearch", 149 | "version": "0.3" 150 | }, 151 | "esearchresult": { 152 | "count": "13", 153 | "retmax": "1", 154 | "retstart": "0", 155 | "idlist": [ 156 | "785981" 157 | ], 158 | "translationset": [ 159 | { 160 | "from": "Guillardia theta", 161 | "to": "\"Guillardia theta\"[Organism] OR Guillardia theta[All Fields]" 162 | } 163 | ], 164 | "translationstack": [ 165 | "GROUP", 166 | { 167 | "term": "\"Guillardia theta\"[Organism]", 168 | "field": "Organism", 169 | "count": "13", 170 | "explode": "Y" 171 | }, 172 | { 173 | "term": "Guillardia theta[All Fields]", 174 | "field": "All Fields", 175 | "count": "13", 176 | "explode": "N" 177 | }, 178 | "OR", 179 | "GROUP", 180 | "AND" 181 | ], 182 | "querytranslation": "(#1) AND (\"Guillardia theta\"[Organism] OR Guillardia theta[All Fields])" 183 | } 184 | }, 185 | "rawHeaders": [ 186 | "Date", 187 | "Sat, 15 Apr 2017 08:53:20 GMT", 188 | "Server", 189 | "Apache", 190 | "Strict-Transport-Security", 191 | "max-age=31536000; includeSubDomains; preload", 192 | "Content-Security-Policy", 193 | "upgrade-insecure-requests", 194 | "Access-Control-Allow-Origin", 195 | "*", 196 | "Cache-Control", 197 | "private", 198 | "NCBI-PHID", 199 | "990C504F8F1DF34100000000003C003B", 200 | "NCBI-SID", 201 | "990C504F8F1DF801_0060SID", 202 | "Content-Type", 203 | "application/json; charset=UTF-8", 204 | "Set-Cookie", 205 | "ncbi_sid=990C504F8F1DF801_0060SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 08:53:20 GMT", 206 | "Vary", 207 | "Accept-Encoding", 208 | "X-UA-Compatible", 209 | "IE=Edge", 210 | "X-XSS-Protection", 211 | "1; mode=block", 212 | "Connection", 213 | "close", 214 | "Transfer-Encoding", 215 | "chunked" 216 | ] 217 | }, 218 | { 219 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 220 | "method": "GET", 221 | "path": "/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=sra&id=785981&usehistory=y", 222 | "body": "", 223 | "status": 301, 224 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 225 | "rawHeaders": [ 226 | "Date", 227 | "Sat, 15 Apr 2017 08:53:21 GMT", 228 | "Server", 229 | "Apache", 230 | "Referrer-Policy", 231 | "origin-when-cross-origin", 232 | "Location", 233 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=sra&id=785981&usehistory=y", 234 | "Content-Length", 235 | "343", 236 | "Connection", 237 | "close", 238 | "Content-Type", 239 | "text/html; charset=iso-8859-1" 240 | ] 241 | }, 242 | { 243 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 244 | "method": "GET", 245 | "path": "/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=sra&id=785981&usehistory=y", 246 | "body": "", 247 | "status": 200, 248 | "response": { 249 | "header": { 250 | "type": "esummary", 251 | "version": "0.3" 252 | }, 253 | "result": { 254 | "785981": { 255 | "uid": "785981", 256 | "expxml": " <Summary><Title>Whole transcriptome sequencing of Guillardia theta CCMP 2712 - MMETSP0046_2</Title><Platform instrument_model=\"Illumina HiSeq 2000\">ILLUMINA</Platform><Statistics total_runs=\"1\" total_spots=\"21079444\" total_bases=\"4215888800\" total_size=\"2837480854\" load_done=\"true\" cluster_name=\"public\"/></Summary><Submitter acc=\"SRA166613\" center_name=\"NCGR\" contact_name=\"Kelly Schilling\" lab_name=\"\"/><Experiment acc=\"SRX549023\" ver=\"1\" status=\"public\" name=\"Whole transcriptome sequencing of Guillardia theta CCMP 2712 - MMETSP0046_2\"/><Study acc=\"SRP042159\" name=\"Marine Microbial Eukaryote Transcriptome Sequencing Project\"/><Organism taxid=\"55529\" ScientificName=\"Guillardia theta\"/><Sample acc=\"SRS616861\" name=\"\"/><Instrument ILLUMINA=\"Illumina HiSeq 2000\"/><Library_descriptor><LIBRARY_STRATEGY>RNA-Seq</LIBRARY_STRATEGY><LIBRARY_SOURCE>TRANSCRIPTOMIC</LIBRARY_SOURCE><LIBRARY_SELECTION>RANDOM PCR</LIBRARY_SELECTION><LIBRARY_LAYOUT> <PAIRED/> </LIBRARY_LAYOUT></Library_descriptor><Bioproject>SRP042159</Bioproject><Biosample>SAMN02740393</Biosample> ", 257 | "runs": " <Run acc=\"SRR1294409\" total_spots=\"21079444\" total_bases=\"4215888800\" load_done=\"true\" is_public=\"true\" cluster_name=\"public\" static_data_available=\"true\"/> ", 258 | "extlinks": " ", 259 | "createdate": "2015/07/22", 260 | "updatedate": "2014/05/21" 261 | }, 262 | "uids": [ 263 | "785981" 264 | ] 265 | } 266 | }, 267 | "rawHeaders": [ 268 | "Date", 269 | "Sat, 15 Apr 2017 08:53:21 GMT", 270 | "Server", 271 | "Apache", 272 | "Strict-Transport-Security", 273 | "max-age=31536000; includeSubDomains; preload", 274 | "Content-Security-Policy", 275 | "upgrade-insecure-requests", 276 | "Access-Control-Allow-Origin", 277 | "*", 278 | "Cache-Control", 279 | "private", 280 | "NCBI-PHID", 281 | "03EE79098F1DD7910000000000410037", 282 | "NCBI-SID", 283 | "03EE79098F1DF811_0065SID", 284 | "Content-Type", 285 | "application/json; charset=UTF-8", 286 | "Set-Cookie", 287 | "ncbi_sid=03EE79098F1DF811_0065SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 08:53:21 GMT", 288 | "Vary", 289 | "Accept-Encoding", 290 | "X-UA-Compatible", 291 | "IE=Edge", 292 | "X-XSS-Protection", 293 | "1; mode=block", 294 | "Connection", 295 | "close", 296 | "Transfer-Encoding", 297 | "chunked" 298 | ] 299 | } 300 | ] -------------------------------------------------------------------------------- /test/guillardia-theta.sra.json: -------------------------------------------------------------------------------- 1 | [ 2 | {"uid":"35523","expxml":{"Summary":{"Title":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library.","Platform":{"_":"LS454","instrument_model":"454 GS FLX"},"Statistics":{"total_runs":"1","total_spots":"19695","total_bases":"5631540","total_size":"13923541","load_done":"true","static_data_available":"true","cluster_name":"public"}},"Submitter":{"acc":"SRA025478","center_name":"JGI","contact_name":"Sam Pitluck","lab_name":"PGF"},"Experiment":{"acc":"SRX029662","ver":"1","status":"public","name":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library."},"Study":{"acc":"SRP004020","name":"Guillardia theta CCMP2712"},"Organism":{"taxid":"905079","ScientificName":"Guillardia theta CCMP2712"},"Sample":{"acc":"SRS118433","name":""},"Instrument":{"LS454":"454 GS FLX"},"Library_descriptor":{"LIBRARY_NAME":"FTZB","LIBRARY_STRATEGY":"WGS","LIBRARY_SOURCE":"GENOMIC","LIBRARY_SELECTION":"RANDOM","LIBRARY_LAYOUT":{"SINGLE":""}},"Bioproject":"SRP004020","Biosample":"SAMN00116900"},"runs":{"Run":[{"acc":"SRR070672","total_spots":"19695","total_bases":"5631540","load_done":"true","is_public":"true","cluster_name":"public","static_data_available":"true"}]},"extlinks":" ","createdate":"2011/10/29","updatedate":"2010/10/29"}, 3 | {"uid":"35524","expxml":{"Summary":{"Title":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library.","Platform":{"_":"LS454","instrument_model":"454 GS FLX"},"Statistics":{"total_runs":"1","total_spots":"204588","total_bases":"58208970","total_size":"146515335","load_done":"true","static_data_available":"true","cluster_name":"public"}},"Submitter":{"acc":"SRA025478","center_name":"JGI","contact_name":"Sam Pitluck","lab_name":"PGF"},"Experiment":{"acc":"SRX029663","ver":"1","status":"public","name":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library."},"Study":{"acc":"SRP004020","name":"Guillardia theta CCMP2712"},"Organism":{"taxid":"905079","ScientificName":"Guillardia theta CCMP2712"},"Sample":{"acc":"SRS118433","name":""},"Instrument":{"LS454":"454 GS FLX"},"Library_descriptor":{"LIBRARY_NAME":"FTZB","LIBRARY_STRATEGY":"WGS","LIBRARY_SOURCE":"GENOMIC","LIBRARY_SELECTION":"RANDOM","LIBRARY_LAYOUT":{"SINGLE":""}},"Bioproject":"SRP004020","Biosample":"SAMN00116900"},"runs":{"Run":[{"acc":"SRR070673","total_spots":"204588","total_bases":"58208970","load_done":"true","is_public":"true","cluster_name":"public","static_data_available":"true"}]},"extlinks":" ","createdate":"2011/10/29","updatedate":"2010/10/29"}, 4 | {"uid":"35525","expxml":{"Summary":{"Title":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library.","Platform":{"_":"LS454","instrument_model":"454 GS FLX"},"Statistics":{"total_runs":"1","total_spots":"295457","total_bases":"85081326","total_size":"216274455","load_done":"true","static_data_available":"true","cluster_name":"public"}},"Submitter":{"acc":"SRA025478","center_name":"JGI","contact_name":"Sam Pitluck","lab_name":"PGF"},"Experiment":{"acc":"SRX029664","ver":"1","status":"public","name":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library."},"Study":{"acc":"SRP004020","name":"Guillardia theta CCMP2712"},"Organism":{"taxid":"905079","ScientificName":"Guillardia theta CCMP2712"},"Sample":{"acc":"SRS118433","name":""},"Instrument":{"LS454":"454 GS FLX"},"Library_descriptor":{"LIBRARY_NAME":"FTZB","LIBRARY_STRATEGY":"WGS","LIBRARY_SOURCE":"GENOMIC","LIBRARY_SELECTION":"RANDOM","LIBRARY_LAYOUT":{"SINGLE":""}},"Bioproject":"SRP004020","Biosample":"SAMN00116900"},"runs":{"Run":[{"acc":"SRR070674","total_spots":"295457","total_bases":"85081326","load_done":"true","is_public":"true","cluster_name":"public","static_data_available":"true"}]},"extlinks":" ","createdate":"2011/10/29","updatedate":"2010/10/29"}, 5 | {"uid":"35526","expxml":{"Summary":{"Title":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library.","Platform":{"_":"LS454","instrument_model":"454 GS FLX"},"Statistics":{"total_runs":"1","total_spots":"11355","total_bases":"2962463","total_size":"7479863","load_done":"true","static_data_available":"true","cluster_name":"public"}},"Submitter":{"acc":"SRA025478","center_name":"JGI","contact_name":"Sam Pitluck","lab_name":"PGF"},"Experiment":{"acc":"SRX029665","ver":"1","status":"public","name":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library."},"Study":{"acc":"SRP004020","name":"Guillardia theta CCMP2712"},"Organism":{"taxid":"905079","ScientificName":"Guillardia theta CCMP2712"},"Sample":{"acc":"SRS118433","name":""},"Instrument":{"LS454":"454 GS FLX"},"Library_descriptor":{"LIBRARY_NAME":"FTZC","LIBRARY_STRATEGY":"WGS","LIBRARY_SOURCE":"GENOMIC","LIBRARY_SELECTION":"RANDOM","LIBRARY_LAYOUT":{"SINGLE":""}},"Bioproject":"SRP004020","Biosample":"SAMN00116900"},"runs":{"Run":[{"acc":"SRR070675","total_spots":"11355","total_bases":"2962463","load_done":"true","is_public":"true","cluster_name":"public","static_data_available":"true"}]},"extlinks":" ","createdate":"2011/10/29","updatedate":"2010/10/29"}, 6 | {"uid":"35527","expxml":{"Summary":{"Title":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library.","Platform":{"_":"LS454","instrument_model":"454 GS FLX"},"Statistics":{"total_runs":"1","total_spots":"286676","total_bases":"72084130","total_size":"191124885","load_done":"true","static_data_available":"true","cluster_name":"public"}},"Submitter":{"acc":"SRA025478","center_name":"JGI","contact_name":"Sam Pitluck","lab_name":"PGF"},"Experiment":{"acc":"SRX029666","ver":"1","status":"public","name":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library."},"Study":{"acc":"SRP004020","name":"Guillardia theta CCMP2712"},"Organism":{"taxid":"905079","ScientificName":"Guillardia theta CCMP2712"},"Sample":{"acc":"SRS118433","name":""},"Instrument":{"LS454":"454 GS FLX"},"Library_descriptor":{"LIBRARY_NAME":"FTZC","LIBRARY_STRATEGY":"WGS","LIBRARY_SOURCE":"GENOMIC","LIBRARY_SELECTION":"RANDOM","LIBRARY_LAYOUT":{"SINGLE":""}},"Bioproject":"SRP004020","Biosample":"SAMN00116900"},"runs":{"Run":[{"acc":"SRR070676","total_spots":"286676","total_bases":"72084130","load_done":"true","is_public":"true","cluster_name":"public","static_data_available":"true"}]},"extlinks":" ","createdate":"2011/10/29","updatedate":"2010/10/29"}, 7 | {"uid":"35528","expxml":{"Summary":{"Title":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library.","Platform":{"_":"LS454","instrument_model":"454 GS FLX"},"Statistics":{"total_runs":"1","total_spots":"971916","total_bases":"513131403","total_size":"1174625556","load_done":"true","static_data_available":"true","cluster_name":"public"}},"Submitter":{"acc":"SRA025478","center_name":"JGI","contact_name":"Sam Pitluck","lab_name":"PGF"},"Experiment":{"acc":"SRX029667","ver":"1","status":"public","name":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library."},"Study":{"acc":"SRP004020","name":"Guillardia theta CCMP2712"},"Organism":{"taxid":"905079","ScientificName":"Guillardia theta CCMP2712"},"Sample":{"acc":"SRS118433","name":""},"Instrument":{"LS454":"454 GS FLX"},"Library_descriptor":{"LIBRARY_NAME":"GGAN","LIBRARY_STRATEGY":"WGS","LIBRARY_SOURCE":"GENOMIC","LIBRARY_SELECTION":"RANDOM","LIBRARY_LAYOUT":{"SINGLE":""}},"Bioproject":"SRP004020","Biosample":"SAMN00116900"},"runs":{"Run":[{"acc":"SRR070677","total_spots":"971916","total_bases":"513131403","load_done":"true","is_public":"true","cluster_name":"public","static_data_available":"true"}]},"extlinks":" ","createdate":"2011/10/29","updatedate":"2010/10/29"}, 8 | {"uid":"35529","expxml":{"Summary":{"Title":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library.","Platform":{"_":"LS454","instrument_model":"454 GS FLX"},"Statistics":{"total_runs":"1","total_spots":"1131540","total_bases":"588220300","total_size":"1327676112","load_done":"true","static_data_available":"true","cluster_name":"public"}},"Submitter":{"acc":"SRA025478","center_name":"JGI","contact_name":"Sam Pitluck","lab_name":"PGF"},"Experiment":{"acc":"SRX029668","ver":"1","status":"public","name":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library."},"Study":{"acc":"SRP004020","name":"Guillardia theta CCMP2712"},"Organism":{"taxid":"905079","ScientificName":"Guillardia theta CCMP2712"},"Sample":{"acc":"SRS118433","name":""},"Instrument":{"LS454":"454 GS FLX"},"Library_descriptor":{"LIBRARY_NAME":"GGAN","LIBRARY_STRATEGY":"WGS","LIBRARY_SOURCE":"GENOMIC","LIBRARY_SELECTION":"RANDOM","LIBRARY_LAYOUT":{"SINGLE":""}},"Bioproject":"SRP004020","Biosample":"SAMN00116900"},"runs":{"Run":[{"acc":"SRR070678","total_spots":"1131540","total_bases":"588220300","load_done":"true","is_public":"true","cluster_name":"public","static_data_available":"true"}]},"extlinks":" ","createdate":"2011/10/29","updatedate":"2010/10/29"}, 9 | {"uid":"35530","expxml":{"Summary":{"Title":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library.","Platform":{"_":"LS454","instrument_model":"454 GS FLX"},"Statistics":{"total_runs":"1","total_spots":"875108","total_bases":"467593710","total_size":"1055151585","load_done":"true","static_data_available":"true","cluster_name":"public"}},"Submitter":{"acc":"SRA025478","center_name":"JGI","contact_name":"Sam Pitluck","lab_name":"PGF"},"Experiment":{"acc":"SRX029669","ver":"1","status":"public","name":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library."},"Study":{"acc":"SRP004020","name":"Guillardia theta CCMP2712"},"Organism":{"taxid":"905079","ScientificName":"Guillardia theta CCMP2712"},"Sample":{"acc":"SRS118433","name":""},"Instrument":{"LS454":"454 GS FLX"},"Library_descriptor":{"LIBRARY_NAME":"GGAN","LIBRARY_STRATEGY":"WGS","LIBRARY_SOURCE":"GENOMIC","LIBRARY_SELECTION":"RANDOM","LIBRARY_LAYOUT":{"SINGLE":""}},"Bioproject":"SRP004020","Biosample":"SAMN00116900"},"runs":{"Run":[{"acc":"SRR070679","total_spots":"875108","total_bases":"467593710","load_done":"true","is_public":"true","cluster_name":"public","static_data_available":"true"}]},"extlinks":" ","createdate":"2011/10/29","updatedate":"2010/10/29"}, 10 | {"uid":"35531","expxml":{"Summary":{"Title":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library.","Platform":{"_":"LS454","instrument_model":"454 GS FLX"},"Statistics":{"total_runs":"1","total_spots":"1277503","total_bases":"657634727","total_size":"1479299694","load_done":"true","static_data_available":"true","cluster_name":"public"}},"Submitter":{"acc":"SRA025478","center_name":"JGI","contact_name":"Sam Pitluck","lab_name":"PGF"},"Experiment":{"acc":"SRX029670","ver":"1","status":"public","name":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library."},"Study":{"acc":"SRP004020","name":"Guillardia theta CCMP2712"},"Organism":{"taxid":"905079","ScientificName":"Guillardia theta CCMP2712"},"Sample":{"acc":"SRS118433","name":""},"Instrument":{"LS454":"454 GS FLX"},"Library_descriptor":{"LIBRARY_NAME":"GGAN","LIBRARY_STRATEGY":"WGS","LIBRARY_SOURCE":"GENOMIC","LIBRARY_SELECTION":"RANDOM","LIBRARY_LAYOUT":{"SINGLE":""}},"Bioproject":"SRP004020","Biosample":"SAMN00116900"},"runs":{"Run":[{"acc":"SRR070680","total_spots":"1277503","total_bases":"657634727","load_done":"true","is_public":"true","cluster_name":"public","static_data_available":"true"}]},"extlinks":" ","createdate":"2011/10/29","updatedate":"2010/10/29"}, 11 | {"uid":"35532","expxml":{"Summary":{"Title":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library.","Platform":{"_":"LS454","instrument_model":"454 GS FLX"},"Statistics":{"total_runs":"1","total_spots":"873145","total_bases":"341989978","total_size":"860077955","load_done":"true","static_data_available":"true","cluster_name":"public"}},"Submitter":{"acc":"SRA025478","center_name":"JGI","contact_name":"Sam Pitluck","lab_name":"PGF"},"Experiment":{"acc":"SRX029671","ver":"1","status":"public","name":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library."},"Study":{"acc":"SRP004020","name":"Guillardia theta CCMP2712"},"Organism":{"taxid":"905079","ScientificName":"Guillardia theta CCMP2712"},"Sample":{"acc":"SRS118433","name":""},"Instrument":{"LS454":"454 GS FLX"},"Library_descriptor":{"LIBRARY_NAME":"GPNF","LIBRARY_STRATEGY":"WGS","LIBRARY_SOURCE":"GENOMIC","LIBRARY_SELECTION":"RANDOM","LIBRARY_LAYOUT":{"SINGLE":""}},"Bioproject":"SRP004020","Biosample":"SAMN00116900"},"runs":{"Run":[{"acc":"SRR070681","total_spots":"873145","total_bases":"341989978","load_done":"true","is_public":"true","cluster_name":"public","static_data_available":"true"}]},"extlinks":" ","createdate":"2011/10/29","updatedate":"2010/10/29"}, 12 | {"uid":"35533","expxml":{"Summary":{"Title":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library.","Platform":{"_":"LS454","instrument_model":"454 GS FLX"},"Statistics":{"total_runs":"1","total_spots":"853766","total_bases":"335390762","total_size":"847553880","load_done":"true","static_data_available":"true","cluster_name":"public"}},"Submitter":{"acc":"SRA025478","center_name":"JGI","contact_name":"Sam Pitluck","lab_name":"PGF"},"Experiment":{"acc":"SRX029672","ver":"1","status":"public","name":"454 sequencing of Guillardia theta CCMP2712 random whole genome shotgun library."},"Study":{"acc":"SRP004020","name":"Guillardia theta CCMP2712"},"Organism":{"taxid":"905079","ScientificName":"Guillardia theta CCMP2712"},"Sample":{"acc":"SRS118433","name":""},"Instrument":{"LS454":"454 GS FLX"},"Library_descriptor":{"LIBRARY_NAME":"GPNF","LIBRARY_STRATEGY":"WGS","LIBRARY_SOURCE":"GENOMIC","LIBRARY_SELECTION":"RANDOM","LIBRARY_LAYOUT":{"SINGLE":""}},"Bioproject":"SRP004020","Biosample":"SAMN00116900"},"runs":{"Run":[{"acc":"SRR070682","total_spots":"853766","total_bases":"335390762","load_done":"true","is_public":"true","cluster_name":"public","static_data_available":"true"}]},"extlinks":" ","createdate":"2011/10/29","updatedate":"2010/10/29"}, 13 | {"uid":"333627","expxml":{"Summary":{"Title":"Guillardia theta CCMP2712 Transcriptome","Platform":{"_":"ILLUMINA","instrument_model":"Illumina HiSeq 2000"},"Statistics":{"total_runs":"1","total_spots":"182747799","total_bases":"36549559800","total_size":"22708555668","load_done":"true","cluster_name":"public"}},"Submitter":{"acc":"SRA067334","center_name":"Dalhousie University","contact_name":"Naoko Tanifuji","lab_name":"John Archibald"},"Experiment":{"acc":"SRX242847","ver":"1","status":"public","name":"Guillardia theta CCMP2712 Transcriptome"},"Study":{"acc":"SRP018737","name":"Guillardia theta CCMP2712Transcriptome or Gene expression"},"Organism":{"taxid":"905079","ScientificName":"Guillardia theta CCMP2712"},"Sample":{"acc":"SRS396737","name":""},"Instrument":{"ILLUMINA":"Illumina HiSeq 2000"},"Library_descriptor":{"LIBRARY_NAME":"","LIBRARY_STRATEGY":"RNA-Seq","LIBRARY_SOURCE":"TRANSCRIPTOMIC","LIBRARY_SELECTION":"cDNA","LIBRARY_LAYOUT":{"PAIRED":{"NOMINAL_LENGTH":"300"}}},"Bioproject":"SRP018737","Biosample":"SAMN01923029"},"runs":{"Run":[{"acc":"SRR747855","total_spots":"182747799","total_bases":"36549559800","load_done":"true","is_public":"true","cluster_name":"public","static_data_available":"true"}]},"extlinks":" ","createdate":"2014/02/19","updatedate":"2013/02/20"}, 14 | {"uid":"785981","expxml":{"Summary":{"Title":"Whole transcriptome sequencing of Guillardia theta CCMP 2712 - MMETSP0046_2","Platform":{"_":"ILLUMINA","instrument_model":"Illumina HiSeq 2000"},"Statistics":{"total_runs":"1","total_spots":"21079444","total_bases":"4215888800","total_size":"2837480854","load_done":"true","cluster_name":"public"}},"Submitter":{"acc":"SRA166613","center_name":"NCGR","contact_name":"Kelly Schilling","lab_name":""},"Experiment":{"acc":"SRX549023","ver":"1","status":"public","name":"Whole transcriptome sequencing of Guillardia theta CCMP 2712 - MMETSP0046_2"},"Study":{"acc":"SRP042159","name":"Marine Microbial Eukaryote Transcriptome Sequencing Project"},"Organism":{"taxid":"55529","ScientificName":"Guillardia theta"},"Sample":{"acc":"SRS616861","name":""},"Instrument":{"ILLUMINA":"Illumina HiSeq 2000"},"Library_descriptor":{"LIBRARY_STRATEGY":"RNA-Seq","LIBRARY_SOURCE":"TRANSCRIPTOMIC","LIBRARY_SELECTION":"RANDOM PCR","LIBRARY_LAYOUT":{"PAIRED":""}},"Bioproject":"SRP042159","Biosample":"SAMN02740393"},"runs":{"Run":[{"acc":"SRR1294409","total_spots":"21079444","total_bases":"4215888800","load_done":"true","is_public":"true","cluster_name":"public","static_data_available":"true"}]},"extlinks":" ","createdate":"2015/07/22","updatedate":"2014/05/21"} 15 | ] 16 | -------------------------------------------------------------------------------- /test/fixtures/Search assembly_.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 4 | "method": "GET", 5 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia%20theta&usehistory=y", 6 | "body": "", 7 | "status": 301, 8 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 9 | "rawHeaders": [ 10 | "Date", 11 | "Sat, 15 Apr 2017 08:53:08 GMT", 12 | "Server", 13 | "Apache", 14 | "Referrer-Policy", 15 | "origin-when-cross-origin", 16 | "Location", 17 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia%20theta&usehistory=y", 18 | "Content-Length", 19 | "361", 20 | "Connection", 21 | "close", 22 | "Content-Type", 23 | "text/html; charset=iso-8859-1" 24 | ] 25 | }, 26 | { 27 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 28 | "method": "GET", 29 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia%20theta&usehistory=y", 30 | "body": "", 31 | "status": 200, 32 | "response": { 33 | "header": { 34 | "type": "esearch", 35 | "version": "0.3" 36 | }, 37 | "esearchresult": { 38 | "count": "1", 39 | "retmax": "1", 40 | "retstart": "0", 41 | "querykey": "1", 42 | "webenv": "NCID_1_450998846_130.14.18.34_9001_1492246389_1111274034_0MetA0_S_MegaStore_F_1", 43 | "idlist": [ 44 | "503988" 45 | ], 46 | "translationset": [ 47 | { 48 | "from": "Guillardia theta", 49 | "to": "\"Guillardia theta\"[Organism]" 50 | } 51 | ], 52 | "translationstack": [ 53 | { 54 | "term": "\"Guillardia theta\"[Organism]", 55 | "field": "Organism", 56 | "count": "1", 57 | "explode": "Y" 58 | }, 59 | "GROUP" 60 | ], 61 | "querytranslation": "\"Guillardia theta\"[Organism]" 62 | } 63 | }, 64 | "rawHeaders": [ 65 | "Date", 66 | "Sat, 15 Apr 2017 08:53:09 GMT", 67 | "Server", 68 | "Apache", 69 | "Strict-Transport-Security", 70 | "max-age=31536000; includeSubDomains; preload", 71 | "Content-Security-Policy", 72 | "upgrade-insecure-requests", 73 | "Access-Control-Allow-Origin", 74 | "*", 75 | "Cache-Control", 76 | "private", 77 | "NCBI-PHID", 78 | "03EEDCF98F1DF3710000000000350035", 79 | "NCBI-SID", 80 | "03EEDCF98F1DF751_0053SID", 81 | "Content-Type", 82 | "application/json; charset=UTF-8", 83 | "Set-Cookie", 84 | "ncbi_sid=03EEDCF98F1DF751_0053SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 08:53:09 GMT", 85 | "Vary", 86 | "Accept-Encoding", 87 | "X-UA-Compatible", 88 | "IE=Edge", 89 | "X-XSS-Protection", 90 | "1; mode=block", 91 | "Connection", 92 | "close", 93 | "Transfer-Encoding", 94 | "chunked" 95 | ] 96 | }, 97 | { 98 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 99 | "method": "GET", 100 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia%20theta&usehistory=y", 101 | "body": "", 102 | "status": 301, 103 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 104 | "rawHeaders": [ 105 | "Date", 106 | "Sat, 15 Apr 2017 08:53:10 GMT", 107 | "Server", 108 | "Apache", 109 | "Referrer-Policy", 110 | "origin-when-cross-origin", 111 | "Location", 112 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia%20theta&usehistory=y", 113 | "Content-Length", 114 | "361", 115 | "Connection", 116 | "close", 117 | "Content-Type", 118 | "text/html; charset=iso-8859-1" 119 | ] 120 | }, 121 | { 122 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 123 | "method": "GET", 124 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia%20theta&usehistory=y", 125 | "body": "", 126 | "status": 200, 127 | "response": { 128 | "header": { 129 | "type": "esearch", 130 | "version": "0.3" 131 | }, 132 | "esearchresult": { 133 | "count": "1", 134 | "retmax": "1", 135 | "retstart": "0", 136 | "querykey": "1", 137 | "webenv": "NCID_1_166930243_130.14.22.215_9001_1492246390_1063687668_0MetA0_S_MegaStore_F_1", 138 | "idlist": [ 139 | "503988" 140 | ], 141 | "translationset": [ 142 | { 143 | "from": "Guillardia theta", 144 | "to": "\"Guillardia theta\"[Organism]" 145 | } 146 | ], 147 | "translationstack": [ 148 | { 149 | "term": "\"Guillardia theta\"[Organism]", 150 | "field": "Organism", 151 | "count": "1", 152 | "explode": "Y" 153 | }, 154 | "GROUP" 155 | ], 156 | "querytranslation": "\"Guillardia theta\"[Organism]" 157 | } 158 | }, 159 | "rawHeaders": [ 160 | "Date", 161 | "Sat, 15 Apr 2017 08:53:10 GMT", 162 | "Server", 163 | "Apache", 164 | "Strict-Transport-Security", 165 | "max-age=31536000; includeSubDomains; preload", 166 | "Content-Security-Policy", 167 | "upgrade-insecure-requests", 168 | "Access-Control-Allow-Origin", 169 | "*", 170 | "Cache-Control", 171 | "private", 172 | "NCBI-PHID", 173 | "990DBC948F1DF7410000000000020002", 174 | "NCBI-SID", 175 | "990DBC948F1DF761_0002SID", 176 | "Content-Type", 177 | "application/json; charset=UTF-8", 178 | "Set-Cookie", 179 | "ncbi_sid=990DBC948F1DF761_0002SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 08:53:10 GMT", 180 | "Vary", 181 | "Accept-Encoding", 182 | "X-UA-Compatible", 183 | "IE=Edge", 184 | "X-XSS-Protection", 185 | "1; mode=block", 186 | "Connection", 187 | "close", 188 | "Transfer-Encoding", 189 | "chunked" 190 | ] 191 | }, 192 | { 193 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 194 | "method": "GET", 195 | "path": "/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=assembly&id=503988&usehistory=y", 196 | "body": "", 197 | "status": 301, 198 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 199 | "rawHeaders": [ 200 | "Date", 201 | "Sat, 15 Apr 2017 08:53:11 GMT", 202 | "Server", 203 | "Apache", 204 | "Referrer-Policy", 205 | "origin-when-cross-origin", 206 | "Location", 207 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=assembly&id=503988&usehistory=y", 208 | "Content-Length", 209 | "348", 210 | "Connection", 211 | "close", 212 | "Content-Type", 213 | "text/html; charset=iso-8859-1" 214 | ] 215 | }, 216 | { 217 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 218 | "method": "GET", 219 | "path": "/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=assembly&id=503988&usehistory=y", 220 | "body": "", 221 | "status": 200, 222 | "response": { 223 | "header": { 224 | "type": "esummary", 225 | "version": "0.3" 226 | }, 227 | "result": { 228 | "503988": { 229 | "uid": "503988", 230 | "rsuid": "1011608", 231 | "gbuid": "503988", 232 | "assemblyaccession": "GCF_000315625.1", 233 | "lastmajorreleaseaccession": "GCF_000315625.1", 234 | "chainid": "315625", 235 | "assemblyname": "Guith1", 236 | "ucscname": "", 237 | "ensemblname": "", 238 | "taxid": "905079", 239 | "organism": "Guillardia theta CCMP2712 (cryptomonads)", 240 | "speciestaxid": "55529", 241 | "speciesname": "Guillardia theta", 242 | "assemblytype": "haploid", 243 | "assemblyclass": "haploid", 244 | "assemblystatus": "Scaffold", 245 | "wgs": "AEIE01", 246 | "gb_bioprojects": [ 247 | { 248 | "bioprojectaccn": "PRJNA53577", 249 | "bioprojectid": 53577 250 | } 251 | ], 252 | "gb_projects": [ 253 | "53577" 254 | ], 255 | "rs_bioprojects": [ 256 | { 257 | "bioprojectaccn": "PRJNA223305", 258 | "bioprojectid": 223305 259 | } 260 | ], 261 | "rs_projects": [ 262 | "223305" 263 | ], 264 | "biosampleaccn": "SAMN00116900", 265 | "biosampleid": "116900", 266 | "biosource": { 267 | "infraspecieslist": [ 268 | { 269 | "sub_type": "strain", 270 | "sub_value": "CCMP2712" 271 | } 272 | ], 273 | "sex": "", 274 | "isolate": "" 275 | }, 276 | "coverage": "23.66", 277 | "partialgenomerepresentation": "false", 278 | "primary": "1011598", 279 | "assemblydescription": "", 280 | "releaselevel": "Major", 281 | "asmreleasedate_genbank": "2012/12/06 00:00", 282 | "asmreleasedate_refseq": "2014/04/22 00:00", 283 | "seqreleasedate": "2012/12/05 00:00", 284 | "asmupdatedate": "2014/04/22 00:00", 285 | "submissiondate": "2012/12/05 00:00", 286 | "lastupdatedate": "2014/04/22 00:00", 287 | "submitterorganization": "JGI", 288 | "refseq_category": "representative genome", 289 | "anomalouslist": [], 290 | "exclfromrefseq": [], 291 | "propertylist": [ 292 | "full-genome-representation", 293 | "latest", 294 | "latest_genbank", 295 | "latest_refseq", 296 | "representative", 297 | "wgs" 298 | ], 299 | "fromtype": "", 300 | "synonym": { 301 | "genbank": "GCA_000315625.1", 302 | "refseq": "GCF_000315625.1", 303 | "similarity": "identical" 304 | }, 305 | "ftppath_genbank": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/315/625/GCA_000315625.1_Guith1", 306 | "ftppath_refseq": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1", 307 | "ftppath_assembly_rpt": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_report.txt", 308 | "ftppath_stats_rpt": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_stats.txt", 309 | "ftppath_regions_rpt": "", 310 | "sortorder": "2C50003156259898", 311 | "meta": " <Stats> <Stat category=\"alt_loci_count\" sequence_tag=\"all\">0</Stat> <Stat category=\"chromosome_count\" sequence_tag=\"all\">0</Stat> <Stat category=\"contig_count\" sequence_tag=\"all\">5126</Stat> <Stat category=\"contig_l50\" sequence_tag=\"all\">587</Stat> <Stat category=\"contig_n50\" sequence_tag=\"all\">40445</Stat> <Stat category=\"non_chromosome_replicon_count\" sequence_tag=\"all\">0</Stat> <Stat category=\"replicon_count\" sequence_tag=\"all\">0</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"all\">669</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"placed\">0</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"unlocalized\">0</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"unplaced\">669</Stat> <Stat category=\"scaffold_l50\" sequence_tag=\"all\">52</Stat> <Stat category=\"scaffold_n50\" sequence_tag=\"all\">545808</Stat> <Stat category=\"total_length\" sequence_tag=\"all\">87145349</Stat> <Stat category=\"ungapped_length\" sequence_tag=\"all\">83457412</Stat> </Stats> <FtpSites> <FtpPath type=\"Assembly_rpt\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_report.txt</FtpPath> <FtpPath type=\"GenBank\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/315/625/GCA_000315625.1_Guith1</FtpPath> <FtpPath type=\"RefSeq\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1</FtpPath> <FtpPath type=\"Stats_rpt\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_stats.txt</FtpPath> </FtpSites> <assembly-level>2</assembly-level> <assembly-status>Scaffold</assembly-status> <representative-status>representative genome</representative-status> <submitter-organization>JGI</submitter-organization> " 312 | }, 313 | "uids": [ 314 | "503988" 315 | ] 316 | } 317 | }, 318 | "rawHeaders": [ 319 | "Date", 320 | "Sat, 15 Apr 2017 08:53:11 GMT", 321 | "Server", 322 | "Apache", 323 | "Strict-Transport-Security", 324 | "max-age=31536000; includeSubDomains; preload", 325 | "Content-Security-Policy", 326 | "upgrade-insecure-requests", 327 | "Access-Control-Allow-Origin", 328 | "*", 329 | "Cache-Control", 330 | "private", 331 | "NCBI-PHID", 332 | "03EE536B8F1DCD410000000000570046", 333 | "NCBI-SID", 334 | "03EE536B8F1DF771_0087SID", 335 | "Content-Type", 336 | "application/json; charset=UTF-8", 337 | "Set-Cookie", 338 | "ncbi_sid=03EE536B8F1DF771_0087SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 08:53:11 GMT", 339 | "Vary", 340 | "Accept-Encoding", 341 | "X-UA-Compatible", 342 | "IE=Edge", 343 | "X-XSS-Protection", 344 | "1; mode=block", 345 | "Connection", 346 | "close", 347 | "Transfer-Encoding", 348 | "chunked" 349 | ] 350 | } 351 | ] -------------------------------------------------------------------------------- /test/fixtures/Download list for assembly_.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 4 | "method": "GET", 5 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia%20theta&usehistory=y", 6 | "body": "", 7 | "status": 301, 8 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 9 | "rawHeaders": [ 10 | "Date", 11 | "Sat, 15 Apr 2017 08:52:56 GMT", 12 | "Server", 13 | "Apache", 14 | "Referrer-Policy", 15 | "origin-when-cross-origin", 16 | "Location", 17 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia%20theta&usehistory=y", 18 | "Content-Length", 19 | "361", 20 | "Connection", 21 | "close", 22 | "Content-Type", 23 | "text/html; charset=iso-8859-1" 24 | ] 25 | }, 26 | { 27 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 28 | "method": "GET", 29 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia%20theta&usehistory=y", 30 | "body": "", 31 | "status": 200, 32 | "response": { 33 | "header": { 34 | "type": "esearch", 35 | "version": "0.3" 36 | }, 37 | "esearchresult": { 38 | "count": "1", 39 | "retmax": "1", 40 | "retstart": "0", 41 | "querykey": "1", 42 | "webenv": "NCID_1_450997136_130.14.18.34_9001_1492246377_971583876_0MetA0_S_MegaStore_F_1", 43 | "idlist": [ 44 | "503988" 45 | ], 46 | "translationset": [ 47 | { 48 | "from": "Guillardia theta", 49 | "to": "\"Guillardia theta\"[Organism]" 50 | } 51 | ], 52 | "translationstack": [ 53 | { 54 | "term": "\"Guillardia theta\"[Organism]", 55 | "field": "Organism", 56 | "count": "1", 57 | "explode": "Y" 58 | }, 59 | "GROUP" 60 | ], 61 | "querytranslation": "\"Guillardia theta\"[Organism]" 62 | } 63 | }, 64 | "rawHeaders": [ 65 | "Date", 66 | "Sat, 15 Apr 2017 08:52:57 GMT", 67 | "Server", 68 | "Apache", 69 | "Strict-Transport-Security", 70 | "max-age=31536000; includeSubDomains; preload", 71 | "Content-Security-Policy", 72 | "upgrade-insecure-requests", 73 | "Access-Control-Allow-Origin", 74 | "*", 75 | "Cache-Control", 76 | "private", 77 | "NCBI-PHID", 78 | "990C504F8F1DF34100000000002B002A", 79 | "NCBI-SID", 80 | "990C504F8F1DF691_0043SID", 81 | "Content-Type", 82 | "application/json; charset=UTF-8", 83 | "Set-Cookie", 84 | "ncbi_sid=990C504F8F1DF691_0043SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 08:52:57 GMT", 85 | "Vary", 86 | "Accept-Encoding", 87 | "X-UA-Compatible", 88 | "IE=Edge", 89 | "X-XSS-Protection", 90 | "1; mode=block", 91 | "Connection", 92 | "close", 93 | "Transfer-Encoding", 94 | "chunked" 95 | ] 96 | }, 97 | { 98 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 99 | "method": "GET", 100 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia%20theta&usehistory=y", 101 | "body": "", 102 | "status": 301, 103 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 104 | "rawHeaders": [ 105 | "Date", 106 | "Sat, 15 Apr 2017 08:52:57 GMT", 107 | "Server", 108 | "Apache", 109 | "Referrer-Policy", 110 | "origin-when-cross-origin", 111 | "Location", 112 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia%20theta&usehistory=y", 113 | "Content-Length", 114 | "361", 115 | "Connection", 116 | "close", 117 | "Content-Type", 118 | "text/html; charset=iso-8859-1" 119 | ] 120 | }, 121 | { 122 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 123 | "method": "GET", 124 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=Guillardia%20theta&usehistory=y", 125 | "body": "", 126 | "status": 200, 127 | "response": { 128 | "header": { 129 | "type": "esearch", 130 | "version": "0.3" 131 | }, 132 | "esearchresult": { 133 | "count": "1", 134 | "retmax": "1", 135 | "retstart": "0", 136 | "querykey": "1", 137 | "webenv": "NCID_1_166928607_130.14.22.215_9001_1492246378_1263680741_0MetA0_S_MegaStore_F_1", 138 | "idlist": [ 139 | "503988" 140 | ], 141 | "translationset": [ 142 | { 143 | "from": "Guillardia theta", 144 | "to": "\"Guillardia theta\"[Organism]" 145 | } 146 | ], 147 | "translationstack": [ 148 | { 149 | "term": "\"Guillardia theta\"[Organism]", 150 | "field": "Organism", 151 | "count": "1", 152 | "explode": "Y" 153 | }, 154 | "GROUP" 155 | ], 156 | "querytranslation": "\"Guillardia theta\"[Organism]" 157 | } 158 | }, 159 | "rawHeaders": [ 160 | "Date", 161 | "Sat, 15 Apr 2017 08:52:58 GMT", 162 | "Server", 163 | "Apache", 164 | "Strict-Transport-Security", 165 | "max-age=31536000; includeSubDomains; preload", 166 | "Content-Security-Policy", 167 | "upgrade-insecure-requests", 168 | "Access-Control-Allow-Origin", 169 | "*", 170 | "Cache-Control", 171 | "private", 172 | "NCBI-PHID", 173 | "03EDB59C8F1DEED10000000000550052", 174 | "NCBI-SID", 175 | "03EDB59C8F1DF6A1_0085SID", 176 | "Content-Type", 177 | "application/json; charset=UTF-8", 178 | "Set-Cookie", 179 | "ncbi_sid=03EDB59C8F1DF6A1_0085SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 08:52:58 GMT", 180 | "Vary", 181 | "Accept-Encoding", 182 | "X-UA-Compatible", 183 | "IE=Edge", 184 | "X-XSS-Protection", 185 | "1; mode=block", 186 | "Connection", 187 | "close", 188 | "Transfer-Encoding", 189 | "chunked" 190 | ] 191 | }, 192 | { 193 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 194 | "method": "GET", 195 | "path": "/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=assembly&id=503988&usehistory=y", 196 | "body": "", 197 | "status": 301, 198 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 199 | "rawHeaders": [ 200 | "Date", 201 | "Sat, 15 Apr 2017 08:52:58 GMT", 202 | "Server", 203 | "Apache", 204 | "Referrer-Policy", 205 | "origin-when-cross-origin", 206 | "Location", 207 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=assembly&id=503988&usehistory=y", 208 | "Content-Length", 209 | "348", 210 | "Connection", 211 | "close", 212 | "Content-Type", 213 | "text/html; charset=iso-8859-1" 214 | ] 215 | }, 216 | { 217 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 218 | "method": "GET", 219 | "path": "/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=assembly&id=503988&usehistory=y", 220 | "body": "", 221 | "status": 200, 222 | "response": { 223 | "header": { 224 | "type": "esummary", 225 | "version": "0.3" 226 | }, 227 | "result": { 228 | "503988": { 229 | "uid": "503988", 230 | "rsuid": "1011608", 231 | "gbuid": "503988", 232 | "assemblyaccession": "GCF_000315625.1", 233 | "lastmajorreleaseaccession": "GCF_000315625.1", 234 | "chainid": "315625", 235 | "assemblyname": "Guith1", 236 | "ucscname": "", 237 | "ensemblname": "", 238 | "taxid": "905079", 239 | "organism": "Guillardia theta CCMP2712 (cryptomonads)", 240 | "speciestaxid": "55529", 241 | "speciesname": "Guillardia theta", 242 | "assemblytype": "haploid", 243 | "assemblyclass": "haploid", 244 | "assemblystatus": "Scaffold", 245 | "wgs": "AEIE01", 246 | "gb_bioprojects": [ 247 | { 248 | "bioprojectaccn": "PRJNA53577", 249 | "bioprojectid": 53577 250 | } 251 | ], 252 | "gb_projects": [ 253 | "53577" 254 | ], 255 | "rs_bioprojects": [ 256 | { 257 | "bioprojectaccn": "PRJNA223305", 258 | "bioprojectid": 223305 259 | } 260 | ], 261 | "rs_projects": [ 262 | "223305" 263 | ], 264 | "biosampleaccn": "SAMN00116900", 265 | "biosampleid": "116900", 266 | "biosource": { 267 | "infraspecieslist": [ 268 | { 269 | "sub_type": "strain", 270 | "sub_value": "CCMP2712" 271 | } 272 | ], 273 | "sex": "", 274 | "isolate": "" 275 | }, 276 | "coverage": "23.66", 277 | "partialgenomerepresentation": "false", 278 | "primary": "1011598", 279 | "assemblydescription": "", 280 | "releaselevel": "Major", 281 | "asmreleasedate_genbank": "2012/12/06 00:00", 282 | "asmreleasedate_refseq": "2014/04/22 00:00", 283 | "seqreleasedate": "2012/12/05 00:00", 284 | "asmupdatedate": "2014/04/22 00:00", 285 | "submissiondate": "2012/12/05 00:00", 286 | "lastupdatedate": "2014/04/22 00:00", 287 | "submitterorganization": "JGI", 288 | "refseq_category": "representative genome", 289 | "anomalouslist": [], 290 | "exclfromrefseq": [], 291 | "propertylist": [ 292 | "full-genome-representation", 293 | "latest", 294 | "latest_genbank", 295 | "latest_refseq", 296 | "representative", 297 | "wgs" 298 | ], 299 | "fromtype": "", 300 | "synonym": { 301 | "genbank": "GCA_000315625.1", 302 | "refseq": "GCF_000315625.1", 303 | "similarity": "identical" 304 | }, 305 | "ftppath_genbank": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/315/625/GCA_000315625.1_Guith1", 306 | "ftppath_refseq": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1", 307 | "ftppath_assembly_rpt": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_report.txt", 308 | "ftppath_stats_rpt": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_stats.txt", 309 | "ftppath_regions_rpt": "", 310 | "sortorder": "2C50003156259898", 311 | "meta": " <Stats> <Stat category=\"alt_loci_count\" sequence_tag=\"all\">0</Stat> <Stat category=\"chromosome_count\" sequence_tag=\"all\">0</Stat> <Stat category=\"contig_count\" sequence_tag=\"all\">5126</Stat> <Stat category=\"contig_l50\" sequence_tag=\"all\">587</Stat> <Stat category=\"contig_n50\" sequence_tag=\"all\">40445</Stat> <Stat category=\"non_chromosome_replicon_count\" sequence_tag=\"all\">0</Stat> <Stat category=\"replicon_count\" sequence_tag=\"all\">0</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"all\">669</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"placed\">0</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"unlocalized\">0</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"unplaced\">669</Stat> <Stat category=\"scaffold_l50\" sequence_tag=\"all\">52</Stat> <Stat category=\"scaffold_n50\" sequence_tag=\"all\">545808</Stat> <Stat category=\"total_length\" sequence_tag=\"all\">87145349</Stat> <Stat category=\"ungapped_length\" sequence_tag=\"all\">83457412</Stat> </Stats> <FtpSites> <FtpPath type=\"Assembly_rpt\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_report.txt</FtpPath> <FtpPath type=\"GenBank\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/315/625/GCA_000315625.1_Guith1</FtpPath> <FtpPath type=\"RefSeq\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1</FtpPath> <FtpPath type=\"Stats_rpt\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1/GCF_000315625.1_Guith1_assembly_stats.txt</FtpPath> </FtpSites> <assembly-level>2</assembly-level> <assembly-status>Scaffold</assembly-status> <representative-status>representative genome</representative-status> <submitter-organization>JGI</submitter-organization> " 312 | }, 313 | "uids": [ 314 | "503988" 315 | ] 316 | } 317 | }, 318 | "rawHeaders": [ 319 | "Date", 320 | "Sat, 15 Apr 2017 08:52:59 GMT", 321 | "Server", 322 | "Apache", 323 | "Strict-Transport-Security", 324 | "max-age=31536000; includeSubDomains; preload", 325 | "Content-Security-Policy", 326 | "upgrade-insecure-requests", 327 | "Access-Control-Allow-Origin", 328 | "*", 329 | "Cache-Control", 330 | "private", 331 | "NCBI-PHID", 332 | "03ED5CEB8F1DD63100000000004D003D", 333 | "NCBI-SID", 334 | "03ED5CEB8F1DF6B1_0077SID", 335 | "Content-Type", 336 | "application/json; charset=UTF-8", 337 | "Set-Cookie", 338 | "ncbi_sid=03ED5CEB8F1DF6B1_0077SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 08:52:59 GMT", 339 | "Vary", 340 | "Accept-Encoding", 341 | "X-UA-Compatible", 342 | "IE=Edge", 343 | "X-XSS-Protection", 344 | "1; mode=block", 345 | "Connection", 346 | "close", 347 | "Transfer-Encoding", 348 | "chunked" 349 | ] 350 | }, 351 | { 352 | "scope": "http://ftp.ncbi.nlm.nih.gov:80", 353 | "method": "GET", 354 | "path": "/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1", 355 | "body": "", 356 | "status": 301, 357 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 358 | "rawHeaders": [ 359 | "Date", 360 | "Sat, 15 Apr 2017 08:52:59 GMT", 361 | "Server", 362 | "Apache", 363 | "Location", 364 | "https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1", 365 | "Cache-Control", 366 | "max-age=31536000", 367 | "Expires", 368 | "Sun, 15 Apr 2018 08:52:59 GMT", 369 | "Content-Length", 370 | "287", 371 | "Connection", 372 | "close", 373 | "Content-Type", 374 | "text/html; charset=iso-8859-1" 375 | ] 376 | }, 377 | { 378 | "scope": "https://ftp.ncbi.nlm.nih.gov:443", 379 | "method": "GET", 380 | "path": "/genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1", 381 | "body": "", 382 | "status": 200, 383 | "response": "\n\n \n Index of /genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1\n \n \n

Index of /genomes/all/GCF/000/315/625/GCF_000315625.1_Guith1

\n
Name                    Last modified      Size  
GCF_000315625.1_Guit..> 20-Sep-2016 10:07 - \nGCF_000315625.1_Guit..> 13-Oct-2016 11:49 64K \nGCF_000315625.1_Guit..> 13-Oct-2016 11:49 4.5K \nGCF_000315625.1_Guit..> 17-Jun-2016 03:33 11M \nGCF_000315625.1_Guit..> 17-Jun-2015 09:19 1.2M \nGCF_000315625.1_Guit..> 17-Jun-2016 03:33 25M \nGCF_000315625.1_Guit..> 17-Jun-2016 03:33 44M \nGCF_000315625.1_Guit..> 17-Jun-2016 03:33 4.9M \nGCF_000315625.1_Guit..> 08-Aug-2014 00:23 6.0M \nGCF_000315625.1_Guit..> 17-Jun-2016 03:33 9.8M \nGCF_000315625.1_Guit..> 17-Jun-2016 03:33 2.5M \nGCF_000315625.1_Guit..> 17-Jun-2016 03:33 873 \nGCF_000315625.1_Guit..> 17-Jun-2016 03:33 9.2M \nGCF_000315625.1_Guit..> 17-Jun-2015 09:19 24M \nGCF_000315625.1_Guit..> 17-Jun-2016 03:33 11M \nREADME.txt 24-Jan-2017 14:12 23K \nannotation_hashes.txt 17-Jun-2016 03:33 410 \nassembly_status.txt 14-Apr-2017 02:04 14 \nmd5checksums.txt 17-Jun-2016 03:33 1.4K \n
\n\n", 384 | "rawHeaders": [ 385 | "Date", 386 | "Sat, 15 Apr 2017 08:53:00 GMT", 387 | "Server", 388 | "Apache", 389 | "Strict-Transport-Security", 390 | "max-age=31536000; includeSubDomains; preload", 391 | "Cache-Control", 392 | "max-age=31536000", 393 | "Expires", 394 | "Sun, 15 Apr 2018 08:53:00 GMT", 395 | "Content-Length", 396 | "2241", 397 | "Connection", 398 | "close", 399 | "Content-Type", 400 | "text/html;charset=ISO-8859-1" 401 | ] 402 | } 403 | ] -------------------------------------------------------------------------------- /test/fixtures/Download_.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 4 | "method": "GET", 5 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=ASM1036v1&usehistory=y", 6 | "body": "", 7 | "status": 301, 8 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 9 | "rawHeaders": [ 10 | "Date", 11 | "Sat, 15 Apr 2017 10:14:33 GMT", 12 | "Server", 13 | "Apache", 14 | "Referrer-Policy", 15 | "origin-when-cross-origin", 16 | "Location", 17 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=ASM1036v1&usehistory=y", 18 | "Content-Length", 19 | "352", 20 | "Connection", 21 | "close", 22 | "Content-Type", 23 | "text/html; charset=iso-8859-1" 24 | ] 25 | }, 26 | { 27 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 28 | "method": "GET", 29 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=ASM1036v1&usehistory=y", 30 | "body": "", 31 | "status": 200, 32 | "response": { 33 | "header": { 34 | "type": "esearch", 35 | "version": "0.3" 36 | }, 37 | "esearchresult": { 38 | "count": "1", 39 | "retmax": "1", 40 | "retstart": "0", 41 | "querykey": "1", 42 | "webenv": "NCID_1_167598690_130.14.22.215_9001_1492251275_1903678535_0MetA0_S_MegaStore_F_1", 43 | "idlist": [ 44 | "31868" 45 | ], 46 | "translationset": [], 47 | "translationstack": [ 48 | { 49 | "term": "ASM1036v1[All Fields]", 50 | "field": "All Fields", 51 | "count": "1", 52 | "explode": "N" 53 | }, 54 | "GROUP" 55 | ], 56 | "querytranslation": "ASM1036v1[All Fields]" 57 | } 58 | }, 59 | "rawHeaders": [ 60 | "Date", 61 | "Sat, 15 Apr 2017 10:14:35 GMT", 62 | "Server", 63 | "Apache", 64 | "Strict-Transport-Security", 65 | "max-age=31536000; includeSubDomains; preload", 66 | "Content-Security-Policy", 67 | "upgrade-insecure-requests", 68 | "Access-Control-Allow-Origin", 69 | "*", 70 | "Cache-Control", 71 | "private", 72 | "NCBI-PHID", 73 | "990C3FDA8F1F27E100000000000D0008", 74 | "NCBI-SID", 75 | "990C3FDA8F1F28B1_0013SID", 76 | "Content-Type", 77 | "application/json; charset=UTF-8", 78 | "Set-Cookie", 79 | "ncbi_sid=990C3FDA8F1F28B1_0013SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 10:14:35 GMT", 80 | "Vary", 81 | "Accept-Encoding", 82 | "X-UA-Compatible", 83 | "IE=Edge", 84 | "X-XSS-Protection", 85 | "1; mode=block", 86 | "Connection", 87 | "close", 88 | "Transfer-Encoding", 89 | "chunked" 90 | ] 91 | }, 92 | { 93 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 94 | "method": "GET", 95 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=ASM1036v1&usehistory=y", 96 | "body": "", 97 | "status": 301, 98 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 99 | "rawHeaders": [ 100 | "Date", 101 | "Sat, 15 Apr 2017 10:14:35 GMT", 102 | "Server", 103 | "Apache", 104 | "Referrer-Policy", 105 | "origin-when-cross-origin", 106 | "Location", 107 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=ASM1036v1&usehistory=y", 108 | "Content-Length", 109 | "352", 110 | "Connection", 111 | "close", 112 | "Content-Type", 113 | "text/html; charset=iso-8859-1" 114 | ] 115 | }, 116 | { 117 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 118 | "method": "GET", 119 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=ASM1036v1&usehistory=y", 120 | "body": "", 121 | "status": 200, 122 | "response": { 123 | "header": { 124 | "type": "esearch", 125 | "version": "0.3" 126 | }, 127 | "esearchresult": { 128 | "count": "1", 129 | "retmax": "1", 130 | "retstart": "0", 131 | "querykey": "1", 132 | "webenv": "NCID_1_167598857_130.14.22.215_9001_1492251276_1881403464_0MetA0_S_MegaStore_F_1", 133 | "idlist": [ 134 | "31868" 135 | ], 136 | "translationset": [], 137 | "translationstack": [ 138 | { 139 | "term": "ASM1036v1[All Fields]", 140 | "field": "All Fields", 141 | "count": "1", 142 | "explode": "N" 143 | }, 144 | "GROUP" 145 | ], 146 | "querytranslation": "ASM1036v1[All Fields]" 147 | } 148 | }, 149 | "rawHeaders": [ 150 | "Date", 151 | "Sat, 15 Apr 2017 10:14:36 GMT", 152 | "Server", 153 | "Apache", 154 | "Strict-Transport-Security", 155 | "max-age=31536000; includeSubDomains; preload", 156 | "Content-Security-Policy", 157 | "upgrade-insecure-requests", 158 | "Access-Control-Allow-Origin", 159 | "*", 160 | "Cache-Control", 161 | "private", 162 | "NCBI-PHID", 163 | "03EDC3938F1F2781000000000016000C", 164 | "NCBI-SID", 165 | "03EDC3938F1F28C1_0022SID", 166 | "Content-Type", 167 | "application/json; charset=UTF-8", 168 | "Set-Cookie", 169 | "ncbi_sid=03EDC3938F1F28C1_0022SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 10:14:36 GMT", 170 | "Vary", 171 | "Accept-Encoding", 172 | "X-UA-Compatible", 173 | "IE=Edge", 174 | "X-XSS-Protection", 175 | "1; mode=block", 176 | "Connection", 177 | "close", 178 | "Transfer-Encoding", 179 | "chunked" 180 | ] 181 | }, 182 | { 183 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 184 | "method": "GET", 185 | "path": "/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=assembly&id=31868&usehistory=y", 186 | "body": "", 187 | "status": 301, 188 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 189 | "rawHeaders": [ 190 | "Date", 191 | "Sat, 15 Apr 2017 10:14:37 GMT", 192 | "Server", 193 | "Apache", 194 | "Referrer-Policy", 195 | "origin-when-cross-origin", 196 | "Location", 197 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=assembly&id=31868&usehistory=y", 198 | "Content-Length", 199 | "347", 200 | "Connection", 201 | "close", 202 | "Content-Type", 203 | "text/html; charset=iso-8859-1" 204 | ] 205 | }, 206 | { 207 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 208 | "method": "GET", 209 | "path": "/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=assembly&id=31868&usehistory=y", 210 | "body": "", 211 | "status": 200, 212 | "response": { 213 | "header": { 214 | "type": "esummary", 215 | "version": "0.3" 216 | }, 217 | "result": { 218 | "31868": { 219 | "uid": "31868", 220 | "rsuid": "31868", 221 | "gbuid": "11168", 222 | "assemblyaccession": "GCF_000010365.1", 223 | "lastmajorreleaseaccession": "GCF_000010365.1", 224 | "chainid": "10365", 225 | "assemblyname": "ASM1036v1", 226 | "ucscname": "", 227 | "ensemblname": "", 228 | "taxid": "387662", 229 | "organism": "Candidatus Carsonella ruddii PV (g-proteobacteria)", 230 | "speciestaxid": "114186", 231 | "speciesname": "Candidatus Carsonella ruddii", 232 | "assemblytype": "haploid", 233 | "assemblyclass": "haploid", 234 | "assemblystatus": "Complete Genome", 235 | "wgs": "", 236 | "gb_bioprojects": [ 237 | { 238 | "bioprojectaccn": "PRJNA17977", 239 | "bioprojectid": 17977 240 | } 241 | ], 242 | "gb_projects": [ 243 | "17977" 244 | ], 245 | "rs_bioprojects": [], 246 | "rs_projects": [], 247 | "biosampleaccn": "SAMD00061085", 248 | "biosampleid": "5831888", 249 | "biosource": { 250 | "infraspecieslist": [ 251 | { 252 | "sub_type": "strain", 253 | "sub_value": "PV" 254 | } 255 | ], 256 | "sex": "", 257 | "isolate": "" 258 | }, 259 | "coverage": "0", 260 | "partialgenomerepresentation": "false", 261 | "primary": "31858", 262 | "assemblydescription": "", 263 | "releaselevel": "Major", 264 | "asmreleasedate_genbank": "2010/05/12 00:00", 265 | "asmreleasedate_refseq": "2010/05/13 00:00", 266 | "seqreleasedate": "2006/10/16 00:00", 267 | "asmupdatedate": "2015/10/15 00:00", 268 | "submissiondate": "2006/10/16 00:00", 269 | "lastupdatedate": "2015/10/15 00:00", 270 | "submitterorganization": "Kitasato Institute for Life Sciences", 271 | "refseq_category": "na", 272 | "anomalouslist": [], 273 | "exclfromrefseq": [], 274 | "propertylist": [ 275 | "full-genome-representation", 276 | "has-chromosome", 277 | "latest", 278 | "latest_genbank", 279 | "suppressed_refseq" 280 | ], 281 | "fromtype": "", 282 | "synonym": { 283 | "genbank": "GCA_000010365.1", 284 | "refseq": "GCF_000010365.1", 285 | "similarity": "identical" 286 | }, 287 | "ftppath_genbank": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/010/365/GCA_000010365.1_ASM1036v1", 288 | "ftppath_refseq": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1", 289 | "ftppath_assembly_rpt": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_assembly_report.txt", 290 | "ftppath_stats_rpt": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_assembly_stats.txt", 291 | "ftppath_regions_rpt": "", 292 | "sortorder": "5C10000103659898", 293 | "meta": " <Stats> <Stat category=\"alt_loci_count\" sequence_tag=\"all\">0</Stat> <Stat category=\"chromosome_count\" sequence_tag=\"all\">1</Stat> <Stat category=\"contig_count\" sequence_tag=\"all\">1</Stat> <Stat category=\"contig_l50\" sequence_tag=\"all\">1</Stat> <Stat category=\"contig_n50\" sequence_tag=\"all\">159662</Stat> <Stat category=\"non_chromosome_replicon_count\" sequence_tag=\"all\">0</Stat> <Stat category=\"replicon_count\" sequence_tag=\"all\">1</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"all\">1</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"placed\">1</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"unlocalized\">0</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"unplaced\">0</Stat> <Stat category=\"scaffold_l50\" sequence_tag=\"all\">1</Stat> <Stat category=\"scaffold_n50\" sequence_tag=\"all\">159662</Stat> <Stat category=\"total_length\" sequence_tag=\"all\">159662</Stat> <Stat category=\"ungapped_length\" sequence_tag=\"all\">159662</Stat> </Stats> <FtpSites> <FtpPath type=\"Assembly_rpt\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_assembly_report.txt</FtpPath> <FtpPath type=\"GenBank\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/010/365/GCA_000010365.1_ASM1036v1</FtpPath> <FtpPath type=\"RefSeq\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1</FtpPath> <FtpPath type=\"Stats_rpt\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_assembly_stats.txt</FtpPath> </FtpSites> <assembly-level>5</assembly-level> <assembly-status>Complete Genome</assembly-status> <representative-status>na</representative-status> <submitter-organization>Kitasato Institute for Life Sciences</submitter-organization> " 294 | }, 295 | "uids": [ 296 | "31868" 297 | ] 298 | } 299 | }, 300 | "rawHeaders": [ 301 | "Date", 302 | "Sat, 15 Apr 2017 10:14:38 GMT", 303 | "Server", 304 | "Apache", 305 | "Strict-Transport-Security", 306 | "max-age=31536000; includeSubDomains; preload", 307 | "Content-Security-Policy", 308 | "upgrade-insecure-requests", 309 | "Access-Control-Allow-Origin", 310 | "*", 311 | "Cache-Control", 312 | "private", 313 | "NCBI-PHID", 314 | "990C21868F1F19F10000000000160011", 315 | "NCBI-SID", 316 | "990C21868F1F28E1_0022SID", 317 | "Content-Type", 318 | "application/json; charset=UTF-8", 319 | "Set-Cookie", 320 | "ncbi_sid=990C21868F1F28E1_0022SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 10:14:38 GMT", 321 | "Vary", 322 | "Accept-Encoding", 323 | "X-UA-Compatible", 324 | "IE=Edge", 325 | "X-XSS-Protection", 326 | "1; mode=block", 327 | "Connection", 328 | "close", 329 | "Transfer-Encoding", 330 | "chunked" 331 | ] 332 | }, 333 | { 334 | "scope": "http://ftp.ncbi.nlm.nih.gov:80", 335 | "method": "GET", 336 | "path": "/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1", 337 | "body": "", 338 | "status": 301, 339 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 340 | "rawHeaders": [ 341 | "Date", 342 | "Sat, 15 Apr 2017 10:14:39 GMT", 343 | "Server", 344 | "Apache", 345 | "Location", 346 | "https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1", 347 | "Cache-Control", 348 | "max-age=31536000", 349 | "Expires", 350 | "Sun, 15 Apr 2018 10:14:39 GMT", 351 | "Content-Length", 352 | "290", 353 | "Connection", 354 | "close", 355 | "Content-Type", 356 | "text/html; charset=iso-8859-1" 357 | ] 358 | }, 359 | { 360 | "scope": "https://ftp.ncbi.nlm.nih.gov:443", 361 | "method": "GET", 362 | "path": "/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1", 363 | "body": "", 364 | "status": 200, 365 | "response": "\n\n \n Index of /genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1\n \n \n

Index of /genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1

\n
Name                    Last modified      Size  
GCF_000010365.1_ASM1..> 13-Oct-2016 11:31 1.1K \nGCF_000010365.1_ASM1..> 13-Oct-2016 11:31 3.5K \nGCF_000010365.1_ASM1..> 04-Sep-2015 22:38 7.9K \nGCF_000010365.1_ASM1..> 21-Mar-2015 01:16 41K \nGCF_000010365.1_ASM1..> 04-Sep-2015 22:38 101K \nGCF_000010365.1_ASM1..> 04-Sep-2015 22:38 12K \nGCF_000010365.1_ASM1..> 04-Sep-2015 22:38 29K \nGCF_000010365.1_ASM1..> 04-Sep-2015 22:38 42K \nREADME.txt 24-Jan-2017 14:12 23K \nassembly_status.txt 14-Apr-2017 01:26 18 \nmd5checksums.txt 04-Sep-2015 22:38 470 \n
\n\n", 366 | "rawHeaders": [ 367 | "Date", 368 | "Sat, 15 Apr 2017 10:14:40 GMT", 369 | "Server", 370 | "Apache", 371 | "Strict-Transport-Security", 372 | "max-age=31536000; includeSubDomains; preload", 373 | "Cache-Control", 374 | "max-age=31536000", 375 | "Expires", 376 | "Sun, 15 Apr 2018 10:14:40 GMT", 377 | "Content-Length", 378 | "1447", 379 | "Connection", 380 | "close", 381 | "Content-Type", 382 | "text/html;charset=ISO-8859-1" 383 | ] 384 | }, 385 | { 386 | "scope": "http://ftp.ncbi.nlm.nih.gov:80", 387 | "method": "GET", 388 | "path": "/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_genomic.fna.gz", 389 | "body": "", 390 | "status": 301, 391 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 392 | "rawHeaders": [ 393 | "Date", 394 | "Sat, 15 Apr 2017 10:14:40 GMT", 395 | "Server", 396 | "Apache", 397 | "Location", 398 | "https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_genomic.fna.gz", 399 | "Cache-Control", 400 | "max-age=31536000", 401 | "Expires", 402 | "Sun, 15 Apr 2018 10:14:40 GMT", 403 | "Content-Length", 404 | "331", 405 | "Connection", 406 | "close", 407 | "Content-Type", 408 | "text/html; charset=iso-8859-1" 409 | ] 410 | }, 411 | { 412 | "scope": "https://ftp.ncbi.nlm.nih.gov:443", 413 | "method": "GET", 414 | "path": "/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_genomic.fna.gz", 415 | "body": "", 416 | "status": 200, 417 | "response": "", 418 | "rawHeaders": [ 419 | "Date", 420 | "Sat, 15 Apr 2017 10:14:41 GMT", 421 | "Server", 422 | "Apache", 423 | "Strict-Transport-Security", 424 | "max-age=31536000; includeSubDomains; preload", 425 | "Last-Modified", 426 | "Sat, 21 Mar 2015 05:16:09 GMT", 427 | "Accept-Ranges", 428 | "bytes", 429 | "Content-Length", 430 | "42224", 431 | "Cache-Control", 432 | "max-age=31536000", 433 | "Expires", 434 | "Sun, 15 Apr 2018 10:14:41 GMT", 435 | "Connection", 436 | "close", 437 | "Content-Type", 438 | "application/x-gzip" 439 | ] 440 | } 441 | ] -------------------------------------------------------------------------------- /test/fixtures/Download unless file exists_.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 4 | "method": "GET", 5 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=ASM1036v1&usehistory=y", 6 | "body": "", 7 | "status": 301, 8 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 9 | "rawHeaders": [ 10 | "Date", 11 | "Sat, 15 Apr 2017 10:14:43 GMT", 12 | "Server", 13 | "Apache", 14 | "Referrer-Policy", 15 | "origin-when-cross-origin", 16 | "Location", 17 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=ASM1036v1&usehistory=y", 18 | "Content-Length", 19 | "352", 20 | "Connection", 21 | "close", 22 | "Content-Type", 23 | "text/html; charset=iso-8859-1" 24 | ] 25 | }, 26 | { 27 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 28 | "method": "GET", 29 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=ASM1036v1&usehistory=y", 30 | "body": "", 31 | "status": 200, 32 | "response": { 33 | "header": { 34 | "type": "esearch", 35 | "version": "0.3" 36 | }, 37 | "esearchresult": { 38 | "count": "1", 39 | "retmax": "1", 40 | "retstart": "0", 41 | "querykey": "1", 42 | "webenv": "NCID_1_167600140_130.14.22.215_9001_1492251284_851112112_0MetA0_S_MegaStore_F_1", 43 | "idlist": [ 44 | "31868" 45 | ], 46 | "translationset": [], 47 | "translationstack": [ 48 | { 49 | "term": "ASM1036v1[All Fields]", 50 | "field": "All Fields", 51 | "count": "1", 52 | "explode": "N" 53 | }, 54 | "GROUP" 55 | ], 56 | "querytranslation": "ASM1036v1[All Fields]" 57 | } 58 | }, 59 | "rawHeaders": [ 60 | "Date", 61 | "Sat, 15 Apr 2017 10:14:44 GMT", 62 | "Server", 63 | "Apache", 64 | "Strict-Transport-Security", 65 | "max-age=31536000; includeSubDomains; preload", 66 | "Content-Security-Policy", 67 | "upgrade-insecure-requests", 68 | "Access-Control-Allow-Origin", 69 | "*", 70 | "Cache-Control", 71 | "private", 72 | "NCBI-PHID", 73 | "990DAD0B8F1F264100000000002C001F", 74 | "NCBI-SID", 75 | "990DAD0B8F1F2941_0044SID", 76 | "Content-Type", 77 | "application/json; charset=UTF-8", 78 | "Set-Cookie", 79 | "ncbi_sid=990DAD0B8F1F2941_0044SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 10:14:44 GMT", 80 | "Vary", 81 | "Accept-Encoding", 82 | "X-UA-Compatible", 83 | "IE=Edge", 84 | "X-XSS-Protection", 85 | "1; mode=block", 86 | "Connection", 87 | "close", 88 | "Transfer-Encoding", 89 | "chunked" 90 | ] 91 | }, 92 | { 93 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 94 | "method": "GET", 95 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=ASM1036v1&usehistory=y", 96 | "body": "", 97 | "status": 301, 98 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 99 | "rawHeaders": [ 100 | "Date", 101 | "Sat, 15 Apr 2017 10:14:44 GMT", 102 | "Server", 103 | "Apache", 104 | "Referrer-Policy", 105 | "origin-when-cross-origin", 106 | "Location", 107 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=ASM1036v1&usehistory=y", 108 | "Content-Length", 109 | "352", 110 | "Connection", 111 | "close", 112 | "Content-Type", 113 | "text/html; charset=iso-8859-1" 114 | ] 115 | }, 116 | { 117 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 118 | "method": "GET", 119 | "path": "/entrez/eutils/esearch.fcgi?&retmode=json&version=2.0&db=assembly&term=ASM1036v1&usehistory=y", 120 | "body": "", 121 | "status": 200, 122 | "response": { 123 | "header": { 124 | "type": "esearch", 125 | "version": "0.3" 126 | }, 127 | "esearchresult": { 128 | "count": "1", 129 | "retmax": "1", 130 | "retstart": "0", 131 | "querykey": "1", 132 | "webenv": "NCID_1_167600265_130.14.22.215_9001_1492251285_118637418_0MetA0_S_MegaStore_F_1", 133 | "idlist": [ 134 | "31868" 135 | ], 136 | "translationset": [], 137 | "translationstack": [ 138 | { 139 | "term": "ASM1036v1[All Fields]", 140 | "field": "All Fields", 141 | "count": "1", 142 | "explode": "N" 143 | }, 144 | "GROUP" 145 | ], 146 | "querytranslation": "ASM1036v1[All Fields]" 147 | } 148 | }, 149 | "rawHeaders": [ 150 | "Date", 151 | "Sat, 15 Apr 2017 10:14:45 GMT", 152 | "Server", 153 | "Apache", 154 | "Strict-Transport-Security", 155 | "max-age=31536000; includeSubDomains; preload", 156 | "Content-Security-Policy", 157 | "upgrade-insecure-requests", 158 | "Access-Control-Allow-Origin", 159 | "*", 160 | "Cache-Control", 161 | "private", 162 | "NCBI-PHID", 163 | "03EEE23E8F1F2691000000000026001B", 164 | "NCBI-SID", 165 | "03EEE23E8F1F2951_0038SID", 166 | "Content-Type", 167 | "application/json; charset=UTF-8", 168 | "Set-Cookie", 169 | "ncbi_sid=03EEE23E8F1F2951_0038SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 10:14:45 GMT", 170 | "Vary", 171 | "Accept-Encoding", 172 | "X-UA-Compatible", 173 | "IE=Edge", 174 | "X-XSS-Protection", 175 | "1; mode=block", 176 | "Connection", 177 | "close", 178 | "Transfer-Encoding", 179 | "chunked" 180 | ] 181 | }, 182 | { 183 | "scope": "http://eutils.ncbi.nlm.nih.gov:80", 184 | "method": "GET", 185 | "path": "/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=assembly&id=31868&usehistory=y", 186 | "body": "", 187 | "status": 301, 188 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 189 | "rawHeaders": [ 190 | "Date", 191 | "Sat, 15 Apr 2017 10:14:45 GMT", 192 | "Server", 193 | "Apache", 194 | "Referrer-Policy", 195 | "origin-when-cross-origin", 196 | "Location", 197 | "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=assembly&id=31868&usehistory=y", 198 | "Content-Length", 199 | "347", 200 | "Connection", 201 | "close", 202 | "Content-Type", 203 | "text/html; charset=iso-8859-1" 204 | ] 205 | }, 206 | { 207 | "scope": "https://eutils.ncbi.nlm.nih.gov:443", 208 | "method": "GET", 209 | "path": "/entrez/eutils/esummary.fcgi?&retmode=json&version=2.0&db=assembly&id=31868&usehistory=y", 210 | "body": "", 211 | "status": 200, 212 | "response": { 213 | "header": { 214 | "type": "esummary", 215 | "version": "0.3" 216 | }, 217 | "result": { 218 | "31868": { 219 | "uid": "31868", 220 | "rsuid": "31868", 221 | "gbuid": "11168", 222 | "assemblyaccession": "GCF_000010365.1", 223 | "lastmajorreleaseaccession": "GCF_000010365.1", 224 | "chainid": "10365", 225 | "assemblyname": "ASM1036v1", 226 | "ucscname": "", 227 | "ensemblname": "", 228 | "taxid": "387662", 229 | "organism": "Candidatus Carsonella ruddii PV (g-proteobacteria)", 230 | "speciestaxid": "114186", 231 | "speciesname": "Candidatus Carsonella ruddii", 232 | "assemblytype": "haploid", 233 | "assemblyclass": "haploid", 234 | "assemblystatus": "Complete Genome", 235 | "wgs": "", 236 | "gb_bioprojects": [ 237 | { 238 | "bioprojectaccn": "PRJNA17977", 239 | "bioprojectid": 17977 240 | } 241 | ], 242 | "gb_projects": [ 243 | "17977" 244 | ], 245 | "rs_bioprojects": [], 246 | "rs_projects": [], 247 | "biosampleaccn": "SAMD00061085", 248 | "biosampleid": "5831888", 249 | "biosource": { 250 | "infraspecieslist": [ 251 | { 252 | "sub_type": "strain", 253 | "sub_value": "PV" 254 | } 255 | ], 256 | "sex": "", 257 | "isolate": "" 258 | }, 259 | "coverage": "0", 260 | "partialgenomerepresentation": "false", 261 | "primary": "31858", 262 | "assemblydescription": "", 263 | "releaselevel": "Major", 264 | "asmreleasedate_genbank": "2010/05/12 00:00", 265 | "asmreleasedate_refseq": "2010/05/13 00:00", 266 | "seqreleasedate": "2006/10/16 00:00", 267 | "asmupdatedate": "2015/10/15 00:00", 268 | "submissiondate": "2006/10/16 00:00", 269 | "lastupdatedate": "2015/10/15 00:00", 270 | "submitterorganization": "Kitasato Institute for Life Sciences", 271 | "refseq_category": "na", 272 | "anomalouslist": [], 273 | "exclfromrefseq": [], 274 | "propertylist": [ 275 | "full-genome-representation", 276 | "has-chromosome", 277 | "latest", 278 | "latest_genbank", 279 | "suppressed_refseq" 280 | ], 281 | "fromtype": "", 282 | "synonym": { 283 | "genbank": "GCA_000010365.1", 284 | "refseq": "GCF_000010365.1", 285 | "similarity": "identical" 286 | }, 287 | "ftppath_genbank": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/010/365/GCA_000010365.1_ASM1036v1", 288 | "ftppath_refseq": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1", 289 | "ftppath_assembly_rpt": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_assembly_report.txt", 290 | "ftppath_stats_rpt": "ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_assembly_stats.txt", 291 | "ftppath_regions_rpt": "", 292 | "sortorder": "5C10000103659898", 293 | "meta": " <Stats> <Stat category=\"alt_loci_count\" sequence_tag=\"all\">0</Stat> <Stat category=\"chromosome_count\" sequence_tag=\"all\">1</Stat> <Stat category=\"contig_count\" sequence_tag=\"all\">1</Stat> <Stat category=\"contig_l50\" sequence_tag=\"all\">1</Stat> <Stat category=\"contig_n50\" sequence_tag=\"all\">159662</Stat> <Stat category=\"non_chromosome_replicon_count\" sequence_tag=\"all\">0</Stat> <Stat category=\"replicon_count\" sequence_tag=\"all\">1</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"all\">1</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"placed\">1</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"unlocalized\">0</Stat> <Stat category=\"scaffold_count\" sequence_tag=\"unplaced\">0</Stat> <Stat category=\"scaffold_l50\" sequence_tag=\"all\">1</Stat> <Stat category=\"scaffold_n50\" sequence_tag=\"all\">159662</Stat> <Stat category=\"total_length\" sequence_tag=\"all\">159662</Stat> <Stat category=\"ungapped_length\" sequence_tag=\"all\">159662</Stat> </Stats> <FtpSites> <FtpPath type=\"Assembly_rpt\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_assembly_report.txt</FtpPath> <FtpPath type=\"GenBank\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCA/000/010/365/GCA_000010365.1_ASM1036v1</FtpPath> <FtpPath type=\"RefSeq\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1</FtpPath> <FtpPath type=\"Stats_rpt\">ftp://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_assembly_stats.txt</FtpPath> </FtpSites> <assembly-level>5</assembly-level> <assembly-status>Complete Genome</assembly-status> <representative-status>na</representative-status> <submitter-organization>Kitasato Institute for Life Sciences</submitter-organization> " 294 | }, 295 | "uids": [ 296 | "31868" 297 | ] 298 | } 299 | }, 300 | "rawHeaders": [ 301 | "Date", 302 | "Sat, 15 Apr 2017 10:14:46 GMT", 303 | "Server", 304 | "Apache", 305 | "Strict-Transport-Security", 306 | "max-age=31536000; includeSubDomains; preload", 307 | "Content-Security-Policy", 308 | "upgrade-insecure-requests", 309 | "Access-Control-Allow-Origin", 310 | "*", 311 | "Cache-Control", 312 | "private", 313 | "NCBI-PHID", 314 | "990C2FCC8F1F2051000000000013000B", 315 | "NCBI-SID", 316 | "990C2FCC8F1F2961_0019SID", 317 | "Content-Type", 318 | "application/json; charset=UTF-8", 319 | "Set-Cookie", 320 | "ncbi_sid=990C2FCC8F1F2961_0019SID; domain=.nih.gov; path=/; expires=Sun, 15 Apr 2018 10:14:46 GMT", 321 | "Vary", 322 | "Accept-Encoding", 323 | "X-UA-Compatible", 324 | "IE=Edge", 325 | "X-XSS-Protection", 326 | "1; mode=block", 327 | "Connection", 328 | "close", 329 | "Transfer-Encoding", 330 | "chunked" 331 | ] 332 | }, 333 | { 334 | "scope": "http://ftp.ncbi.nlm.nih.gov:80", 335 | "method": "GET", 336 | "path": "/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1", 337 | "body": "", 338 | "status": 301, 339 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 340 | "rawHeaders": [ 341 | "Date", 342 | "Sat, 15 Apr 2017 10:14:47 GMT", 343 | "Server", 344 | "Apache", 345 | "Location", 346 | "https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1", 347 | "Cache-Control", 348 | "max-age=31536000", 349 | "Expires", 350 | "Sun, 15 Apr 2018 10:14:47 GMT", 351 | "Content-Length", 352 | "290", 353 | "Connection", 354 | "close", 355 | "Content-Type", 356 | "text/html; charset=iso-8859-1" 357 | ] 358 | }, 359 | { 360 | "scope": "https://ftp.ncbi.nlm.nih.gov:443", 361 | "method": "GET", 362 | "path": "/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1", 363 | "body": "", 364 | "status": 200, 365 | "response": "\n\n \n Index of /genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1\n \n \n

Index of /genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1

\n
Name                    Last modified      Size  
GCF_000010365.1_ASM1..> 13-Oct-2016 11:31 1.1K \nGCF_000010365.1_ASM1..> 13-Oct-2016 11:31 3.5K \nGCF_000010365.1_ASM1..> 04-Sep-2015 22:38 7.9K \nGCF_000010365.1_ASM1..> 21-Mar-2015 01:16 41K \nGCF_000010365.1_ASM1..> 04-Sep-2015 22:38 101K \nGCF_000010365.1_ASM1..> 04-Sep-2015 22:38 12K \nGCF_000010365.1_ASM1..> 04-Sep-2015 22:38 29K \nGCF_000010365.1_ASM1..> 04-Sep-2015 22:38 42K \nREADME.txt 24-Jan-2017 14:12 23K \nassembly_status.txt 14-Apr-2017 01:26 18 \nmd5checksums.txt 04-Sep-2015 22:38 470 \n
\n\n", 366 | "rawHeaders": [ 367 | "Date", 368 | "Sat, 15 Apr 2017 10:14:48 GMT", 369 | "Server", 370 | "Apache", 371 | "Strict-Transport-Security", 372 | "max-age=31536000; includeSubDomains; preload", 373 | "Cache-Control", 374 | "max-age=31536000", 375 | "Expires", 376 | "Sun, 15 Apr 2018 10:14:48 GMT", 377 | "Content-Length", 378 | "1447", 379 | "Connection", 380 | "close", 381 | "Content-Type", 382 | "text/html;charset=ISO-8859-1" 383 | ] 384 | }, 385 | { 386 | "scope": "http://ftp.ncbi.nlm.nih.gov:80", 387 | "method": "GET", 388 | "path": "/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_genomic.fna.gz", 389 | "body": "", 390 | "status": 301, 391 | "response": "\n\n301 Moved Permanently\n\n

Moved Permanently

\n

The document has moved here.

\n\n", 392 | "rawHeaders": [ 393 | "Date", 394 | "Sat, 15 Apr 2017 10:14:48 GMT", 395 | "Server", 396 | "Apache", 397 | "Location", 398 | "https://ftp.ncbi.nlm.nih.gov/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_genomic.fna.gz", 399 | "Cache-Control", 400 | "max-age=31536000", 401 | "Expires", 402 | "Sun, 15 Apr 2018 10:14:48 GMT", 403 | "Content-Length", 404 | "331", 405 | "Connection", 406 | "close", 407 | "Content-Type", 408 | "text/html; charset=iso-8859-1" 409 | ] 410 | }, 411 | { 412 | "scope": "https://ftp.ncbi.nlm.nih.gov:443", 413 | "method": "GET", 414 | "path": "/genomes/all/GCF/000/010/365/GCF_000010365.1_ASM1036v1/GCF_000010365.1_ASM1036v1_genomic.fna.gz", 415 | "body": "", 416 | "status": 200, 417 | "response": "", 418 | "rawHeaders": [ 419 | "Date", 420 | "Sat, 15 Apr 2017 10:14:49 GMT", 421 | "Server", 422 | "Apache", 423 | "Strict-Transport-Security", 424 | "max-age=31536000; includeSubDomains; preload", 425 | "Last-Modified", 426 | "Sat, 21 Mar 2015 05:16:09 GMT", 427 | "Accept-Ranges", 428 | "bytes", 429 | "Content-Length", 430 | "42224", 431 | "Cache-Control", 432 | "max-age=31536000", 433 | "Expires", 434 | "Sun, 15 Apr 2018 10:14:49 GMT", 435 | "Connection", 436 | "close", 437 | "Content-Type", 438 | "application/x-gzip" 439 | ] 440 | } 441 | ] -------------------------------------------------------------------------------- /lib/bionode-ncbi.js: -------------------------------------------------------------------------------- 1 | // # bionode-ncbi 2 | // > Node.js module for working with the NCBI API (aka e-utils) using Streams. 3 | // > 4 | // > doi: [10.5281/zenodo.10610](https://doi.org/10.5281/zenodo.10610) 5 | // > author: [Bruno Vieira](http://bmpvieira.com) 6 | // > email: 7 | // > license: [MIT](https://raw.githubusercontent.com/bionode/bionode-ncbi/master/LICENSE) 8 | // 9 | // --- 10 | // 11 | // ## Usage 12 | // This module can be used in Node.js as described further below, or as a command line tool. 13 | // Examples: 14 | // 15 | // $ npm install -g bionode-ncbi 16 | // 17 | // # bionode-ncbi [command] [arguments] --limit (-l) --throughput (-t) --pretty (-p) 18 | // $ bionode-ncbi search taxonomy solenopsis 19 | // $ bionode-ncbi search sra human --limit 500 # only return 500 items 20 | // $ bionode-ncbi search sra human --throughput 250 # fetch 250 items per API request 21 | // $ bionode-ncbi download assembly solenopsis invicta --pretty # returns a simple progress bar to stdout 22 | // $ bionode-ncbi urls sra solenopsis invicta 23 | // $ bionode-ncbi link assembly bioproject 244018 24 | // $ bionode-ncbi search gds solenopsis | dat import --json 25 | 26 | var fs = require('fs') 27 | var path = require('path') 28 | var mkdirp = require('mkdirp') 29 | var async = require('async') 30 | var request = require('request') 31 | var through = require('through2') 32 | var xml2js = require('xml2js').parseString 33 | var nugget = require('nugget') 34 | var tool = require('tool-stream') 35 | var debug = require('debug')('bionode-ncbi') 36 | var concat = require('concat-stream') 37 | var pumpify = require('pumpify') 38 | var URL = require('url') 39 | var cheerio = require('cheerio') 40 | var fasta = require('bionode-fasta') 41 | var insight = require('./anonymous-tracking') 42 | 43 | var validDbs = require('./valid-dbs') 44 | var InvalidDbError = validDbs.InvalidDbError 45 | 46 | var ncbi = exports 47 | 48 | var PROXY = typeof window !== 'undefined' ? 'http://cors.inb.io/' : '' 49 | 50 | var APIROOT = PROXY + 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/' 51 | var DEFAULTS = 'retmode=json&version=2.0' 52 | var RETURNMAX = 50 53 | var XMLPROPERTIES = { 54 | 'sra': ['expxml', 'runs'], 55 | 'biosample': ['sampledata'], 56 | 'assembly': ['meta'] 57 | } 58 | var LASTSTREAM = { 59 | 'sra': function () { 60 | return pumpify.obj( 61 | tool.ensureIsArray('runs.Run'), 62 | tool.filterObjectsArray('total_bases', '', 'runs.Run') 63 | ) 64 | } 65 | } 66 | 67 | // ## Search 68 | // Takes a NCBI database string and a optional search term and returns a stream of objects found: 69 | // 70 | // ncbi.search('sra', 'solenopsis').on('data', console.log) 71 | // => { uid: '280116', 72 | // expxml: {"Summary":{"Title":"Single Solenopsis invicta male","Platform":{"_":"ILLUMINA", [...], 73 | // runs: {"Run":[{"acc":"SRR620577","total_spots":"23699662","total_bases":"4787331724", [...], 74 | // extlinks: ' ', 75 | // createdate: '2013/02/07', 76 | // updatedate: '2012/11/28' } 77 | // => { uid: '280243', 78 | // expxml: {"Summary":{"Title":"Illumina small-insert paired end","Platform":{"_":"ILLUMINA", [...], 79 | // runs: {"Run":[{"acc":"SRR621118","total_spots":"343209818","total_bases":"34320981800", [...], 80 | // extlinks: ' ', 81 | // createdate: '2013/02/07, 82 | // updatedate: '2012/11/28' } 83 | // => [...] 84 | // 85 | // Arguments can be passed as an object instead: 86 | // 87 | // ncbi.search({ db: 'sra', term: 'solenopsis' }) 88 | // .on('data', console.log) 89 | // 90 | // Advanced options can be passed using the previous syntax: 91 | // 92 | // var options = { 93 | // db: 'assembly', // database to search 94 | // term: 'human', // optional term for search 95 | // limit: 500, // optional limit of NCBI results 96 | // throughput: 100 // optional number of items per request 97 | // } 98 | // 99 | // The search term can also be passed with write: 100 | // 101 | // var search = ncbi.search('sra').on('data', console.log) 102 | // search.write('solenopsis') 103 | // 104 | // Or piped, for example, from a file: 105 | // 106 | // var split = require('split') 107 | // 108 | // fs.createReadStream('searchTerms.txt') 109 | // .pipe(split()) 110 | // .pipe(search) 111 | 112 | ncbi.search = function (db, term, cb) { 113 | insight.track('ncbi', 'search') 114 | var opts = typeof db === 'string' ? { db, term } : db 115 | cb = typeof term === 'function' ? term : cb 116 | 117 | if (Object.keys(validDbs.dbs).indexOf(opts.db) < 0) { 118 | throw new InvalidDbError('The database "' + opts.db + '" is not a valid ncbi database') 119 | } 120 | 121 | var stream = pumpify.obj( 122 | createAPISearchUrl(opts.db, opts.term), 123 | requestStream(true), 124 | createAPIPaginateURL(opts), 125 | requestStream(true), 126 | createAPIDataUrl(), 127 | fetchByID(opts.db) 128 | ) 129 | 130 | if (opts.term) { stream.write(opts.term); stream.end() } 131 | if (cb) { stream.pipe(concat(cb)) } else { return stream } 132 | } 133 | 134 | function createAPISearchUrl (db, term) { 135 | var stream = through.obj(transform) 136 | return stream 137 | 138 | function transform (obj, enc, next) { 139 | var query = [ 140 | APIROOT + 'esearch.fcgi?', 141 | DEFAULTS, 142 | 'db=' + db, 143 | 'term=' + encodeURI(obj.toString().replace(/['"]+/g, '')), 144 | 'usehistory=y' 145 | ].join('&') 146 | debug('esearch request', query) 147 | this.push(query) 148 | next() 149 | } 150 | } 151 | 152 | function createAPIPaginateURL (opts) { 153 | var throughput = opts.throughput || RETURNMAX 154 | if (opts.limit < throughput) { throughput = opts.limit } 155 | var stream = through.obj(transform) 156 | return stream 157 | 158 | function transform (obj, enc, next) { 159 | var esearchRes = obj.body.esearchresult 160 | if (esearchRes === undefined || 161 | esearchRes.webenv === undefined || 162 | esearchRes.count === undefined) { 163 | var msg = 'NCBI returned invalid results, this could be a temporary' + 164 | ' issue with NCBI servers.\nRequest URL: ' + obj.url 165 | this.emit('error', new Error(msg)) 166 | return next() 167 | } 168 | var count = opts.limit || esearchRes.count 169 | if (parseInt(esearchRes.count, 10) === 1) { 170 | this.push(obj.url) 171 | return next() 172 | } 173 | var urlQuery = URL.parse(obj.url, true).query 174 | var numRequests = Math.ceil(count / throughput) 175 | for (var i = 0; i < numRequests; i++) { 176 | var retstart = i * throughput 177 | var query = [ 178 | APIROOT + 'esearch.fcgi?', 179 | DEFAULTS, 180 | 'db=' + urlQuery.db, 181 | 'term=' + urlQuery.term, 182 | 'query_key=1', 183 | 'WebEnv=' + esearchRes.webenv, 184 | 'retmax=' + throughput, 185 | 'retstart=' + retstart 186 | ].join('&') 187 | debug('paginate request', query) 188 | this.push(query) 189 | } 190 | next() 191 | } 192 | } 193 | 194 | function createAPIDataUrl () { 195 | var stream = through.obj(transform) 196 | return stream 197 | 198 | function transform (obj, enc, next) { 199 | var idsChunkLen = 50 200 | var idlist = obj.body.esearchresult.idlist 201 | if (!idlist || idlist.length === 0) { return next() } 202 | for (var i = 0; i < idlist.length; i += idsChunkLen) { 203 | var idsChunk = idlist.slice(i, i + idsChunkLen) 204 | var urlQuery = URL.parse(obj.url, true).query 205 | var query = [ 206 | APIROOT + 'esummary.fcgi?', 207 | DEFAULTS, 208 | 'db=' + urlQuery.db, 209 | 'id=' + idsChunk.join(','), 210 | 'usehistory=y' 211 | ].join('&') 212 | debug('esummary request', query) 213 | this.push(query) 214 | } 215 | next() 216 | } 217 | } 218 | 219 | function fetchByID (db) { 220 | var xmlProperties = XMLPROPERTIES[db] || through.obj() 221 | var lastStream = LASTSTREAM[db] || through.obj 222 | var stream = pumpify.obj( 223 | requestStream(true), 224 | tool.extractProperty('body.result'), 225 | tool.deleteProperty('uids'), 226 | tool.arraySplit(), 227 | tool.XMLToJSProperties(xmlProperties), 228 | lastStream() 229 | ) 230 | return stream 231 | } 232 | 233 | // ## Link 234 | // Takes a string for source NCBI database and another for destination db and returns 235 | // a objects stream with unique IDs linked to the passed source db unique ID. 236 | // 237 | // ncbi.link('taxonomy', 'sra', 443821) 238 | // => { "srcDB":"taxonomy", 239 | // "destDB":"sra", 240 | // "srcUID":"443821", 241 | // 242 | // "destUID":"677548" } 243 | // => { "srcDB":"taxonomy", 244 | // "destDB":"sra", 245 | // "srcUID":"443821", 246 | // "destUID":"677547" } 247 | // => [...] 248 | // 249 | // Also works with write and pipe, like **Search**. 250 | 251 | ncbi.link = function (srcDB, destDB, srcUID, cb) { 252 | insight.track('ncbi', 'link') 253 | var opts = typeof srcDB === 'string' ? { srcDB, destDB, srcUID } : srcDB 254 | var stream = pumpify.obj( 255 | createAPILinkURL(opts.srcDB, opts.destDB), 256 | requestStream(true), 257 | createLinkObj() 258 | ) 259 | 260 | if (opts.srcUID) { stream.write(opts.srcUID); stream.end() } 261 | if (cb) { stream.on('data', cb) } else { return stream } 262 | } 263 | 264 | function createAPILinkURL (srcDB, destDB) { 265 | var stream = through.obj(transform) 266 | if (srcDB === 'tax') { srcDB = 'taxonomy' } 267 | return stream 268 | 269 | function transform (obj, enc, next) { 270 | var query = [ 271 | APIROOT + 'elink.fcgi?', 272 | 'dbfrom=' + srcDB, 273 | 'db=' + destDB, 274 | 'id=' + obj.toString() 275 | ].join('&') 276 | this.push(query) 277 | next() 278 | } 279 | } 280 | 281 | function createLinkObj () { 282 | var stream = through.obj(transform) 283 | return stream 284 | 285 | function transform (obj, enc, next) { 286 | var self = this 287 | var query = URL.parse(obj.url, true).query 288 | var result = { 289 | srcDB: query.dbfrom, 290 | destDB: query.db, 291 | srcUID: query.id 292 | } 293 | xml2js(obj.body, gotParsed) 294 | function gotParsed (err, data) { 295 | if (err) { self.emit('error', err); return next() } 296 | if (!data.eLinkResult.LinkSet[0].LinkSetDb) { return next() } 297 | data.eLinkResult.LinkSet[0].LinkSetDb.forEach(getMatch) 298 | self.push(result) 299 | next() 300 | } 301 | function getMatch (link) { 302 | var linkName = query.dbfrom + '_' + query.db 303 | if (link.LinkName[0] !== linkName) { return } 304 | var destUIDs = [] 305 | link.Link.forEach(getLink) 306 | function getLink (link) { destUIDs.push(link.Id[0]) } 307 | result.destUIDs = destUIDs 308 | } 309 | } 310 | } 311 | 312 | // ## Property link (Plink) 313 | // Similar to Link but takes the srcID from a property of the Streamed object 314 | // and attaches the result to a property with the name of the destination DB. 315 | // 316 | // ncbi.search('genome', 'arthropoda') 317 | // .pipe(ncbi.expand('tax')) 318 | // .pipe(ncbi.plink('tax', 'sra') 319 | 320 | ncbi.plink = function (property, destDB) { 321 | insight.track('ncbi', 'plink') 322 | 323 | var opts = typeof property === 'string' ? { property, destDB } : property 324 | 325 | var srcDB = opts.property.split('.').pop() 326 | var destProperty = opts.destDB + 'id' 327 | var stream = through.obj(transform) 328 | return stream 329 | 330 | function transform (obj, enc, next) { 331 | var self = this 332 | var id = tool.getValue(obj, opts.property + 'id') 333 | if (!id) { 334 | self.push(obj) 335 | return next() 336 | } 337 | if (!obj[destProperty]) { obj[destProperty] = [] } 338 | ncbi.link(srcDB, opts.destDB, id, gotData) 339 | function gotData (data) { 340 | if (data.destUIDs) { obj[destProperty] = data.destUIDs } 341 | self.push(obj) 342 | next() 343 | } 344 | } 345 | } 346 | 347 | // ## Download 348 | // Takes a NCBI database string and a optional search term and downloads the datasets/sequence files. 349 | // ** Currently only supports sra and assembly databases. ** 350 | // Also accepts the keyword gff for annotations. 351 | // Returns a stream that emits download progress and ends with download path 352 | // The name of the folder where the file is saved corresponds to the UID from NCBI. 353 | // 354 | // ncbi.download('assembly', 'solenopsis invicta') 355 | // .on('data', console.log) 356 | // .on('end', function(path) { 357 | // console.log('File saved at ' + path) 358 | // } 359 | // => Downloading 244018/unplaced.scaf.fa.gz 0.94 % of 106 MB at 0.48 MB/s 360 | // => Downloading 244018/unplaced.scaf.fa.gz 100.00 % of 106 MB at 0.49 MB/s" 361 | // => File saved at 244018/unplaced.scaf.fa.gz 362 | 363 | ncbi.download = function (db, term, cb) { 364 | insight.track('ncbi', 'download') 365 | 366 | var opts = typeof db === 'string' ? { db: db, term } : db 367 | opts.db = opts.db 368 | var stream = pumpify.obj( 369 | ncbi.urls(opts.db), 370 | download(opts) 371 | ) 372 | 373 | if (opts.term) { stream.write(opts.term); stream.end() } 374 | if (cb) { stream.pipe(concat(cb)) } else { return stream } 375 | } 376 | 377 | function download (db) { 378 | var stream = through.obj(transform) 379 | return stream 380 | 381 | function transform (obj, enc, next) { 382 | var self = this 383 | var folder = obj.uid + '/' 384 | 385 | var extractFiles = { 386 | 'sra': function () { return obj.url }, 387 | 'gff': function () { return obj.genomic.gff }, 388 | 'gbff': function () { return obj.genomic.gbff }, 389 | 'gpff': function () { return obj.protein.gpff }, 390 | 'assembly': function () { return obj.genomic.fna }, 391 | 'fasta': function () { return obj.genomic.fna }, 392 | 'fna': function () { return obj.genomic.fna }, 393 | 'faa': function () { return obj.protein.faa }, 394 | 'repeats': function () { return obj.rm.out }, 395 | 'md5': function () { return obj.md5checksums.txt } 396 | } 397 | 398 | // added opts.db definition here since it is a local variable in ncbi.urls 399 | var opts = typeof db === 'string' ? { db } : db 400 | 401 | var url = extractFiles[opts.db]() 402 | 403 | var path = folder + url.replace(/.*\//, '') 404 | 405 | var log = { 406 | uid: obj.uid, 407 | url: url, 408 | path: path 409 | } 410 | 411 | mkdirp(obj.uid, {mode: '0755'}, gotDir) 412 | function gotDir (err) { 413 | if (err) { self.emit('error', err) } 414 | debug('downloading', url) 415 | var options 416 | if (opts.pretty === true) { 417 | if (fs.existsSync(path)) { 418 | console.log('File already exists in: ' + path + '\n') 419 | options = { dir: folder, resume: true, quiet: true } 420 | } else { 421 | options = { dir: folder, resume: true, quiet: false } 422 | } 423 | } else { 424 | options = { dir: folder, resume: true, quiet: true } 425 | } 426 | var dld = nugget(PROXY + url, options, function (err) { 427 | if (err) return self.destroy(err) 428 | fs.stat(path, gotStat) 429 | function gotStat (err, stat) { 430 | if (err) return self.destroy(err) 431 | log.status = 'completed' 432 | log.speed = 'NA' 433 | log.size = Math.round(stat.size / 1024 / 1024) + ' MB' 434 | self.push(log) 435 | next() 436 | } 437 | }) 438 | if (opts.pretty !== true) { 439 | dld.on('progress', logging) 440 | } 441 | } 442 | 443 | function logging (data) { 444 | log.status = 'downloading' 445 | log.total = data.transferred 446 | log.progress = data.percentage 447 | log.speed = data.speed 448 | self.push(log) 449 | } 450 | } 451 | } 452 | 453 | // ## URLs 454 | // Takes a NCBI database string and a optional search term and returns as stream of dataset/sequence files URLs. 455 | // ** Currently only supports sra and assembly databases. ** 456 | // Also accepts the keyword gff for annotations. 457 | // The value of the uid property corresponds to the UID from NCBI. 458 | // 459 | // ncbi.urls('assembly', 'solenopsis invicta') 460 | // .on('data', console.log) 461 | // => {"url":"http://ftp.ncbi.nlm.nih.gov/genbank/genomes/Eukaryotes/invertebrates/Solenopsis_invicta/Si_gnG/Primary_Assembly/unplaced_scaffolds/FASTA/unplaced.scaf.fa.gz", 462 | // "uid":"244018/"} 463 | 464 | ncbi.urls = function (db, term, cb) { 465 | insight.track('ncbi', 'urls') 466 | var opts = typeof db === 'string' ? { db } : db 467 | cb = typeof term === 'function' ? term : cb 468 | var extractFiles = ['gff', 'gpff', 'fasta', 'fna', 'faa', 'repeats'] 469 | if (extractFiles.indexOf(db) !== -1) { opts.db = 'assembly' } 470 | 471 | var stream = pumpify.obj( 472 | ncbi.search(opts), 473 | createFTPURL(opts.db) 474 | ) 475 | if (term) { stream.write(term); stream.end() } 476 | if (cb) { stream.pipe(concat(cb)) } else { return stream } 477 | } 478 | 479 | function createFTPURL (db) { 480 | var stream = through.obj(transform) 481 | return stream 482 | 483 | function transform (obj, enc, next) { 484 | var self = this 485 | var parseURL = { 486 | sra: sraURL, 487 | assembly: assemblyURL 488 | } 489 | 490 | parseURL[db]() 491 | 492 | function sraURL () { 493 | var runs = obj.runs.Run 494 | async.eachSeries(runs, printSRAURL, next) 495 | function printSRAURL (run, cb) { 496 | var acc = run.acc 497 | var runURL = [ 498 | 'http://ftp.ncbi.nlm.nih.gov/sra/sra-instant/reads/ByRun/sra/', 499 | acc.slice(0, 3) + '/', 500 | acc.slice(0, 6) + '/', 501 | acc + '/', 502 | acc + '.sra' 503 | ].join('') 504 | self.push({url: runURL, uid: obj.uid}) 505 | cb() 506 | } 507 | } 508 | 509 | function assemblyURL () { 510 | if (obj.meta.FtpSites) { 511 | var ftpPath = obj.meta.FtpSites.FtpPath 512 | var ftpArray = Array.isArray(ftpPath) ? ftpPath : [ ftpPath ] 513 | // NCBI seems to return GenBank and RefSeq accessions for the same thing. We only need one. 514 | var httpRoot = ftpArray[0]._ 515 | .replace('ftp://', 'http://') 516 | .split('/').slice(0, -1).join('/') 517 | request({ uri: PROXY + httpRoot, withCredentials: false }, gotFTPDir) 518 | } else { return next() } 519 | function gotFTPDir (err, res, body) { 520 | if (err) { self.emit('error', err) } 521 | if (!res || res.statusCode !== 200) { self.emit('err', res) } 522 | if (!body) { return next() } 523 | var $ = cheerio.load(body) 524 | 525 | var urls = { uid: obj.uid } 526 | 527 | $('a').map(attachToResult) 528 | function attachToResult (i, a) { 529 | var href = a.attribs.href 530 | var base = path.basename(href) 531 | var basename = path.basename(httpRoot) 532 | var fileNameProperties = base.replace(new RegExp('.*' + basename + '_'), '') 533 | var fileNameExtensions = fileNameProperties.split('.') 534 | var fileType = fileNameExtensions[0] 535 | var fileFormat = fileNameExtensions[1] || 'dir' 536 | if (!urls[fileType]) { urls[fileType] = {} } 537 | urls[fileType][fileFormat] = httpRoot + '/' + href 538 | } 539 | self.push(urls) 540 | next() 541 | } 542 | } 543 | } 544 | } 545 | 546 | function requestStream (returnURL) { 547 | var timeout = 15000 548 | var interval = 0 549 | var stream = through.obj(transform) 550 | return stream 551 | 552 | function transform (obj, enc, next) { 553 | var self = this 554 | get() 555 | self.tries = 1 556 | function get () { 557 | if (self.tries > 9) { 558 | self.emit('error', new Error( 559 | `Query failed after ${self.tries} tries, maybe a term or network issue? 560 | This is what failed: ${obj}`) 561 | ) 562 | } 563 | request({ uri: obj, json: true, timeout: timeout, withCredentials: false }, gotData) 564 | function gotData (err, res, body) { 565 | if (err || 566 | !res || 567 | res.statusCode !== 200 || 568 | !body || 569 | (body.esearchresult && body.esearchresult.ERROR) || 570 | (body.esummaryresult && body.esummaryresult[0] === 'Unable to obtain query #1') || 571 | body.error 572 | ) { 573 | self.tries++ 574 | return setTimeout(get, interval) 575 | } 576 | debug('request response', res.statusCode) 577 | debug('request results', body) 578 | var result = returnURL ? {url: obj, body: body} : body 579 | self.push(result) 580 | setTimeout(next, interval) 581 | } 582 | } 583 | } 584 | } 585 | 586 | // ## Expand 587 | // Takes a property (e.g., biosample) and optional destination property 588 | // (e.g., sample) and looks for a field named property+id (biosampleid) 589 | // in the Streamed object. Then it will do a ncbi.search for that id and save 590 | // the result under Streamed object.property. 591 | // 592 | // ncbi.search('genome', 'arthropoda').pipe(ncbi.expand('assembly')) 593 | 594 | ncbi.expand = function (property, destProperty) { 595 | insight.track('ncbi', 'expand') 596 | var opts = typeof property === 'string' ? { property, destProperty } : property 597 | opts.destProperty = opts.destProperty || opts.property 598 | var db = opts.property.split('.').pop() 599 | if (db === 'tax') { db = 'taxonomy' } 600 | 601 | var stream = through.obj(transform) 602 | return stream 603 | 604 | function transform (obj, enc, next) { 605 | var self = this 606 | var ids = tool.getValue(obj, opts.property + 'id') 607 | if (!ids) { 608 | self.push(obj) 609 | return next() 610 | } 611 | 612 | // Taxonomy doesn't work just with ID number 613 | if (db === 'taxonomy') { ids = ids + '[uid]' } 614 | 615 | if (Array.isArray(ids)) { 616 | async.map(ids, search, gotData) 617 | } else { 618 | search(ids, gotData) 619 | } 620 | 621 | function search (term, cb) { 622 | var stream = ncbi.search(db) 623 | stream.write(term) 624 | stream.on('data', function (data) { cb(null, data) }) 625 | stream.on('end', next) 626 | } 627 | 628 | function gotData (err, data) { 629 | if (err) { throw new Error(err) } 630 | obj[opts.destProperty] = data 631 | self.push(obj) 632 | next() 633 | } 634 | } 635 | } 636 | 637 | // ## Fetch 638 | // Allows retrieval of records from NCBI databases. Takes the database name and a search term, 639 | // and returns the records from the database that match the search term. There are optional 640 | // advanced parameters that allow you to define how many records to retrieve and extra options 641 | // for genes. These parameters should be passed as an object. 642 | // 643 | // It can return a subset of a genetic sequence of a requested species 644 | // 645 | // ncbi.fetch('sra', 'solenopsis_invicta') 646 | // => {"EXPERIMENT_PACKAGE_SET": 647 | // {"EXPERIMENT_PACKAGE": 648 | // [{"EXPERIMENT": 649 | // [{"$":{"xmlns":"","alias":"Me","accession":"SRX757228, 650 | // ... 651 | // 652 | // With advanced optional parameters: 653 | // 654 | // var opts = { 655 | // db: 'nucest', 656 | // term: 'guillardia_theta', 657 | // strand: 1, 658 | // complexity: 4, 659 | // seq_start: 1, 660 | // seq_stop: 50 661 | // } 662 | // 663 | // ncbi.fetch(opts) 664 | // => { id: 'gi|557436392|gb|HE992975.1|HE992975:1-50 HE992975 Guillardia theta CCMP 327 Guillardia theta cDNA clone sg-p_014_h06, mRNA sequence', 665 | // seq: 'GAAGGCGATTCCAATGGTGCGAGCGAGGCAGCGAACAGACGCAGCGGGGA' } 666 | // { id: 'gi|557436391|gb|HE992974.1|HE992974:1-50 HE992974 Guillardia theta CCMP 327 Guillardia theta cDNA clone sg-p_014_h05, mRNA sequence', 667 | // seq: 'GTCGCGGTTGGCATGGCTGAGGAGAATCCGATCCCTCGGCTAGACGCCTG' } 668 | // => [...] 669 | // For some databases there are multiple return types. A default one will be chosen 670 | // automatically, however it is possible to specify this via the rettype option. 671 | // 672 | // The NCBI website provides a list of databasese supported by efetch here: 673 | // http://www.ncbi.nlm.nih.gov/books/NBK25497/table/chapter2.T._entrez_unique_identifiers_ui/?report=objectonly 674 | 675 | ncbi.fetch = function (db, term, cb) { 676 | insight.track('ncbi', 'fetch') 677 | var opts = typeof db === 'string' ? { db: db, term: term } : db 678 | cb = typeof term === 'function' ? term : cb 679 | 680 | var rettypes = { 681 | bioproject: 'xml', 682 | biosample: 'full', 683 | biosystems: 'xml', 684 | gds: 'summary', 685 | gene: '', 686 | homologene: 'fasta', 687 | mesh: 'full', 688 | nlmcatalog: 'xml', 689 | nuccore: 'fasta', 690 | nucest: 'fasta', 691 | nucgss: 'fasta', 692 | protein: 'fasta', 693 | popset: 'fasta', 694 | pmc: '', 695 | pubmed: '', 696 | snp: 'fasta', 697 | sra: 'full', 698 | taxonomy: '' 699 | } 700 | 701 | var retmodes = { 702 | fasta: 'fasta', 703 | 'native': 'xml', 704 | full: 'xml', 705 | xml: 'xml', 706 | '': 'xml', 707 | 'asn.1': 'asn.1' 708 | } 709 | 710 | opts.rettype = opts.rettype || rettypes[opts.db] 711 | opts.retmode = retmodes[opts.rettype] || 'text' 712 | 713 | var stream = pumpify.obj( 714 | createAPISearchUrl(opts.db, opts.term), 715 | requestStream(true), 716 | createAPIPaginateURL(opts), 717 | requestStream(true), 718 | createAPIFetchUrl(opts, stringifyExtras(opts)), 719 | parseResult(opts.retmode) 720 | ) 721 | 722 | if (opts.term) { stream.write(opts.term); stream.end() } 723 | if (cb) { stream.pipe(concat(cb)) } else { return stream } 724 | } 725 | 726 | function stringifyExtras (opts) { 727 | var extraOptsLine = '' 728 | 729 | for (var k in opts) { 730 | if ((k !== 'term') && (k !== 'db')) { 731 | extraOptsLine += k + '=' + opts[k] + '&' 732 | } 733 | } 734 | 735 | return extraOptsLine.slice(0, -1) 736 | } 737 | 738 | function createAPIFetchUrl (opts, extraOpts) { 739 | var stream = through.obj(transform) 740 | return stream 741 | 742 | function transform (obj, enc, next) { 743 | var idsChunkLen = 50 744 | var idlist = obj.body.esearchresult.idlist 745 | if (!idlist || idlist.length === 0) { return next() } 746 | for (var i = 0; i < idlist.length; i += idsChunkLen) { 747 | var idsChunk = idlist.slice(i, i + idsChunkLen) 748 | var urlQuery = URL.parse(obj.url, true).query 749 | var query = [ 750 | APIROOT + 'efetch.fcgi?', 751 | 'version=2.0', 752 | 'db=' + urlQuery.db, 753 | 'id=' + idsChunk.join(','), 754 | extraOpts, 755 | 'userhistory=y' 756 | ].join('&') 757 | debug('efetch request', query) 758 | this.push(query) 759 | } 760 | next() 761 | } 762 | } 763 | 764 | function parseResult (resFmt) { 765 | var lastStream = (resFmt === 'fasta') ? fasta.obj : through.obj 766 | 767 | var stream = pumpify.obj( 768 | requestStream('true'), 769 | preProcess(), 770 | lastStream() 771 | ) 772 | 773 | return stream 774 | 775 | function preProcess () { 776 | var stream = through.obj(transform) 777 | return stream 778 | 779 | function transform (chunk, enc, cb) { 780 | var self = this 781 | if (resFmt === 'xml') { 782 | xml2js(chunk.body, function (err, data) { 783 | if (err) { self.emit('error', err); return cb() } 784 | self.push(data) 785 | cb() 786 | }) 787 | } else if (resFmt === 'fasta') { 788 | self.push(chunk.body) 789 | cb() 790 | } else { 791 | self.push({result: chunk.body}) 792 | cb() 793 | } 794 | } 795 | } 796 | } 797 | --------------------------------------------------------------------------------