GenSpectrum / cov-spectrum-website

A web platform to detect and analyze variants of SARS-CoV-2
https://cov-spectrum.org
GNU General Public License v3.0
61 stars 14 forks source link

ENH: Add CI on comparison plots #385

Open corneliusroemer opened 2 years ago

corneliusroemer commented 2 years ago

Just brainstorming a few things that'd be nice to have and round off the feature

FedeGueli commented 2 years ago

I see CIs maybe already added??

chaoran-chen commented 2 years ago

It would be nice to show the CIs by default but have an option to turn them off.

For the "Compare variants" mode, we can just calculate the usual binomial CIs using the Wilson score. For the "Compare variants to a baseline", I suggest calculating the Binomial ratio confidence (that we originally implemented for the hospitalization rate plots): https://github.com/cevo-public/cov-spectrum-website/blob/dc9fc5ae8027767fff78d0a5b394dee674131aad/src/helpers/binomial-ratio-confidence.ts.

anastasia-escher commented 2 years ago

Hi @corneliusroemer and @chaoran-chen !Would you like to show the CIs on plot as separate grey (dashed or solid) lines surrounding the main lines (the CI lines can be toggled away), like this? Or did you have another idea? Screenshot 2022-07-12 at 10 46 59 Screenshot 2022-07-12 at 10 56 27

chaoran-chen commented 2 years ago

I was thinking about colored and partially transparent areas similar to the existing ones

_20220712_121716.JPG

Instead of blue, the area should have the same color (but lighter/partially transparent) as the solid lines

chaoran-chen commented 2 years ago

Is there maybe some code that you can reuse?

anastasia-escher commented 2 years ago

@chaoran-chen like this? Screenshot 2022-07-12 at 12 52 39

chaoran-chen commented 2 years ago

Yes, that's great!

anastasia-escher commented 2 years ago

Application of approximateBinomialRatioConfidence function to the "Compare variants to a baseline" case is a bit more complicated. Do you mind if I make a PR for this simple 'Compare variants" case and make the "Compare variants to a baseline" later (maybe, I'll need to ask Dave for help when he is back from holidays next week).

chaoran-chen commented 2 years ago

Okay, sure :)