PoonLab / covizu

Rapid analysis and visualization of coronavirus genome variation
https://filogeneti.ca/CoVizu/
MIT License
46 stars 20 forks source link

Add details panel for lineage mutations #310

Closed ArtPoon closed 2 years ago

ArtPoon commented 3 years ago

These can be presented as a table. See also #286

ArtPoon commented 3 years ago

Have to remember to credit Paul Gordon and his site for mutation metadata in this details panel

ArtPoon commented 3 years ago

This will enable us to abbreviate the number of mutations listed in the lineage tooltip

ArtPoon commented 3 years ago

Table should report the following for a selected lineage (do not modify for selected variant or bead?)

ArtPoon commented 3 years ago

Might need to use some sort of letter or abbreviation encoding of phenotypic effects, and adding a corresponding legend above/below the details table.

ArtPoon commented 3 years ago

Let's make a new branch for backend and frontend development of this issue

ArtPoon commented 3 years ago

See branch mutationstable

ArtPoon commented 3 years ago

Need to modify backend to add mutation frequencies to dbstats.json file: https://github.com/PoonLab/covizu/blob/0691e41167294a3033b7a5a69db8cb24f562daaa/covizu/utils/batch_utils.py#L210-L229

ArtPoon commented 3 years ago

I think we can just modify this line in above code: common = [feat for feat, count in counts.items() if count/len(samples) >= 0.5] to common = dict([(feat, count/len(samples)) for feat, count in counts.items() if count/len(samples) >= 0.5])

ArtPoon commented 3 years ago

Need to update batch.py to handle dict instead of list

ArtPoon commented 3 years ago

Need to write a unit test for extracting mutation frequencies, with a specific test fixture

bonnielu commented 3 years ago

I've rewritten mut_annotation_edit.py to output a JSON file with the mutations as keys and phenotypes as values. Some mutations have ~20 phenotypes attributed to them. Not quite sure how to integrate this into our table — I was thinking of doing it with a tooltip but I'm open to suggestions right now!

ArtPoon commented 3 years ago

We can try a few things:

ArtPoon commented 2 years ago

Shorten listing of mutations in tooltip when we implement the details table (#364)

bonnielu commented 2 years ago

visualize_phenotypes

The graph above shows the distribution of phenotype frequencies! Our current coverage, with 7 phenotypes in the legend, is about 70%.

ArtPoon commented 2 years ago

Thanks - so based on the barplot, the top N are:

ArtPoon commented 2 years ago

Need to provide some more informative text than "see more" for tooltip where number of mutations of lineage exceeds 5 (maybe display 10? display mutations derived from ancestral lineage?) Perhaps something more like "and 27 others"?

bonnielu commented 2 years ago

I've just had a sudden realization as to why the frequencies in the above graph are not adding up. The image I attached earlier had the 7 most frequent phenotypes removed (oops). This image below should represent the full set of phenotypes!

Screen Shot 2021-12-13 at 1 39 03 AM

ArtPoon commented 2 years ago
ArtPoon commented 2 years ago

@ArtPoon to convert clusters.json and return to @bonnielu for testing

ArtPoon commented 2 years ago