phytest-devs / phytest

Quality control for phylogenetic analyses
https://phytest-devs.github.io/phytest/
MIT License
13 stars 1 forks source link

Customise the pytest-html report #19

Open Wytamma opened 2 years ago

Wytamma commented 2 years ago

Currently the Phytest report is pretty bland, but we could customise it to include a MSA and Tree for better interpretation https://pytest-html.readthedocs.io/en/latest/user_guide.html

smutch commented 2 years ago

Turns out the hooks for modifying the report are quite limited for stylistic things. You can do some pretty advanced stuff with modifying the tables, doing queries on the results that end up in there etc. But I had to do some css trickery to get the logo in there. I see the following options going forward:

  1. Suck it up and just do the best we can with the existing hooks.
  2. Maintain our own fork of pytest-html that has more hooks built in.
  3. Post process the report with beautifulsoup (or similar)

Option 1 is the easiest, 3 means we can make it look nice but future changes to phytest-html upstream may break the post-processing occasionally, 2 is a lot more work.

I vote option 3 for the moment...

Wytamma commented 2 years ago

Hmm yeah 2 and 3 seem like a lot of work... I think it depends on what we want to add. For example we can use the biopython.Phylo.draw method to draw trees and colour the tips red/green if the fail/pass the tests https://github.com/biopython/biopython/blob/master/Bio/Phylo/_utils.py#L242. I don't think that would be too hard to add with option 1 would just be similar to the logo I think? We could also add the root-to-tip regression plot to the report in the same manner. We might have to base64 encode the images to keep the report self contained though.

Wytamma commented 2 years ago

Actually I don't know if colouring the tree would work because It'd depend on the tip names being the same as the sequence IDs. But we could still include a tree for visualisation?