moducomp 0.7.6__py3-none-any.whl → 0.7.7__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- moducomp/__init__.py +1 -1
- moducomp/moducomp.py +25 -38
- {moducomp-0.7.6.dist-info → moducomp-0.7.7.dist-info}/METADATA +1 -1
- {moducomp-0.7.6.dist-info → moducomp-0.7.7.dist-info}/RECORD +7 -7
- {moducomp-0.7.6.dist-info → moducomp-0.7.7.dist-info}/WHEEL +0 -0
- {moducomp-0.7.6.dist-info → moducomp-0.7.7.dist-info}/entry_points.txt +0 -0
- {moducomp-0.7.6.dist-info → moducomp-0.7.7.dist-info}/licenses/LICENSE.txt +0 -0
moducomp/__init__.py
CHANGED
moducomp/moducomp.py
CHANGED
|
@@ -134,7 +134,12 @@ def conditional_output(message: str, color: str = "white", verbose: bool = True)
|
|
|
134
134
|
verbose : bool, optional
|
|
135
135
|
Whether to display the message, by default True
|
|
136
136
|
"""
|
|
137
|
-
if verbose:
|
|
137
|
+
if not verbose:
|
|
138
|
+
return
|
|
139
|
+
logger = logging.getLogger("ModuComp")
|
|
140
|
+
if logger.handlers:
|
|
141
|
+
logger.info(message)
|
|
142
|
+
else:
|
|
138
143
|
typer.secho(message, fg=color)
|
|
139
144
|
|
|
140
145
|
def emit_error(message: str, logger: Optional[logging.Logger] = None) -> None:
|
|
@@ -207,10 +212,10 @@ def run_subprocess_with_logging(
|
|
|
207
212
|
"""
|
|
208
213
|
if logger:
|
|
209
214
|
logger.info(f"{description}: {' '.join(cmd)}")
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
215
|
+
else:
|
|
216
|
+
# Only show detailed command info in verbose mode when no logger is configured
|
|
217
|
+
conditional_output(f"Running {description}", "yellow", verbose)
|
|
218
|
+
conditional_output(f" Command: {' '.join(cmd)}", "blue", verbose)
|
|
214
219
|
|
|
215
220
|
if logger:
|
|
216
221
|
logger.debug("Starting subprocess: %s", " ".join(cmd))
|
|
@@ -385,10 +390,9 @@ def setup_resource_logging(log_dir: Union[str, Path]) -> str:
|
|
|
385
390
|
|
|
386
391
|
# Create header for resource log file
|
|
387
392
|
with open(resource_log_file, 'w') as f:
|
|
388
|
-
f.write("#
|
|
393
|
+
f.write("# moducomp resource usage log\n")
|
|
389
394
|
f.write(f"# Generated on: {datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}\n")
|
|
390
|
-
f.write("# Format: Timestamp | Command | Elapsed_Time(s) | User_Time(s) | System_Time(s) | CPU_Percent | Max_RAM(GB) | Exit_Code\n")
|
|
391
|
-
f.write("#" + "="*120 + "\n\n")
|
|
395
|
+
f.write("# Format: Timestamp | Command | Elapsed_Time(s) | User_Time(s) | System_Time(s) | CPU_Percent | Max_RAM(GB) | Exit_Code\n\n")
|
|
392
396
|
|
|
393
397
|
return resource_log_file
|
|
394
398
|
|
|
@@ -437,9 +441,9 @@ def run_subprocess_with_resource_monitoring(
|
|
|
437
441
|
if logger:
|
|
438
442
|
logger.info(f"{description}: {' '.join(cmd)}")
|
|
439
443
|
logger.info(f"Resource monitoring enabled, output will be logged to: {resource_log_file}")
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
444
|
+
else:
|
|
445
|
+
conditional_output(f"Running {description} (with resource monitoring)", "yellow", verbose)
|
|
446
|
+
conditional_output(f" Command: {' '.join(cmd)}", "blue", verbose)
|
|
443
447
|
|
|
444
448
|
start_time = datetime.datetime.now()
|
|
445
449
|
|
|
@@ -541,16 +545,14 @@ def log_final_resource_summary(resource_log_file: str, total_start_time: float,
|
|
|
541
545
|
end_time = datetime.datetime.now()
|
|
542
546
|
|
|
543
547
|
with open(resource_log_file, 'a') as f:
|
|
544
|
-
f.write("\
|
|
545
|
-
f.write("
|
|
546
|
-
f.write(f"
|
|
547
|
-
f.write(f"# Total pipeline elapsed time: {total_elapsed:.2f} seconds ({total_elapsed/60:.2f} minutes)\n")
|
|
548
|
-
f.write("="*120 + "\n")
|
|
548
|
+
f.write("\nFinal resource usage summary\n")
|
|
549
|
+
f.write(f"Pipeline completed at: {end_time.strftime('%Y-%m-%d %H:%M:%S')}\n")
|
|
550
|
+
f.write(f"Total pipeline elapsed time: {total_elapsed:.2f} seconds ({total_elapsed/60:.2f} minutes)\n")
|
|
549
551
|
|
|
550
552
|
if verbose:
|
|
551
|
-
conditional_output("
|
|
552
|
-
conditional_output(f"
|
|
553
|
-
conditional_output(f"
|
|
553
|
+
conditional_output("Resource usage summary saved.", "green", verbose)
|
|
554
|
+
conditional_output(f"Resource log: {resource_log_file}", "white", verbose)
|
|
555
|
+
conditional_output(f"Total pipeline time: {total_elapsed:.2f}s ({total_elapsed/60:.2f}min)", "white", verbose)
|
|
554
556
|
|
|
555
557
|
if logger:
|
|
556
558
|
logger.info(f"Resource usage summary completed. Total time: {total_elapsed:.2f}s")
|
|
@@ -604,24 +606,18 @@ def display_pipeline_completion_summary(start_time: float, savedir: str, logger:
|
|
|
604
606
|
output_files.append(f"{complementarity_files} complementarity report(s)")
|
|
605
607
|
|
|
606
608
|
if verbose:
|
|
607
|
-
conditional_output("
|
|
608
|
-
conditional_output("MODUCOMP PIPELINE COMPLETED SUCCESSFULLY!", "green", verbose)
|
|
609
|
-
conditional_output("="*80, "green", verbose)
|
|
609
|
+
conditional_output("Pipeline completed.", "green", verbose)
|
|
610
610
|
conditional_output(f"Total execution time: {time_str} ({total_elapsed:.2f} seconds)", "white", verbose)
|
|
611
|
-
conditional_output(f"Output directory: {savedir}", "
|
|
611
|
+
conditional_output(f"Output directory: {savedir}", "white", verbose)
|
|
612
612
|
conditional_output(f"Generated files: {', '.join(output_files) if output_files else 'None'}", "white", verbose)
|
|
613
613
|
conditional_output(f"Completed at: {datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}", "white", verbose)
|
|
614
|
-
conditional_output("="*80, "green", verbose)
|
|
615
614
|
|
|
616
615
|
if logger:
|
|
617
|
-
logger.info("
|
|
618
|
-
logger.info("MODUCOMP PIPELINE COMPLETED SUCCESSFULLY!")
|
|
619
|
-
logger.info("="*80)
|
|
616
|
+
logger.info("Pipeline completed.")
|
|
620
617
|
logger.info(f"Total execution time: {time_str} ({total_elapsed:.2f} seconds)")
|
|
621
618
|
logger.info(f"Output directory: {savedir}")
|
|
622
619
|
logger.info(f"Generated files: {', '.join(output_files) if output_files else 'None'}")
|
|
623
620
|
logger.info(f"Completed at: {datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
|
|
624
|
-
logger.info("="*80)
|
|
625
621
|
|
|
626
622
|
|
|
627
623
|
def parse_emapper_annotations(emapper_file_path: str, logger: Optional[logging.Logger] = None) -> Dict[str, Dict[str, List[str]]]:
|
|
@@ -3119,7 +3115,7 @@ def _run_pipeline_core(genomedir: str, savedir: str, ncpus: int, adapt_headers:
|
|
|
3119
3115
|
if check_final_reports_exist(savedir, calculate_complementarity, logger):
|
|
3120
3116
|
conditional_output("OK: All output files already exist. Skipping processing.", "green", verbose)
|
|
3121
3117
|
if not del_tmp:
|
|
3122
|
-
conditional_output("
|
|
3118
|
+
conditional_output("Keeping temporary files as requested.", "blue", verbose)
|
|
3123
3119
|
logger.info("Pipeline skipped as all output files already exist")
|
|
3124
3120
|
return
|
|
3125
3121
|
|
|
@@ -3390,10 +3386,6 @@ def download_eggnog_data(
|
|
|
3390
3386
|
default_dir = default_eggnog_data_dir()
|
|
3391
3387
|
os.environ["EGGNOG_DATA_DIR"] = str(default_dir)
|
|
3392
3388
|
env_value = str(default_dir)
|
|
3393
|
-
typer.secho(
|
|
3394
|
-
f"INFO: EGGNOG_DATA_DIR not set; using default {env_value}",
|
|
3395
|
-
fg="yellow",
|
|
3396
|
-
)
|
|
3397
3389
|
logger.info("EGGNOG_DATA_DIR not set; using default %s", env_value)
|
|
3398
3390
|
|
|
3399
3391
|
data_dir = Path(env_value).expanduser().resolve()
|
|
@@ -3412,9 +3404,6 @@ def download_eggnog_data(
|
|
|
3412
3404
|
# Run the downloader with progress updates based on data directory growth.
|
|
3413
3405
|
cmd = [downloader]
|
|
3414
3406
|
logger.info("Downloading eggNOG data: %s", downloader)
|
|
3415
|
-
if verbose:
|
|
3416
|
-
typer.secho("Running download_eggnog_data.py", fg="yellow")
|
|
3417
|
-
typer.secho(f" Command: {' '.join(cmd)}", fg="blue")
|
|
3418
3407
|
|
|
3419
3408
|
start_time = time.time()
|
|
3420
3409
|
last_progress_time = start_time
|
|
@@ -3496,8 +3485,6 @@ def download_eggnog_data(
|
|
|
3496
3485
|
f"{format_bytes(speed)}/s, +{file_delta} files)"
|
|
3497
3486
|
)
|
|
3498
3487
|
logger.info(msg)
|
|
3499
|
-
if verbose:
|
|
3500
|
-
typer.secho(msg, fg="cyan")
|
|
3501
3488
|
last_size = current_size
|
|
3502
3489
|
last_files = current_files
|
|
3503
3490
|
last_progress_time = now
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: moducomp
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.7
|
|
4
4
|
Summary: moducomp: metabolic module completeness and complementarity for microbiomes.
|
|
5
5
|
Keywords: bioinformatics,microbiome,metabolic,kegg,genomics
|
|
6
6
|
Author-email: "Juan C. Villada" <jvillada@lbl.gov>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
moducomp/__init__.py,sha256=
|
|
1
|
+
moducomp/__init__.py,sha256=NWx_867k12Y9t9N5eszmBlT5I0EkYcKfx8vjhCvYD1U,658
|
|
2
2
|
moducomp/__main__.py,sha256=1O2pv6IGjUgqnbqsiMLtVqjxWQpRtZUjp8LDljZ1bsI,185
|
|
3
|
-
moducomp/moducomp.py,sha256=
|
|
3
|
+
moducomp/moducomp.py,sha256=Tt4iR9P18NGo8MlFfQ5hEq7kHo1BvQpn86emUgqpOLU,138425
|
|
4
4
|
moducomp/data/test_genomes/IMG2562617132.faa,sha256=gZPh-08pMRdAWJRr3__TbnU1F68CdkDb3gxtpaCLTTc,356863
|
|
5
5
|
moducomp/data/test_genomes/IMG2568526683.faa,sha256=PxFJwe-68UGw7il1hGlNhZt4-2WzzxXxGE1GTskDnow,343109
|
|
6
6
|
moducomp/data/test_genomes/IMG2740892217.faa,sha256=WsId4sIPxENbqF6tYFouAgDCy6T0SXNY6TywxBNe-3E,548954
|
|
7
|
-
moducomp-0.7.
|
|
8
|
-
moducomp-0.7.
|
|
9
|
-
moducomp-0.7.
|
|
10
|
-
moducomp-0.7.
|
|
11
|
-
moducomp-0.7.
|
|
7
|
+
moducomp-0.7.7.dist-info/entry_points.txt,sha256=dwt0_w7Ex9p1vhfp2fl4WXJLBh50u9fXTRNlAOJkAd4,114
|
|
8
|
+
moducomp-0.7.7.dist-info/licenses/LICENSE.txt,sha256=pt0cfIq9Wop21KDZYyQgP0M1YWYvKG0PomA5cUDC4TI,1536
|
|
9
|
+
moducomp-0.7.7.dist-info/WHEEL,sha256=_2ozNFCLWc93bK4WKHCO-eDUENDlo-dgc9cU3qokYO4,82
|
|
10
|
+
moducomp-0.7.7.dist-info/METADATA,sha256=-g283O5ptSHXfIbQEfT-zfaHk1P7bE5W362n4P9sXYg,10474
|
|
11
|
+
moducomp-0.7.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|