index.js 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. 'use strict';
  2. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
  3. function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
  4. return new (P || (P = Promise))(function (resolve, reject) {
  5. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  6. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  7. function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
  8. step((generator = generator.apply(thisArg, _arguments || [])).next());
  9. });
  10. };
  11. var __importDefault = (this && this.__importDefault) || function (mod) {
  12. return (mod && mod.__esModule) ? mod : { "default": mod };
  13. };
  14. Object.defineProperty(exports, "__esModule", { value: true });
  15. const path_1 = __importDefault(require("path"));
  16. const piscina_1 = __importDefault(require("piscina"));
  17. (() => __awaiter(void 0, void 0, void 0, function* () {
  18. const getEsearch = new piscina_1.default({
  19. filename: path_1.default.resolve(__dirname, './workers/esearch.js')
  20. });
  21. // const orders =
  22. // [
  23. // {
  24. // params: {
  25. // db: 'nuccore',
  26. // term: 'NM_001143971.2'
  27. // },
  28. // xpath: 'string((//Id)[1])'
  29. // },
  30. // {
  31. // params: {
  32. // db: 'gene',
  33. // term: 'NM_001143971.2'
  34. // },
  35. // xpath: 'string((//Id)[1])'
  36. // },
  37. // ]
  38. // const results = await Promise.all(orders.map(e => getEsearch.run(e)))
  39. // console.log(results);
  40. const orders = [
  41. // {
  42. // params: {
  43. // db: 'nuccore',
  44. // id: '1674999401',
  45. // rettype: 'gb',
  46. // retmode: 'text'
  47. // },
  48. // xpath: '/',
  49. // endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi'
  50. // },
  51. // {
  52. // db: 'nuccore',
  53. // id: '1674999401',
  54. // rettype: 'native',
  55. // retmode: 'xml',
  56. // endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi'
  57. // },
  58. {
  59. db: 'pubmed',
  60. id: '19393038',
  61. retmode: 'xml',
  62. endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi',
  63. query: `**.AbstractText`
  64. },
  65. ];
  66. const results = yield Promise.all(orders.map(e => getEsearch.run(e)));
  67. console.log(results);
  68. }))();