From ac78c38f9fa10a82e72cf9686b89e0d93fb85f0d Mon Sep 17 00:00:00 2001 From: Frederick Muriuki Muriithi Date: Thu, 24 Oct 2024 16:57:10 -0500 Subject: Reduce number of local variables created in function. Use the values in the argparse.Namespace object directly to avoid creating many local variables. --- scripts/rqtl2/phenotypes_qc.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/rqtl2/phenotypes_qc.py b/scripts/rqtl2/phenotypes_qc.py index 2e7937f..83828e4 100644 --- a/scripts/rqtl2/phenotypes_qc.py +++ b/scripts/rqtl2/phenotypes_qc.py @@ -329,12 +329,10 @@ def run_qc(# pylint: disable=[too-many-locals] logger: Logger ) -> int: """Run quality control checks on the bundle.""" - (phenobundle, workingdir, speciesid, populationid) = ( - args.rqtl2bundle, args.workingdir, args.speciesid, args.populationid) logger.debug("Beginning the quality assuarance checks.") results = check_for_averages_files( **check_for_mandatory_pheno_keys( - **validate(phenobundle, logger))) + **validate(args.rqtl2bundle, logger))) errors = results.get("errors", tuple()) if len(errors) > 0: logger.error("We found the following errors:\n%s", @@ -343,7 +341,8 @@ def run_qc(# pylint: disable=[too-many-locals] # Run QC on actual values # Steps: # - Extract file to specific directory - extractiondir, *_bundlefiles = extract_bundle(phenobundle, workingdir) + extractiondir, *_bundlefiles = extract_bundle( + args.rqtl2bundle, args.workingdir, args.jobid) # - For every pheno, phenocovar, phenose, phenonum file, undo # transposition where relevant @@ -360,7 +359,8 @@ def run_qc(# pylint: disable=[too-many-locals] item for item in set(reduce( lambda acc, item: acc + ( item["Name"], item["Name2"], item["Symbol"], item["Alias"]), - samples_by_species_and_population(dbconn, speciesid, populationid), + samples_by_species_and_population( + dbconn, args.speciesid, args.populationid), tuple())) if bool(item)) -- cgit v1.2.3