Skip to content

Commit

Permalink
Better logging of FastTree
Browse files Browse the repository at this point in the history
  • Loading branch information
aghozlane committed Mar 28, 2024
1 parent 74ed5a1 commit 426a53c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions meteor/phylogeny.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ def execute(self) -> None:
# Start phylogenies
start = perf_counter()
tree_files: list[Path] = []
for msp_file in self.msp_file_list:
msp_count = len(self.msp_file_list)
for idx, msp_file in enumerate(self.msp_file_list, start=1):
with NamedTemporaryFile(
mode="wt", dir=self.meteor.tmp_dir, suffix=".fasta", delete=False
) as temp_clean:
Expand All @@ -115,7 +116,7 @@ def execute(self) -> None:
with tree_file.open("wt", encoding="UTF-8") as tree:
os.environ["OMP_NUM_THREADS"] = str(self.meteor.threads)
# Compute trees
call(
result = call(
[
"FastTree",
"-nt",
Expand All @@ -124,7 +125,10 @@ def execute(self) -> None:
],
stdout=tree,
)
if result != 0:
logging.error("FastTree failed with return code %d", result)
tree_files.append(tree_file)
logging.info("Completed MSP tree %d/%d", idx, msp_count)
logging.info("Completed phylogeny in %f seconds", perf_counter() - start)
config = self.set_tree_config(fasttree_version, tree_files)
self.save_config(config, self.meteor.tree_dir / "census_stage_4.json")

0 comments on commit 426a53c

Please sign in to comment.