|
|
@@ -62,19 +62,23 @@ const denovoAssemblage = (reads, rnames, spadesPath) => {
|
|
|
// Prepare the fastq files for spades inputs
|
|
|
const rnamesSel = '\'' + rnames.join('\\|') + '\'';
|
|
|
const tmpSubReads = [];
|
|
|
+ let isfq = [];
|
|
|
for (const R of readsIn) {
|
|
|
- const tmp = path_1.default.join(os_1.default.tmpdir(), (+new Date) + '_' + path_1.default.parse(R).base);
|
|
|
+ const parsedPath = path_1.default.parse(R);
|
|
|
+ const greper = parsedPath.ext === '.gz' ? 'zgrep' : 'grep';
|
|
|
+ isfq.push(R.match(/\.fq/) ? true : false);
|
|
|
+ const tmp = path_1.default.join(os_1.default.tmpdir(), (+new Date) + '_' + parsedPath.name + (isfq ? '.fq' : '.fa'));
|
|
|
tmpSubReads.push(tmp);
|
|
|
- const greper = R.match(/gz$/) ? 'zgrep' : 'grep';
|
|
|
yield async_exec(greper, [rnamesSel, R, '-A3', '--no-group-separator', '>', tmp], console.log, console.log);
|
|
|
}
|
|
|
+ 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 rsltDir = path_1.default.join(os_1.default.tmpdir(), (+new Date) + '_spades');
|
|
|
- yield async_exec(spadesPath, ['-t', threads, '--isolate', ...args, '-o', rsltDir], console.log, console.log);
|
|
|
+ yield async_exec(spadesPath, ['-t', threads, '--isolate', correction, ...args, '-o', rsltDir], console.log, console.log);
|
|
|
if (!isDone(rsltDir)) {
|
|
|
yield rmList([rsltDir]);
|
|
|
console.log('Trying meta');
|
|
|
- yield async_exec(spadesPath, ['-t', threads, '--meta', ...args, '-o', rsltDir], console.log, console.log);
|
|
|
+ yield async_exec(spadesPath, ['-t', threads, '--meta', correction, ...args, '-o', rsltDir], console.log, console.log);
|
|
|
if (!isDone(rsltDir)) {
|
|
|
yield rmList([rsltDir, ...tmpSubReads]);
|
|
|
reject('No convergence');
|