From a6e7f5a04ebba86cf0ff8d7fe49d14e5715801d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Dernat?= <remy.dernat@umontpellier.fr> Date: Thu, 7 Nov 2019 17:34:28 +0100 Subject: [PATCH] adding a normalize option --- orthofinder/orthofinder.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/orthofinder/orthofinder.py b/orthofinder/orthofinder.py index 2e5067b..b95b83f 100755 --- a/orthofinder/orthofinder.py +++ b/orthofinder/orthofinder.py @@ -923,6 +923,7 @@ class Options(object):# self.speciesXMLInfoFN = None self.speciesTreeFN = None self.mclInflation = g_mclInflation + self.qNormalize = False # score normalization from Blast results def what(self): for k, v in self.__dict__.items(): @@ -932,17 +933,18 @@ class Options(object):# def ProcessArgs(prog_caller): """ Workflow - | 1. Fasta Files | 2. Prepare files | 3. Blast | 4. Orthogroups | 5. Gene Trees | 6. Reconciliations/Orthologues | + | 1. Fasta Files | 2. Prepare files | 3.a Blast | 3.b Normalize Blast scores | 4. Orthogroups | 5. Gene Trees | 6. Reconciliations/Orthologues | Options Start from: -f: 1,2,..,6 (start from fasta files, --fasta) -b: 4,5,6 (start from blast results, --blast) - -fg: 5,6 (start from orthogroups/do orthologue workflow, --from-groups) - -ft: 6 (start from gene tree/do reconciliation, --from-trees) + -N: 3b (start from blast results, --normalize) + -fg: 5,6 (start from orthogroups/do orthologue workflow, --from-groups) + -ft: 6 (start from gene tree/do reconciliation, --from-trees) Stop at: - -op: 2 (only prepare, --only-prepare) - -og: 4 (orthogroups, --only-groups) + -op: 2 (only prepare, --only-prepare) + -og: 4 (orthogroups, --only-groups) """ if len(sys.argv) == 1 or sys.argv[1] == "--help" or sys.argv[1] == "help" or sys.argv[1] == "-h": PrintHelp(prog_caller) @@ -977,6 +979,11 @@ def ProcessArgs(prog_caller): util.Fail() options.qStartFromBlast = True continuationDir = GetDirectoryArgument(arg, args) + elif arg == "-N" or arg == "--Normalize": + if options.qNormalize: + print("Repeated argument: -n/--normalize\n") + util.Fail() + options.qNormalize = True elif arg == "-fg" or arg == "--from-groups": if options.qStartFromGroups: print("Repeated argument: -fg/--from-groups\n") @@ -1200,8 +1207,8 @@ def ProcessArgs(prog_caller): if options.qPhyldog and (not options.speciesTreeFN): print("ERROR: Phyldog currently needs a species tree to be provided") - util.Fail() - + util.Fail() + if resultsDir_nonDefault != None and ((not options.qStartFromFasta) or options.qStartFromBlast): print("ERROR: Incompatible arguments, -o (non-default output directory) can only be used with a new OrthoFinder run using option '-f'") util.Fail() @@ -1209,6 +1216,11 @@ def ProcessArgs(prog_caller): if options.search_program not in (prog_caller.ListSearchMethods() + ['blast']): print("ERROR: Search program (%s) not configured in config.json file" % options.search_program) util.Fail() + + if options.qNormalize and options.qStartFromFasta: + # not a failure/exit, just a warning + print("ERROR: Normalize option is not needed when starting from fasta") + util.Fail() util.PrintTime("Starting OrthoFinder") print("%d thread(s) for highly parallel tasks (BLAST searches etc.)" % options.nBlast) -- GitLab