"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 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 fs_1 = __importDefault(require("fs")); const _1 = require("."); (() => __awaiter(void 0, void 0, void 0, function* () { const baseDir = '/home/thomas/Turbine-B/Data_2/RNAseqBWA/'; const rnaDBPath = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(n => '/home/thomas/NGS/ref/ncbi/RNA/human.' + n + '.rna.gbff'); const dirs = fs_1.default.readdirSync(baseDir); /*const allResults = [] for (const dir of dirs) { console.log(dir) const caseDir = baseDir + dir + '/' const proper = caseDir + 'bwa_mem_properly_on_human_NM.sorted.bam' const splitters = caseDir + 'bwa_mem_splitters_on_human_NM.sam' const discordants = caseDir + 'bwa_mem_discordants_on_human_NM.sam' const res = await analysisTranscript('NM_017617.5', proper, splitters, discordants, rnaDBPath) allResults.push({dir,res}) } await fs.promises.writeFile('test/frommAcc.json', JSON.stringify(allResults, null, 4))*/ const allCounts = []; for (const dir of dirs) { const r = yield (0, _1.openSam)(baseDir + dir + '/' + 'bwa_mem_properly_on_human_NM.sorted.bam', '', true); allCounts.push([dir, ...r].join('\t')); } console.log(allCounts); yield fs_1.default.promises.writeFile('test/allCounts.tsv', allCounts.join('\n')); /*const res = JSON.parse((await fs.promises.readFile('test/frommAcc.json')).toString()) const lines = [] console.log(res[0].dir); const txt = res.map((entry:any) => ([entry.dir,...entry.res.exons.reduce((p:any,c:any) => [...p, c.counts.all[0]],[])].join('\t'))).join('\n') await fs.promises.writeFile('test/CountsByExon.tsv', txt)*/ }))();