From e90f69ec12ea91c3f649af73d8b599e25098c4d8 Mon Sep 17 00:00:00 2001 From: Cantalapiedra Date: Thu, 11 May 2023 19:22:30 +0200 Subject: [PATCH] fix --decorate_gff yes with --resume option --- eggnogmapper/emapper.py | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/eggnogmapper/emapper.py b/eggnogmapper/emapper.py index fb60d338..a8797039 100644 --- a/eggnogmapper/emapper.py +++ b/eggnogmapper/emapper.py @@ -130,11 +130,10 @@ def __init__(self, itype, genepred, mode, annot, excel, report_orthologs, decora def gene_prediction(self, args, infile): predictor = None + predictor = get_predictor(args, self.genepred) # --resume skips gene prediction to resume from diamond/mmseqs/hmmer hits directly - if self.resume == False: - predictor = get_predictor(args, self.genepred) - if predictor is not None: - predictor.predict(infile) + if predictor is not None and self.resume == False: + predictor.predict(infile) return predictor @@ -246,13 +245,16 @@ def decorate_gff_f(self, args, predictor, searcher_name, annotated_hits): gff_outfile = pjoin(self._current_dir, self.deco_gff_file) if predictor is not None: - gff_genepred_file = predictor.outgff - gff_genepred_fasta = predictor.outprots + if self.resume == True: + gff_genepred_file = pjoin(self._current_dir, self.genepred_gff_file) + gff_genepred_fasta = pjoin(self._current_dir, self.genepred_fasta_file) + else: + gff_genepred_file = predictor.outgff + gff_genepred_fasta = predictor.outprots else: gff_genepred_file = None gff_genepred_fasta = None - annotated_hits = run_gff_decoration(self.decorate_gff, args.decorate_gff_ID_field, self.genepred_is_prodigal, self.genepred_is_blastx, gff_genepred_file, gff_genepred_fasta, gff_outfile, @@ -299,9 +301,10 @@ def wrap_up(self, predictor, searcher): ## # Clear things if predictor is not None: - shutil.move(predictor.outprots, pjoin(self._current_dir, self.genepred_fasta_file)) - shutil.move(predictor.outgff, pjoin(self._current_dir, self.genepred_gff_file)) - predictor.clear() # removes gene predictor output directory + if self.resume == False: # if self.resume == True there aren't new genepred files to move + shutil.move(predictor.outprots, pjoin(self._current_dir, self.genepred_fasta_file)) + shutil.move(predictor.outgff, pjoin(self._current_dir, self.genepred_gff_file)) + predictor.clear() # removes gene predictor output directory if searcher is not None: searcher.clear()