index.ts 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. 'use strict'
  2. import path from "path"
  3. import Piscina from "piscina"
  4. (async()=>{
  5. const getEsearch = new Piscina({
  6. filename: path.resolve(__dirname, './workers/esearch.js')
  7. })
  8. // const orders =
  9. // [
  10. // {
  11. // params: {
  12. // db: 'nuccore',
  13. // term: 'NM_001143971.2'
  14. // },
  15. // xpath: 'string((//Id)[1])'
  16. // },
  17. // {
  18. // params: {
  19. // db: 'gene',
  20. // term: 'NM_001143971.2'
  21. // },
  22. // xpath: 'string((//Id)[1])'
  23. // },
  24. // ]
  25. // const results = await Promise.all(orders.map(e => getEsearch.run(e)))
  26. // console.log(results);
  27. const orders =
  28. [
  29. // {
  30. // params: {
  31. // db: 'nuccore',
  32. // id: '1674999401',
  33. // rettype: 'gb',
  34. // retmode: 'text'
  35. // },
  36. // xpath: '/',
  37. // endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi'
  38. // },
  39. // {
  40. // db: 'nuccore',
  41. // id: '1674999401',
  42. // rettype: 'native',
  43. // retmode: 'xml',
  44. // endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi'
  45. // },
  46. {
  47. db: 'pubmed',
  48. id: '19393038',
  49. retmode: 'xml',
  50. endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi',
  51. query: `**.AbstractText`
  52. },
  53. ]
  54. const results = await Promise.all(orders.map(e => getEsearch.run(e)))
  55. console.log(results);
  56. })()