moducomp 0.7.6__tar.gz → 0.7.7__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: moducomp
3
- Version: 0.7.6
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>
@@ -2,7 +2,7 @@
2
2
  moducomp: metabolic module completeness and complementarity for microbiomes.
3
3
  """
4
4
 
5
- __version__ = "0.7.6"
5
+ __version__ = "0.7.7"
6
6
  __author__ = "Juan C. Villada"
7
7
  __email__ = "jvillada@lbl.gov"
8
8
  __title__ = "moducomp"
@@ -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
- # Only show detailed command info in verbose mode
212
- conditional_output(f"Running {description}", "yellow", verbose)
213
- conditional_output(f" Command: {' '.join(cmd)}", "blue", verbose)
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("# ModuComp Resource Usage Report\n")
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
- conditional_output(f"Running {description} (with resource monitoring)", "yellow", verbose)
442
- conditional_output(f" Command: {' '.join(cmd)}", "blue", verbose)
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("\n" + "="*120 + "\n")
545
- f.write("# PIPELINE SUMMARY\n")
546
- f.write(f"# Pipeline completed at: {end_time.strftime('%Y-%m-%d %H:%M:%S')}\n")
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("\nResource Usage Summary Logged", "green", verbose)
552
- conditional_output(f" Full report saved to: {resource_log_file}", "cyan", verbose)
553
- conditional_output(f" Total pipeline time: {total_elapsed:.2f}s ({total_elapsed/60:.2f}min)", "white", verbose)
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("\n" + "="*80, "green", verbose)
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}", "cyan", verbose)
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("="*80)
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("INFO: Keeping temporary files as requested.", "blue", verbose)
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,5 +1,5 @@
1
1
  context:
2
- version: 0.7.6
2
+ version: 0.7.7
3
3
 
4
4
  package:
5
5
  name: moducomp
@@ -7,7 +7,7 @@ package:
7
7
 
8
8
  source:
9
9
  - url: https://pypi.org/packages/source/m/moducomp/moducomp-${{ version }}.tar.gz
10
- sha256: 156432ad4a066a77db29bac0faff4e06c56ff4966d5e7f4a7acbf83be528ca70
10
+ sha256: 3326436b4e3a5704d220d466deb0d57090bba1d08686a9c69343fd697f9abf9f
11
11
 
12
12
  build:
13
13
  script:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes