Thomas 3 éve
szülő
commit
b4d606c392
5 módosított fájl, 318 hozzáadás és 245 törlés
  1. 74 119
      index.js
  2. 76 120
      index.ts
  3. 160 1
      test.json
  4. 4 1
      workers/esearch.js
  5. 4 4
      workers/esearch.ts

+ 74 - 119
index.js

@@ -12,127 +12,82 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
     return (mod && mod.__esModule) ? mod : { "default": mod };
 };
 Object.defineProperty(exports, "__esModule", { value: true });
+const fs_1 = __importDefault(require("fs"));
 const path_1 = __importDefault(require("path"));
 const piscina_1 = __importDefault(require("piscina"));
-(() => __awaiter(void 0, void 0, void 0, function* () {
-    const getEsearch = new piscina_1.default({
-        filename: path_1.default.resolve(__dirname, './workers/esearch.js')
-    });
-    // https://www.ncbi.nlm.nih.gov/books/NBK25499/
-    const orders = [
-        // {
-        //     params: {
-        //         db: 'nuccore',
-        //         id: '1674999401',
-        //         rettype: 'gb',
-        //         retmode: 'text'
-        //     },
-        //     xpath: '/',
-        //     endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi'
-        // },
-        // {
-        //     db: 'nuccore',
-        //     id: '1674999401',
-        //     rettype: 'native',
-        //     retmode: 'xml',
-        //     endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi'
-        // },
-        // {
-        //     term: 'NOTCH1 AND Human AND Refseq',
-        //     db: 'nuccore',
-        //     endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi',
-        //     query: `$..Id`
-        // },
-        // {
-        //     term: 'NOTCH1[Gene Name]+AND+Human',
-        //     db: 'gene',
-        //     endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi',
-        //     query: `$..Id` 
-        // },
-        // {
-        //     db: 'pubmed',
-        //     id: '19393038',
-        //     retmode: 'xml',
-        //     endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi',
-        //     //query: `$..AbstractText[?(@.Label==='RESULTS')]`
-        //     query: `$..AbstractText`
-        // },
-        {
-            db: 'gene',
-            id: '4851',
-            retmode: 'xml',
-            endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi',
-            query: [
-                `{ "Locus"           : **.Gene_ref_locus,
-                   "Synonyms"        : [**.Entrezgene_gene.**.Gene_ref_syn_E],
-                   "Update_Date"     : **.Gene_track_update_date.Date.Date_std.Date_std.{"Year": Date_std_year, "Month": Date_std_month, "Day": Date_std_month},
-                   "Location"        : **.Gene_ref_maploc,
-                   "Summary"         : **.Entrezgene_summary,
-                   "Genomic_Position": **.Entrezgene_locus.Gene_commentary[Gene_commentary_type.value='genomic'][0].{
-                       "Accession": Gene_commentary_accession,
-                       "Positions": $.{
-                           "from"  : Gene_commentary_seqs.**.Seq_interval_from,
-                           "to"    : Gene_commentary_seqs.**.Seq_interval_to,
-                           "strand": Gene_commentary_seqs.**.Na_strand.value
-                        }
-                    },
-                    "Gene_Ontology"  : **.Entrezgene_properties.Gene_commentary[Gene_commentary_heading='GeneOntology'].Gene_commentary_comment.{
-                        "Functions"  : Gene_commentary[Gene_commentary_label='Function'].Gene_commentary_comment.Gene_commentary.{
-                            "ID"      : Gene_commentary_source.Other_source.**.Object_id_id,
-                            "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
-                            "Anchor"  : Gene_commentary_source.Other_source.Other_source_anchor
-                        },
-                        "Processes"  : Gene_commentary[Gene_commentary_label='Process'].Gene_commentary_comment.Gene_commentary.{
-                            "ID"      : Gene_commentary_source.Other_source.**.Object_id_id,
-                            "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
-                            "Anchor"  : Gene_commentary_source.Other_source.Other_source_anchor
-                        },
-                        "Components"  : Gene_commentary[Gene_commentary_label='Component'].Gene_commentary_comment.Gene_commentary.{
-                            "ID"      : Gene_commentary_source.Other_source.**.Object_id_id,
-                            "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
-                            "Anchor"  : Gene_commentary_source.Other_source.Other_source_anchor
-                        }
-                    },
-                    "Transcript": {
-                        "Accession" : **.'Entrezgene_comments'.'Gene_commentary'[Gene_commentary_heading='NCBI Reference Sequences (RefSeq)'].**.Gene_commentary[Gene_commentary_heading='mRNA Sequence'][0].Gene_commentary_accession,
-                        "Exon_Count": **.'Entrezgene_properties'.'Gene_commentary'[Gene_commentary_label='Exon count'].Gene_commentary_text
+const NCBIGeneTemplate = (id) => {
+    return {
+        db: 'gene',
+        id,
+        retmode: 'xml',
+        endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi',
+        query: [
+            `{ "Locus"           : **.Gene_ref_locus,
+               "Update_Date"     : **.Gene_track_update_date.Date.Date_std.Date_std.{"Year": Date_std_year, "Month": Date_std_month, "Day": Date_std_month},
+               "Location"        : **.Gene_ref_maploc,
+               "Summary"         : **.Entrezgene_summary,
+               "Genomic_Position": **.Entrezgene_locus.Gene_commentary[Gene_commentary_type.value='genomic'][0].{
+                   "Accession": Gene_commentary_accession,
+                   "Positions": $.{
+                       "from"  : Gene_commentary_seqs.**.Seq_interval_from,
+                       "to"    : Gene_commentary_seqs.**.Seq_interval_to,
+                       "strand": Gene_commentary_seqs.**.Na_strand.value
+                    }
+                },
+                "Gene_Ontology"  : **.Entrezgene_properties.Gene_commentary[Gene_commentary_heading='GeneOntology'].Gene_commentary_comment.{
+                    "Functions"  : Gene_commentary[Gene_commentary_label='Function'].Gene_commentary_comment.Gene_commentary.{
+                        "ID"      : Gene_commentary_source.Other_source.**.Object_id_id,
+                        "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
+                        "Anchor"  : Gene_commentary_source.Other_source.Other_source_anchor
                     },
-                    "Products": **.'Entrezgene_comments'.'Gene_commentary'[Gene_commentary_heading='NCBI Reference Sequences (RefSeq)'].**.Gene_commentary[Gene_commentary_heading='mRNA Sequence'][0].Gene_commentary_products.Gene_commentary[Gene_commentary_heading='Product'][0].{
-                        "Accession": Gene_commentary_accession,
-                        "Domains"  : Gene_commentary_comment.Gene_commentary[Gene_commentary_heading='Conserved Domains'].Gene_commentary_comment.Gene_commentary.{
-                            "DB"      : Gene_commentary_source.**.Dbtag_db,
-                            "ID"      : Gene_commentary_source.**.Object_id_id,
-                            "Anchor"  : Gene_commentary_source.**.Other_source_anchor,
-                            "Location": Gene_commentary_comment.**.Gene_commentary_text
-                        }
+                    "Processes"  : Gene_commentary[Gene_commentary_label='Process'].Gene_commentary_comment.Gene_commentary.{
+                        "ID"      : Gene_commentary_source.Other_source.**.Object_id_id,
+                        "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
+                        "Anchor"  : Gene_commentary_source.Other_source.Other_source_anchor
                     },
-                    "Biblio_PMID": **.PubMedId
-                }`
-            ]
-        },
-        // {
-        //     db: 'gene',
-        //     id: '4851',
-        //     retmode: 'xml',
-        //     endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi',
-        //     //query: `$..AbstractText[?(@.Label==='RESULTS')]`
-        //     query: [
-        //         `$..Name`, 
-        //         `$..Description`, 
-        //         `$..MapLocation`, 
-        //         '$..OtherAliases',
-        //         `$..OtherDesignations`,
-        //         '$..ChrLoc',
-        //         `$..GenomicInfoType..ChrAccVer`,
-        //         '$..GenomicInfoType..ChrStart',
-        //         '$..GenomicInfoType..ChrStop',
-        //         '$..ExonCount',
-        //         '$..GeneWeight',
-        //         '$..Summary',
-        //     ]
-        // },
-    ];
-    const results = yield Promise.all(orders.map(e => getEsearch.run(e)));
-    console.log(orders.map((e, i) => (Object.assign(Object.assign({}, e), { results: results[i] })))[0].results.value);
-    // await fs.promises.writeFile('test.json',JSON.stringify(orders.map((e:any, i) => ({...e, results: results[i]})).map(e => e.results)[0]))
+                    "Components"  : Gene_commentary[Gene_commentary_label='Component'].Gene_commentary_comment.Gene_commentary.{
+                        "ID"      : Gene_commentary_source.Other_source.**.Object_id_id,
+                        "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
+                        "Anchor"  : Gene_commentary_source.Other_source.Other_source_anchor
+                    }
+                },
+                "Transcript": {
+                    "Accession" : **.'Entrezgene_comments'.'Gene_commentary'[Gene_commentary_heading='NCBI Reference Sequences (RefSeq)'].**.Gene_commentary[Gene_commentary_heading='mRNA Sequence'][0].Gene_commentary_accession,
+                    "Exon_Count": **.'Entrezgene_properties'.'Gene_commentary'[Gene_commentary_label='Exon count'].Gene_commentary_text
+                },
+                "Products": **.'Entrezgene_comments'.'Gene_commentary'[Gene_commentary_heading='NCBI Reference Sequences (RefSeq)'].**.Gene_commentary[Gene_commentary_heading='mRNA Sequence'][0].Gene_commentary_products.Gene_commentary[Gene_commentary_heading='Product'][0].{
+                    "Accession": Gene_commentary_accession,
+                    "Domains"  : Gene_commentary_comment.Gene_commentary[Gene_commentary_heading='Conserved Domains'].Gene_commentary_comment.Gene_commentary.{
+                        "DB"      : Gene_commentary_source.**.Dbtag_db,
+                        "ID"      : Gene_commentary_source.**.Object_id_id,
+                        "Anchor"  : Gene_commentary_source.**.Other_source_anchor,
+                        "Location": Gene_commentary_comment.**.Gene_commentary_text
+                    }
+                },
+                "Biblio_PMID": **.PubMedId
+            }`
+        ]
+    };
+};
+const searchGeneTemplate = (name) => {
+    return {
+        term: name + '[Gene Name]+AND+Human[Organism] ',
+        db: 'gene',
+        endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi',
+        query: `{"First_ID": **.Id[0]}`
+    };
+};
+const getEsearch = new piscina_1.default({
+    filename: path_1.default.resolve(__dirname, './workers/esearch.js')
+});
+const getGene = (name) => __awaiter(void 0, void 0, void 0, function* () {
+    const id = (yield Promise.all([searchGeneTemplate(name)].map(e => getEsearch.run(e))))[0].value.First_ID;
+    const result = (yield Promise.all([NCBIGeneTemplate(String(id))].map(e => getEsearch.run(e))))[0].value;
+    return result;
+});
+(() => __awaiter(void 0, void 0, void 0, function* () {
+    // https://www.ncbi.nlm.nih.gov/books/NBK25499/
+    const r = yield getGene('ZFP36L2');
+    console.log(r);
+    yield fs_1.default.promises.writeFile('test.json', JSON.stringify(r));
 }))();

+ 76 - 120
index.ts

@@ -4,127 +4,83 @@ import fs from "fs"
 import path from "path"
 import Piscina from "piscina"
 
-(async()=>{
-    const getEsearch = new Piscina({
-        filename: path.resolve(__dirname, './workers/esearch.js')
-    })
-
-    // https://www.ncbi.nlm.nih.gov/books/NBK25499/
-    const orders =
-    [
-        // {
-        //     params: {
-        //         db: 'nuccore',
-        //         id: '1674999401',
-        //         rettype: 'gb',
-        //         retmode: 'text'
-        //     },
-        //     xpath: '/',
-        //     endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi'
-        // },
-        // {
-        //     db: 'nuccore',
-        //     id: '1674999401',
-        //     rettype: 'native',
-        //     retmode: 'xml',
-        //     endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi'
-        // },
-        // {
-        //     term: 'NOTCH1 AND Human AND Refseq',
-        //     db: 'nuccore',
-        //     endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi',
-        //     query: `$..Id`
-        // },
-        // {
-        //     term: 'NOTCH1[Gene Name]+AND+Human',
-        //     db: 'gene',
-        //     endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi',
-        //     query: `$..Id` 
-        // },
-        // {
-        //     db: 'pubmed',
-        //     id: '19393038',
-        //     retmode: 'xml',
-        //     endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi',
-        //     //query: `$..AbstractText[?(@.Label==='RESULTS')]`
-        //     query: `$..AbstractText`
-        // },
-        {
-            db: 'gene',
-            id: '4851',
-            retmode: 'xml',
-            endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi',
-            query: [
-                `{ "Locus"           : **.Gene_ref_locus,
-                   "Update_Date"     : **.Gene_track_update_date.Date.Date_std.Date_std.{"Year": Date_std_year, "Month": Date_std_month, "Day": Date_std_month},
-                   "Location"        : **.Gene_ref_maploc,
-                   "Summary"         : **.Entrezgene_summary,
-                   "Genomic_Position": **.Entrezgene_locus.Gene_commentary[Gene_commentary_type.value='genomic'][0].{
-                       "Accession": Gene_commentary_accession,
-                       "Positions": $.{
-                           "from"  : Gene_commentary_seqs.**.Seq_interval_from,
-                           "to"    : Gene_commentary_seqs.**.Seq_interval_to,
-                           "strand": Gene_commentary_seqs.**.Na_strand.value
-                        }
-                    },
-                    "Gene_Ontology"  : **.Entrezgene_properties.Gene_commentary[Gene_commentary_heading='GeneOntology'].Gene_commentary_comment.{
-                        "Functions"  : Gene_commentary[Gene_commentary_label='Function'].Gene_commentary_comment.Gene_commentary.{
-                            "ID"      : Gene_commentary_source.Other_source.**.Object_id_id,
-                            "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
-                            "Anchor"  : Gene_commentary_source.Other_source.Other_source_anchor
-                        },
-                        "Processes"  : Gene_commentary[Gene_commentary_label='Process'].Gene_commentary_comment.Gene_commentary.{
-                            "ID"      : Gene_commentary_source.Other_source.**.Object_id_id,
-                            "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
-                            "Anchor"  : Gene_commentary_source.Other_source.Other_source_anchor
-                        },
-                        "Components"  : Gene_commentary[Gene_commentary_label='Component'].Gene_commentary_comment.Gene_commentary.{
-                            "ID"      : Gene_commentary_source.Other_source.**.Object_id_id,
-                            "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
-                            "Anchor"  : Gene_commentary_source.Other_source.Other_source_anchor
-                        }
-                    },
-                    "Transcript": {
-                        "Accession" : **.'Entrezgene_comments'.'Gene_commentary'[Gene_commentary_heading='NCBI Reference Sequences (RefSeq)'].**.Gene_commentary[Gene_commentary_heading='mRNA Sequence'][0].Gene_commentary_accession,
-                        "Exon_Count": **.'Entrezgene_properties'.'Gene_commentary'[Gene_commentary_label='Exon count'].Gene_commentary_text
+const NCBIGeneTemplate = (id:string) => {
+    return {
+        db: 'gene',
+        id,
+        retmode: 'xml',
+        endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi',
+        query: [
+            `{ "Locus"           : **.Gene_ref_locus,
+               "Update_Date"     : **.Gene_track_update_date.Date.Date_std.Date_std.{"Year": Date_std_year, "Month": Date_std_month, "Day": Date_std_month},
+               "Location"        : **.Gene_ref_maploc,
+               "Summary"         : **.Entrezgene_summary,
+               "Genomic_Position": **.Entrezgene_locus.Gene_commentary[Gene_commentary_type.value='genomic'][0].{
+                   "Accession": Gene_commentary_accession,
+                   "Positions": $.{
+                       "from"  : Gene_commentary_seqs.**.Seq_interval_from,
+                       "to"    : Gene_commentary_seqs.**.Seq_interval_to,
+                       "strand": Gene_commentary_seqs.**.Na_strand.value
+                    }
+                },
+                "Gene_Ontology"  : **.Entrezgene_properties.Gene_commentary[Gene_commentary_heading='GeneOntology'].Gene_commentary_comment.{
+                    "Functions"  : Gene_commentary[Gene_commentary_label='Function'].Gene_commentary_comment.Gene_commentary.{
+                        "ID"      : Gene_commentary_source.Other_source.**.Object_id_id,
+                        "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
+                        "Anchor"  : Gene_commentary_source.Other_source.Other_source_anchor
                     },
-                    "Products": **.'Entrezgene_comments'.'Gene_commentary'[Gene_commentary_heading='NCBI Reference Sequences (RefSeq)'].**.Gene_commentary[Gene_commentary_heading='mRNA Sequence'][0].Gene_commentary_products.Gene_commentary[Gene_commentary_heading='Product'][0].{
-                        "Accession": Gene_commentary_accession,
-                        "Domains"  : Gene_commentary_comment.Gene_commentary[Gene_commentary_heading='Conserved Domains'].Gene_commentary_comment.Gene_commentary.{
-                            "DB"      : Gene_commentary_source.**.Dbtag_db,
-                            "ID"      : Gene_commentary_source.**.Object_id_id,
-                            "Anchor"  : Gene_commentary_source.**.Other_source_anchor,
-                            "Location": Gene_commentary_comment.**.Gene_commentary_text
-                        }
+                    "Processes"  : Gene_commentary[Gene_commentary_label='Process'].Gene_commentary_comment.Gene_commentary.{
+                        "ID"      : Gene_commentary_source.Other_source.**.Object_id_id,
+                        "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
+                        "Anchor"  : Gene_commentary_source.Other_source.Other_source_anchor
                     },
-                    "Biblio_PMID": **.PubMedId
-                }`
-            ]
-        },
-        // {
-        //     db: 'gene',
-        //     id: '4851',
-        //     retmode: 'xml',
-        //     endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi',
-        //     //query: `$..AbstractText[?(@.Label==='RESULTS')]`
-        //     query: [
-        //         `$..Name`, 
-        //         `$..Description`, 
-        //         `$..MapLocation`, 
-        //         '$..OtherAliases',
-        //         `$..OtherDesignations`,
-        //         '$..ChrLoc',
-        //         `$..GenomicInfoType..ChrAccVer`,
-        //         '$..GenomicInfoType..ChrStart',
-        //         '$..GenomicInfoType..ChrStop',
-        //         '$..ExonCount',
-        //         '$..GeneWeight',
-        //         '$..Summary',
-        //     ]
-        // },
+                    "Components"  : Gene_commentary[Gene_commentary_label='Component'].Gene_commentary_comment.Gene_commentary.{
+                        "ID"      : Gene_commentary_source.Other_source.**.Object_id_id,
+                        "Pre_Text": Gene_commentary_source.Other_source.Other_source_pre_text,
+                        "Anchor"  : Gene_commentary_source.Other_source.Other_source_anchor
+                    }
+                },
+                "Transcript": {
+                    "Accession" : **.'Entrezgene_comments'.'Gene_commentary'[Gene_commentary_heading='NCBI Reference Sequences (RefSeq)'].**.Gene_commentary[Gene_commentary_heading='mRNA Sequence'][0].Gene_commentary_accession,
+                    "Exon_Count": **.'Entrezgene_properties'.'Gene_commentary'[Gene_commentary_label='Exon count'].Gene_commentary_text
+                },
+                "Products": **.'Entrezgene_comments'.'Gene_commentary'[Gene_commentary_heading='NCBI Reference Sequences (RefSeq)'].**.Gene_commentary[Gene_commentary_heading='mRNA Sequence'][0].Gene_commentary_products.Gene_commentary[Gene_commentary_heading='Product'][0].{
+                    "Accession": Gene_commentary_accession,
+                    "Domains"  : Gene_commentary_comment.Gene_commentary[Gene_commentary_heading='Conserved Domains'].Gene_commentary_comment.Gene_commentary.{
+                        "DB"      : Gene_commentary_source.**.Dbtag_db,
+                        "ID"      : Gene_commentary_source.**.Object_id_id,
+                        "Anchor"  : Gene_commentary_source.**.Other_source_anchor,
+                        "Location": Gene_commentary_comment.**.Gene_commentary_text
+                    }
+                },
+                "Biblio_PMID": **.PubMedId
+            }`
+        ]
+    }
+}
 
-    ]
-    const results = await Promise.all(orders.map(e => getEsearch.run(e)))
-    console.log(orders.map((e:any, i) => ({...e, results: results[i]}))[0].results.value);
-    // await fs.promises.writeFile('test.json',JSON.stringify(orders.map((e:any, i) => ({...e, results: results[i]})).map(e => e.results)[0]))
+const searchGeneTemplate = (name:string) => {
+    return {
+        term: name + '[Gene Name]+AND+Human[Organism]',
+        db: 'gene',
+        endpoint: 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi',
+        query: `{"First_ID": **.Id[0]}` 
+    }
+}
+
+const getEsearch = new Piscina({
+    filename: path.resolve(__dirname, './workers/esearch.js')
+})
+
+const getGene = async (name:string) => {
+    const id = (await Promise.all([searchGeneTemplate(name)].map(e => getEsearch.run(e))))[0].value.First_ID
+    const result = (await Promise.all([NCBIGeneTemplate(String(id))].map(e => getEsearch.run(e))))[0].value
+    return result
+}
+
+(async()=>{
+    // https://www.ncbi.nlm.nih.gov/books/NBK25499/
+    const r = await getGene('ZFP36L2')
+    console.log(r)
+    await fs.promises.writeFile('test.json', JSON.stringify(r))
 })()

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 160 - 1
test.json


+ 4 - 1
workers/esearch.js

@@ -41,7 +41,7 @@ const renameKeys = (json) => {
     if (Array.isArray(json)) {
         return json.map(e => renameKeys(e));
     }
-    else {
+    else if (typeof json === 'object') {
         const newObj = {};
         Object.keys(json).map(key => {
             let tmp;
@@ -55,6 +55,9 @@ const renameKeys = (json) => {
         });
         return newObj;
     }
+    else {
+        return json;
+    }
 };
 const getEsearch = (params) => __awaiter(void 0, void 0, void 0, function* () {
     const endpoint = (params === null || params === void 0 ? void 0 : params.endpoint) ? params.endpoint : 'https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi';

+ 4 - 4
workers/esearch.ts

@@ -20,7 +20,7 @@ const simpleJSON = (json:any):any => {
 const renameKeys = (json:any):any => {
     if(Array.isArray(json)) {
         return json.map(e => renameKeys(e))
-    } else {
+    } else if (typeof json === 'object') {
         const newObj:any = {}
         Object.keys(json).map(key => {
             let tmp
@@ -32,6 +32,8 @@ const renameKeys = (json:any):any => {
             newObj[key.replace(/-/g,"_")] = tmp
         })
         return newObj
+    } else {
+        return json
     }
 }
 
@@ -90,12 +92,10 @@ const getEsearch = async (params: any) => {
                 break;
         }
     }
-
-
+    
     json = renameKeys(json)
     const results = []
     
-    
     for (const query of queries) {
         // https://www.npmjs.com/package/jsonpath-plus
         let result:any

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott