From bc24ca3473eef3a9467a748a7c5a1e6da4539889 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dernat=20R=C3=A9my?= <remy.dernat@umontpellier.fr>
Date: Fri, 8 Nov 2019 16:12:30 +0100
Subject: [PATCH] adding necessary addtionnal conditions for Normalize option

---
 orthofinder/scripts/files.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/orthofinder/scripts/files.py b/orthofinder/scripts/files.py
index e527af0..06ef1d7 100644
--- a/orthofinder/scripts/files.py
+++ b/orthofinder/scripts/files.py
@@ -166,7 +166,13 @@ class __Files_new_dont_manually_create__(object):
             wd1 = previous_files_locator.GetStartFromBlast()
             self.StartFromOrthogroupsOrSequenceSearch(wd1, 
                                                       base_dir,
-                                                      user_name=options.name)  
+                                                      user_name=options.name)
+
+        elif options.qNormalize: 
+            wd1 = previous_files_locator.GetStartFromBlast()
+            self.StartFromOrthogroupsOrSequenceSearch(wd1, 
+                                                      base_dir,
+                                                      user_name=options.name)
             
         elif options.qStartFromGroups:
             wd1, clustersFilename_pairs = previous_files_locator.GetStartFromOGs()
@@ -575,7 +581,7 @@ class PreviousFilesLocator_new(PreviousFilesLocator):
         PreviousFilesLocator.__init__(self)
         if not continuationDir.endswith("/"): continuationDir += "/"
         self.home_for_results = continuationDir + "../"
-        if (options.qStartFromFasta and not options.qStartFromBlast):
+        if (options.qStartFromFasta and not ( options.qStartFromBlast or options.qNormalize ):
             # there are no files to find
             return
         if not self._IsNewDirStructure(continuationDir): raise Unprocessable("Input directory structure is not processable as new structure")
@@ -659,7 +665,7 @@ class PreviousFilesLocator_old(PreviousFilesLocator):
             self.wd_base_prev, self.orthofinderResultsDir, self.clustersFilename_pairs = self._GetOGsFile(ogs_dir)
             if options.qStartFromTrees:
                 self._FindFromTrees(continuationDir, options.speciesTreeFN)
-        elif options.qStartFromBlast:
+        elif options.qStartFromBlast or options.qNormalize:
             if self._IsWorkingDirectory(continuationDir): 
                 self.wd_base_prev = continuationDir
             elif self._IsWorkingDirectory(continuationDir + "WorkingDirectory/"):
@@ -803,7 +809,7 @@ def InitialiseFileHandler(options, fastaDir=None, continuationDir=None, resultsD
     """
     # 1 & 2
     # If starting from scratch, no need for a PreviousFileLocator
-    if options.qStartFromFasta and not options.qStartFromBlast:
+    if options.qStartFromFasta and not ( options.qStartFromBlast or options.qNormalize ):
         pfl = None
         base_dir = resultsDir_nonDefault if resultsDir_nonDefault != None else fastaDir + "OrthoFinder/"
     else:
-- 
GitLab