|
@@ -41,7 +41,7 @@ const isDone = (rsltDir) => {
|
|
|
}
|
|
}
|
|
|
return done;
|
|
return done;
|
|
|
};
|
|
};
|
|
|
-const denovoAssemblage = (reads, rnames, spadesPath) => {
|
|
|
|
|
|
|
+const denovoAssemblage = (reads, rnames, spadesPath, log) => {
|
|
|
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
return new Promise((resolve, reject) => __awaiter(void 0, void 0, void 0, function* () {
|
|
|
let readsIn = [];
|
|
let readsIn = [];
|
|
|
let isPairedEnd = false;
|
|
let isPairedEnd = false;
|
|
@@ -69,16 +69,16 @@ const denovoAssemblage = (reads, rnames, spadesPath) => {
|
|
|
isfq.push(R.match(/\.fq/) ? true : false);
|
|
isfq.push(R.match(/\.fq/) ? true : false);
|
|
|
const tmp = path_1.default.join(os_1.default.tmpdir(), (+new Date) + '_' + parsedPath.name + (isfq[isfq.length] ? '.fq' : '.fa'));
|
|
const tmp = path_1.default.join(os_1.default.tmpdir(), (+new Date) + '_' + parsedPath.name + (isfq[isfq.length] ? '.fq' : '.fa'));
|
|
|
tmpSubReads.push(tmp);
|
|
tmpSubReads.push(tmp);
|
|
|
- yield async_exec(greper, [rnamesSel, R, '-A3', '--no-group-separator', '>', tmp], console.log, console.log);
|
|
|
|
|
|
|
+ yield async_exec(greper, [rnamesSel, R, '-A3', '--no-group-separator', '>', tmp], log, log);
|
|
|
}
|
|
}
|
|
|
const correction = (isfq.filter(e => e).length !== isfq.length || isfq.filter(e => e).length === 0) ? '--only-assembler' : '';
|
|
const correction = (isfq.filter(e => e).length !== isfq.length || isfq.filter(e => e).length === 0) ? '--only-assembler' : '';
|
|
|
const args = isPairedEnd ? ['-1', tmpSubReads[0], '-2', tmpSubReads[1]] : ['-s', tmpSubReads[0]];
|
|
const args = isPairedEnd ? ['-1', tmpSubReads[0], '-2', tmpSubReads[1]] : ['-s', tmpSubReads[0]];
|
|
|
const rsltDir = path_1.default.join(os_1.default.tmpdir(), (+new Date) + '_spades');
|
|
const rsltDir = path_1.default.join(os_1.default.tmpdir(), (+new Date) + '_spades');
|
|
|
- yield async_exec(spadesPath, ['-t', threads, '--isolate', correction, ...args, '-o', rsltDir], console.log, console.log);
|
|
|
|
|
|
|
+ yield async_exec(spadesPath, ['-t', threads, '--isolate', correction, ...args, '-o', rsltDir], log, log);
|
|
|
if (!isDone(rsltDir) && isPairedEnd) {
|
|
if (!isDone(rsltDir) && isPairedEnd) {
|
|
|
yield rmList([rsltDir]);
|
|
yield rmList([rsltDir]);
|
|
|
console.log('Trying meta');
|
|
console.log('Trying meta');
|
|
|
- yield async_exec(spadesPath, ['-t', threads, '--meta', correction, ...args, '-o', rsltDir], console.log, console.log);
|
|
|
|
|
|
|
+ yield async_exec(spadesPath, ['-t', threads, '--meta', correction, ...args, '-o', rsltDir], log, log);
|
|
|
if (!isDone(rsltDir)) {
|
|
if (!isDone(rsltDir)) {
|
|
|
yield rmList([rsltDir, ...tmpSubReads]);
|
|
yield rmList([rsltDir, ...tmpSubReads]);
|
|
|
reject('No convergence');
|
|
reject('No convergence');
|