Skip to content

Commit

Permalink
fix --decorate_gff yes with --resume option
Browse files Browse the repository at this point in the history
  • Loading branch information
Cantalapiedra committed May 11, 2023
1 parent 7ce4092 commit e90f69e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions eggnogmapper/emapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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()

Expand Down

0 comments on commit e90f69e

Please sign in to comment.