iqtree / piqtree2

a python library that exposes features from iqtree2 - efficient software for phylogenomic inference
GNU General Public License v2.0
13 stars 3 forks source link

suppress stdout display in piqtree apps #52

Closed GavinHuttley closed 3 weeks ago

GavinHuttley commented 2 months ago

Using the attached alignment and this code within a jupyter notebook

from cogent3 import get_app, load_aligned_seqs

aln = load_aligned_seqs("ENSG00000000971.fa", moltype="dna")
phylo = get_app("piqtree_phylo", model="GTR")
tree = phylo(aln)
Writes a lot of text to stdout (or is it stderr?) ``` Seed: 1253522743 IQ-TREE version 2.3.6.lib COVID-edition for Mac OS X 64-bit built Aug 15 2024 Developed by Bui Quang Minh, James Barbetti, Nguyen Lam Tung, Olga Chernomor, Heiko Schmidt, Dominik Schrempf, Michael Woodhams, Ly Trong Nhan. Host: MacBook-Pro-4.UDS.anu.edu.au (SSE4.2, 96 GB RAM) Time: Wed Aug 28 08:58:54 2024 Kernel: SSE2 Alignment most likely contains DNA/RNA sequences Alignment has 10 sequences with 3795 columns, 1842 distinct patterns 1103 parsimony-informative, 1643 singleton sites, 1049 constant sites WARNING: Some sequence names are changed as follows: Coquerel's-sifaka -> Coquerel_s-sifaka Gap/Ambiguity Composition p-value Analyzing sequences: done in 3.19481e-05 secs using 84.51% CPU 1 Bushbaby 2.53% passed 74.74% 2 Arctic-ground-squirrel 84.98% passed 82.99% 3 Drill 64.82% passed 45.27% 4 Elephant 51.23% failed 3.68% 5 Tarsier 36.52% passed 54.26% 6 Panamanian-white-faced-capuchin 61.42% passed 14.00% 7 Sooty-mangabey 59.92% passed 15.23% 8 Bonobo 15.81% passed 89.73% 9 Greater-bamboo-lemur 8.70% passed 26.81% 10 Coquerel_s-sifaka 7.19% passed 86.03% WARNING: 5 sequences contain more than 50% gaps/ambiguity **** TOTAL 39.31% 1 sequences failed composition chi2 test (p-value<5%; df=3) Create initial parsimony tree by phylogenetic likelihood library (PLL)... 0.001 seconds NOTE: 0 MB RAM (0 GB) is required! Estimate model parameters (epsilon = 0.100) 1. Initial log-likelihood: -22045.422 2. Current log-likelihood: -20750.403 3. Current log-likelihood: -20746.562 4. Current log-likelihood: -20745.749 5. Current log-likelihood: -20744.347 6. Current log-likelihood: -20742.844 Optimal log-likelihood: -20742.775 Rate parameters: A-C: 1.50076 A-G: 1.95120 A-T: 1.11771 C-G: 1.27100 C-T: 2.11736 G-T: 1.00000 Base frequencies: A: 0.338 C: 0.180 G: 0.216 T: 0.266 Parameters optimization took 6 rounds (0.023 sec) Wrote distance file to... Computing ML distances based on estimated model parameters... Calculating distance matrix: done in 0.000396013 secs using 97.98% CPU Computing ML distances took 0.000530 sec (of wall-clock time) 0.000471 sec (of CPU time) WARNING: Some pairwise ML distances are too long (saturated) Setting up auxiliary I and S matrices: done in 1.00136e-05 secs using 69.91% CPU Computing RapidNJ tree took 0.000059 sec (of wall-clock time) 0.000032 sec (of CPU time) Log-likelihood of RapidNJ tree: -20702.242 -------------------------------------------------------------------- | INITIALIZING CANDIDATE TREE SET | -------------------------------------------------------------------- Generating 98 parsimony trees... 0.084 second Computing log-likelihood of 89 initial trees ... 0.080 seconds Current best score: -20702.242 Do NNI search on 20 best initial trees Estimate model parameters (epsilon = 0.100) BETTER TREE FOUND at iteration 1: -20701.896 WARNING: NNI search needs unusual large number of steps (10) to converge! WARNING: NNI search needs unusual large number of steps (10) to converge! Estimate model parameters (epsilon = 0.100) UPDATE BEST LOG-LIKELIHOOD: -20701.521 WARNING: NNI search needs unusual large number of steps (10) to converge! Iteration 10 / LogL: -20745.741 / Time: 0h:0m:0s WARNING: NNI search needs unusual large number of steps (10) to converge! Iteration 20 / LogL: -20747.048 / Time: 0h:0m:0s Finish initializing candidate tree set (13) Current best tree score: -20701.521 / CPU time: 0.565 Number of iterations: 20 -------------------------------------------------------------------- | OPTIMIZING CANDIDATE TREE SET | -------------------------------------------------------------------- Iteration 30 / LogL: -20702.255 / Time: 0h:0m:0s (0h:0m:1s left) UPDATE BEST LOG-LIKELIHOOD: -20701.521 Iteration 40 / LogL: -20710.315 / Time: 0h:0m:0s (0h:0m:1s left) Iteration 50 / LogL: -20705.049 / Time: 0h:0m:1s (0h:0m:1s left) Iteration 60 / LogL: -20701.522 / Time: 0h:0m:1s (0h:0m:0s left) Iteration 70 / LogL: -20705.291 / Time: 0h:0m:1s (0h:0m:0s left) Iteration 80 / LogL: -20706.014 / Time: 0h:0m:1s (0h:0m:0s left) Iteration 90 / LogL: -20704.902 / Time: 0h:0m:1s (0h:0m:0s left) Iteration 100 / LogL: -20701.532 / Time: 0h:0m:1s (0h:0m:0s left) TREE SEARCH COMPLETED AFTER 102 ITERATIONS / Time: 0h:0m:1s -------------------------------------------------------------------- | FINALIZING TREE SEARCH | -------------------------------------------------------------------- Performs final model parameters optimization Estimate model parameters (epsilon = 0.010) 1. Initial log-likelihood: -20701.521 Optimal log-likelihood: -20701.521 Rate parameters: A-C: 1.48010 A-G: 1.85388 A-T: 1.09561 C-G: 1.22465 C-T: 2.03036 G-T: 1.00000 Base frequencies: A: 0.338 C: 0.180 G: 0.216 T: 0.266 Parameters optimization took 1 rounds (0.002 sec) BEST SCORE FOUND : -20701.521 Total tree length: 4.868 Total number of iterations: 102 CPU time used for tree search: 1.566 sec (0h:0m:1s) Wall-clock time used for tree search: 1.611 sec (0h:0m:1s) Total CPU time used: 1.636 sec (0h:0m:1s) Total wall-clock time used: 1.687 sec (0h:0m:1s) Analysis results written to: IQ-TREE report: build_tree_1253522743.iqtree Maximum-likelihood tree: build_tree_1253522743.treefile Likelihood distances: build_tree_1253522743.mldist Screen log file: build_tree_1253522743.log Date and Time: Wed Aug 28 08:58:56 2024 ```

ENSG00000000971.fa.zip

update: pass the quiet flag

rmcar17 commented 2 months ago

Interesting, I'll have to look into it. Are you using the most recent version of piqtree2? The model specification should have changed

thomaskf commented 1 month ago

Done. Commit: https://github.com/iqtree/iqtree2/commit/fa798cf3b2ce76a470caf7392e2773a18f824e2e