Skip to content

Commit ebf3726

Browse files
committed
.
1 parent ed9b0fc commit ebf3726

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

recmpox/recmpox.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -565,15 +565,18 @@ def _run_phylogeny_pipeline(
565565

566566
logger.info("Wrote combined FASTA for phylogeny: %s (refs + %s + %s partitions)", combined_fa, ref1_label, ref2_label)
567567

568-
# Squirrel alignment
569-
squirrel_out_phy = phylogeny_dir / "squirrel_out"
568+
# Squirrel alignment (output in work_dir so it is removed; we keep only the alignment in phylogeny/)
569+
squirrel_out_phy = work_dir / "phylogeny_squirrel"
570570
squirrel_out_phy.mkdir(parents=True, exist_ok=True)
571571
aln_stem = combined_fa.stem + ".aln.fasta"
572572
expected_aln = squirrel_out_phy / aln_stem
573573
_run_squirrel(squirrel_clade, combined_fa, squirrel_out_phy, expected_aln)
574574
if not expected_aln.exists():
575575
logger.error("--phylogeny: Squirrel did not produce %s", expected_aln)
576576
sys.exit(1)
577+
# Copy alignment into phylogeny/ so IQ-TREE runs from there (squirrel_out not kept)
578+
aln_in_phylogeny = phylogeny_dir / aln_stem
579+
shutil.copy(expected_aln, aln_in_phylogeny)
577580

578581
# IQ-TREE: -s alignment -m GTR -bb 1000
579582
iqtree_prefix = phylogeny_dir / "alignment"
@@ -582,7 +585,7 @@ def _run_phylogeny_pipeline(
582585
# -czb: collapse zero-length branches into polytomies
583586
cmd_iqtree = [
584587
"iqtree",
585-
"-s", str(expected_aln),
588+
"-s", str(aln_in_phylogeny),
586589
"-m", "GTR",
587590
"-bb", "1000",
588591
"-pre", str(iqtree_prefix),
@@ -661,15 +664,15 @@ def _run_phylogeny_pipeline(
661664
if not out_tree_path.exists() and treefile.exists():
662665
shutil.copy(treefile, out_tree_path)
663666
except Exception as e:
664-
logger.warning("ete3 tree plot failed: %s; open the .treefile in FigTree to export PDF.", e)
667+
logger.warning("ete3 tree plot failed: %s; PDF would be at %s (open .treefile in FigTree to export PDF).", e, pdf_path)
665668
if not out_tree_path.exists() and treefile.exists():
666669
shutil.copy(treefile, out_tree_path)
667670

668671
root_label = "midpoint-rooted tree" if midpoint_rooted else "tree (unrooted)"
669672
if pdf_written:
670673
print(f" Phylogeny: {root_label} {out_tree_path}; PDF {pdf_path}")
671674
else:
672-
print(f" Phylogeny: {root_label} {out_tree_path}; PDF not generated (open .treefile in FigTree to export PDF)")
675+
print(f" Phylogeny: {root_label} {out_tree_path}; PDF not created (would be {pdf_path}; open .treefile in FigTree to export PDF)")
673676

674677

675678
def _write_all_sequences_fasta(

0 commit comments

Comments
 (0)