Thomas há 4 anos atrás
pai
commit
9f282445ab
4 ficheiros alterados com 12 adições e 12 exclusões
  1. 4 4
      index.js
  2. 4 4
      index.ts
  3. 2 2
      test.js
  4. 2 2
      test.ts

+ 4 - 4
index.js

@@ -160,13 +160,13 @@ const getInteractionsFromEntry = (json) => __awaiter(void 0, void 0, void 0, fun
         comment_subunits_genes = comment_subunits
             .flatMap((e) => e.replace(/ *\([^)]*\) */g, '').split(/\n/))
             .filter((e) => /Interacts/.test(e))
-            .flatMap((e) => e.match(/[A-Z][A-Z0-9]{2,}/g));
+            .flatMap((e) => e.match(/ [A-Z][A-Z0-9\-]{2,}/g));
     }
     let res = [...new Set([...genes_scope_inter, ...genes_interactant, ...comment_subunits_genes])].sort().filter((e) => typeof e === 'string').filter(_ => _);
     let filterOut = ['PHOSPHOSERINE', 'MOTIFS', 'INFECTION', 'PROTEIN', 'PROTEINS',
-        'MICROBIAL', 'VIRUS', 'HEPATITIS', 'HERPES', 'SIMPLEX', 'RELATED'];
+        'MICROBIAL', 'VIRUS', 'HEPATITIS', 'HERPES', 'SIMPLEX', 'RELATED', 'ARE-'];
     if (res.length > 0)
-        res = res.flatMap((e) => e.match(/[A-Z]{2,}[A-Z0-9]{1,}/g)).filter((e) => !(filterOut.includes(e)));
-    return res.filter(_ => _);
+        res = res.flatMap((e) => e.match(/[A-Z]{2,}[A-Z0-9\-]{1,}/g)).filter((e) => !(filterOut.includes(e))).filter((e) => !/-$/.test(e));
+    return [...new Set(res.filter(_ => _))];
 });
 exports.getInteractionsFromEntry = getInteractionsFromEntry;

+ 4 - 4
index.ts

@@ -119,16 +119,16 @@ const getInteractionsFromEntry = async (json:any) => {
         comment_subunits_genes = comment_subunits
         .flatMap((e:any) => e.replace(/ *\([^)]*\) */g, '').split(/\n/))
         .filter((e:any) => /Interacts/.test(e))
-        .flatMap((e:any) => e.match(/[A-Z][A-Z0-9]{2,}/g))
+        .flatMap((e:any) => e.match(/ [A-Z][A-Z0-9\-]{2,}/g))
     }
 
     let res = [...new Set([...genes_scope_inter, ...genes_interactant, ...comment_subunits_genes])].sort().filter((e:any) => typeof e === 'string').filter(_=>_)
     
     let filterOut = ['PHOSPHOSERINE', 'MOTIFS', 'INFECTION', 'PROTEIN', 'PROTEINS',
-    'MICROBIAL', 'VIRUS', 'HEPATITIS', 'HERPES', 'SIMPLEX', 'RELATED']
-    if(res.length > 0) res = res.flatMap((e:any) => e.match(/[A-Z]{2,}[A-Z0-9]{1,}/g)).filter((e:any) => !(filterOut.includes(e)))
+    'MICROBIAL', 'VIRUS', 'HEPATITIS', 'HERPES', 'SIMPLEX', 'RELATED', 'ARE-']
+    if(res.length > 0) res = res.flatMap((e:any) => e.match(/[A-Z]{2,}[A-Z0-9\-]{1,}/g)).filter((e:any) => !(filterOut.includes(e))).filter((e:any)=> !/-$/.test(e))
     
-    return res.filter(_=>_)
+    return [...new Set(res.filter(_=>_))]
 }
 
 // const findDistance = async (idmappingPath: string, dbPath:string, geneNameA:string, geneNameB:string, maxDistance = 6) => {

+ 2 - 2
test.js

@@ -22,8 +22,8 @@ const fs_1 = __importDefault(require("fs"));
     // const n = await getEntryFromGeneName(idmappingPath, uniprotDB, 'TTC23L')
     // await fs.promises.writeFile('test/test-CITED2.json', JSON.stringify(n, null, 4))
     // console.log(await getInteractionsFromEntry(n))
-    const n = yield (0, _1.getEntryFromGeneName)(idmappingPath, uniprotDB, 'PI3K');
-    yield fs_1.default.promises.writeFile('test/test-PI3K.json', JSON.stringify(n, null, 4));
+    const n = yield (0, _1.getEntryFromGeneName)(idmappingPath, uniprotDB, 'ZFP36L2');
+    yield fs_1.default.promises.writeFile('test/test-ZFP36L2.json', JSON.stringify(n, null, 4));
     const tmp = yield (0, _1.getInteractionsFromEntry)(n);
     console.log(tmp);
 }))();

+ 2 - 2
test.ts

@@ -11,8 +11,8 @@ import jsonata from 'jsonata'
     // await fs.promises.writeFile('test/test-CITED2.json', JSON.stringify(n, null, 4))
     // console.log(await getInteractionsFromEntry(n))
 
-    const n = await getEntryFromGeneName(idmappingPath, uniprotDB, 'PI3K')
-    await fs.promises.writeFile('test/test-PI3K.json', JSON.stringify(n, null, 4))
+    const n = await getEntryFromGeneName(idmappingPath, uniprotDB, 'ZFP36L2')
+    await fs.promises.writeFile('test/test-ZFP36L2.json', JSON.stringify(n, null, 4))
     const tmp = await getInteractionsFromEntry(n)
     console.log(tmp);    
 })()