diff --git a/unicycler/spades_func.py b/unicycler/spades_func.py index 1fbc1609..9d940212 100644 --- a/unicycler/spades_func.py +++ b/unicycler/spades_func.py @@ -68,7 +68,7 @@ def get_best_spades_graph(short1, short2, short_unpaired, out_dir, read_depth_fi reads = (short1, short2, short_unpaired) else: reads = spades_read_correction(short1, short2, short_unpaired, spades_dir, threads, - spades_path) + spades_path, keep) kmer_range = get_kmer_range(short1, short2, short_unpaired, spades_dir, kmer_count, min_k_frac, max_k_frac) assem_dir = os.path.join(spades_dir, 'assembly') @@ -200,7 +200,7 @@ def get_best_spades_graph(short1, short2, short_unpaired, out_dir, read_depth_fi return assembly_graph -def spades_read_correction(short1, short2, unpaired, spades_dir, threads, spades_path): +def spades_read_correction(short1, short2, unpaired, spades_dir, threads, spades_path, keep): """ This runs SPAdes with the --only-error-correction option. """ @@ -309,7 +309,8 @@ def spades_read_correction(short1, short2, unpaired, spades_dir, threads, spades if using_unpaired_reads and not corrected_u_exists: quit_with_error('SPAdes read error correction failed. ' 'See spades_assembly/read_correction/spades.log for more info.') - shutil.rmtree(read_correction_dir, ignore_errors=True) + if keep < 3: + shutil.rmtree(read_correction_dir, ignore_errors=True) if not using_paired_reads: corrected_1 = None diff --git a/unicycler/string_graph.py b/unicycler/string_graph.py index 2b69b92a..5406dd17 100644 --- a/unicycler/string_graph.py +++ b/unicycler/string_graph.py @@ -202,7 +202,6 @@ def remove_branching_paths(self): else: log.log('No links needed removal', verbosity=2) - def segment_leads_directly_to_contig_in_both_directions(self, seg_name): if self.segments[seg_name].contig: return True