Thomas 3 lat temu
rodzic
commit
6867efa3b1
2 zmienionych plików z 21 dodań i 3 usunięć
  1. 11 2
      test.js
  2. 10 1
      test.ts

+ 11 - 2
test.js

@@ -8,8 +8,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
         step((generator = generator.apply(thisArg, _arguments || [])).next());
     });
 };
+var __importDefault = (this && this.__importDefault) || function (mod) {
+    return (mod && mod.__esModule) ? mod : { "default": mod };
+};
 Object.defineProperty(exports, "__esModule", { value: true });
-const _1 = require(".");
+const fs_1 = __importDefault(require("fs"));
 (() => __awaiter(void 0, void 0, void 0, function* () {
     // wget ftp://ftp.ncbi.nlm.nih.gov/refseq/H_sapiens/RefSeqGene/LRG_RefSeqGene
     const LRGPath = '/home/thomas/NGS/ref/ncbi/LRG_RefSeqGene';
@@ -25,5 +28,11 @@ const _1 = require(".");
     // await makeRefSeqFromReg(rnaDBPath, /NM_/, '/home/thomas/NGS/ref/ncbi/RNA/human_NM.fa')
     // await makeRefSeqFromReg(rnaDBPath, /NM_/, 'test/human_NM.fa', 10)
     // const res = await getOffsets(rnaDBPath.map(e => e + '.jsi'), /NR_/)
-    const res = yield (0, _1.getData)(rnaDBPath, /NM_/, 'test/test-NM.json', '{"name": features[type="gene"].name, "accession": version}');
+    //const res = await getData(rnaDBPath, /NM_/, 'test/test-NM.json', '{"name": features[type="gene"].name, "accession": version}')
+    //const res = await getData(geneDBPath, /^NG_007458/, 'test/NOCTH1-gene.json')
+    // await fs.promises.writeFile('test/NOCTH1-gene.json', JSON.stringify(res, null , 4))
+    const txt = yield fs_1.default.promises.readFile('test/NOCTH1-gene.json');
+    const json = JSON.parse(txt.toString());
+    console.log(json[0].features.filter((f) => f.type !== 'variation'));
+    yield fs_1.default.promises.writeFile('test/gene-feat.json', JSON.stringify(json[0].features.filter((f) => f.type !== 'variation'), null, 4));
 }))();

+ 10 - 1
test.ts

@@ -18,7 +18,16 @@ import fs from 'fs'
     // await makeRefSeqFromReg(rnaDBPath, /NM_/, '/home/thomas/NGS/ref/ncbi/RNA/human_NM.fa')
     // await makeRefSeqFromReg(rnaDBPath, /NM_/, 'test/human_NM.fa', 10)
     // const res = await getOffsets(rnaDBPath.map(e => e + '.jsi'), /NR_/)
-    const res = await getData(rnaDBPath, /NM_/, 'test/test-NM.json', '{"name": features[type="gene"].name, "accession": version}')
+    //const res = await getData(rnaDBPath, /NM_/, 'test/test-NM.json', '{"name": features[type="gene"].name, "accession": version}')
+
+    //const res = await getData(geneDBPath, /^NG_007458/, 'test/NOCTH1-gene.json')
+    // await fs.promises.writeFile('test/NOCTH1-gene.json', JSON.stringify(res, null , 4))
+
+    const txt = await fs.promises.readFile('test/NOCTH1-gene.json')
+    const json = JSON.parse(txt.toString()) 
+    console.log(json[0].features.filter((f:any) => f.type !== 'variation'));
+    await fs.promises.writeFile('test/gene-feat.json', JSON.stringify(json[0].features.filter((f:any) => f.type !== 'variation'), null, 4))
+    
     
 })()