From a681390d452075da0ed8ed48c2e12b61b3c8fb47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dernat=20R=C3=A9my?= <remy.dernat@umontpellier.fr>
Date: Mon, 11 Nov 2019 19:49:09 +0100
Subject: [PATCH] Normalize is not compatible with other options. It is a one
 shot operation

---
 orthofinder/orthofinder.py                  | 10 +++++-----
 orthofinder/scripts/blast_file_processor.py |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/orthofinder/orthofinder.py b/orthofinder/orthofinder.py
index 2edc6d4..91cd61f 100755
--- a/orthofinder/orthofinder.py
+++ b/orthofinder/orthofinder.py
@@ -501,7 +501,7 @@ class WaterfallMethod:
                 Bij = blast_file_processor.GetBLAST6Scores(seqsInfo, blastDir_list, seqsInfo.speciesToUse[iSpecies], seqsInfo.speciesToUse[jSpecies], qDoubleBlast=qDoubleBlast)  
                 Bij = WaterfallMethod.NormaliseScores(Bij, Lengths, iSpecies, jSpecies)
                 if qNormalize:
-                    WaterfallMethod.ProcessNewScores(seqsInfo, blastDir_list, Bij, iSpecies, qDoubleBlast=qDoubleBlast)
+                    WaterfallMethod.WriteNewScores(seqsInfo, blastDir_list, Bij, iSpecies, qDoubleBlast=qDoubleBlast)
                 Bi.append(Bij)
             matrices.DumpMatrixArray("B", Bi, iSpecies)
             BH = GetBH_s(Bi, seqsInfo, iSpecies)
@@ -518,12 +518,12 @@ class WaterfallMethod:
                 return
 
     @staticmethod
-    def ProcessNewScores(seqsInfo, blastDir_list, B, iSpecies, qDoubleBlast):
+    def WriteNewScores(seqsInfo, blastDir_list, B, iSpecies, qDoubleBlast):
         with warnings.catch_warnings():
             warnings.simplefilter("ignore")
             # process up to the best hits for each species; Bi is a list of matrices
             for jSpecies in range(seqsInfo.nSpecies):
-                blast_file_processor.rewriteNormalizedBlastFile(blastDir_list, B, seqsInfo.speciesToUse[iSpecies], seqsInfo.speciesToUse[jSpecies], qDoubleBlast=qDoubleBlast)
+                blast_file_processor.WriteNormalizedBlastFile(blastDir_list, B, seqsInfo.speciesToUse[iSpecies], seqsInfo.speciesToUse[jSpecies], qDoubleBlast=qDoubleBlast)
 
     @staticmethod
     def ConnectCognates(seqsInfo, iSpecies): 
@@ -1229,9 +1229,9 @@ def ProcessArgs(prog_caller):
         print("ERROR: Search program (%s) not configured in config.json file" % options.search_program)
         util.Fail()
 
-    if options.qNormalize and options.qStartFromFasta:
+    if options.qNormalize and ( options.qStartFromFasta or options.qStartFromBlast or options.qStartFromGroups or options.qStartFromTrees ) :
         # not a failure/exit, just a warning
-        print("ERROR: Normalize option is not needed when starting from fasta")
+        print("ERROR: Normalize option is not possible with other options")
         util.Fail()
         
     util.PrintTime("Starting OrthoFinder")    
diff --git a/orthofinder/scripts/blast_file_processor.py b/orthofinder/scripts/blast_file_processor.py
index 84e5de9..d928bd8 100644
--- a/orthofinder/scripts/blast_file_processor.py
+++ b/orthofinder/scripts/blast_file_processor.py
@@ -103,7 +103,7 @@ def GetBLAST6Scores(seqsInfo, blastDir_list, iSpecies, jSpecies, qExcludeSelfHit
         raise 
     return B
 
-def rewriteNormalizedBlastFile(blastDir_list, B, iSpecies, jSpecies, qExcludeSelfHits = True, sep = "_", qDoubleBlast=True):
+def WriteNormalizedBlastFile(blastDir_list, B, iSpecies, jSpecies, qExcludeSelfHits = True, sep = "_", qDoubleBlast=True):
     qSameSpecies = iSpecies==jSpecies
     qCheckForSelfHits = qExcludeSelfHits and qSameSpecies
     if not qDoubleBlast:
-- 
GitLab