hodcroftlab / covariants

Real-time updates and information about key SARS-CoV-2 variants, plus the scripts that generate this information.
https://covariants.org/
GNU Affero General Public License v3.0
316 stars 113 forks source link

Show recombinants in left-hand menu and Cases graphs #359

Closed emmahodcroft closed 1 year ago

emmahodcroft commented 1 year ago

Adding a slightly new coloring to the graph - a 'recombinant' category. Here's how it's set up in clusters.py

        "snps": [],
        "snps_with_base": [],
        "cluster_data": [],
        "nextstrain_build": False,
        "use_pango": False,
        "type": "do_not_display",
        "graphing": True,
        "important": False,
        "country_info": [],
        "col": "#784421",
        "display_name": "recombinant",
        "alt_display_name": [],
        "build_name": "recombinant",
        "who_name": [],
        "old_build_names": [],
        "nextstrain_names": "recombinant",
        "pango_lineages": [],
        "nextstrain_url": "",
        "mutations": {
            "nonsynonymous": [],
            "synonymous": [],
       }
    },

It's showing up very well generally and mostly working properly (is graphing, but no page, no variant graph, no nextstrain build) - except it's missing from the left-hand menu to show and not-show, despite being in the graphs: image

However, it does appear and disappear when 'Select all' and 'Deselect all' are used at the top of the menu. My guess is that the menu logic may depend on something like do_not_display when it might should be graphing instead?

@ivan-aksamentov I'm afraid I'd appreciate your thoughts here - hopefully a small change in logic could get this working!

========================

Other issue - can't see that "recombinant" is showing up in the Cases graphs. I can see the counts in web/data/perCountryDataCaseCounts.json (link to raw) so the values are there - but don't see it on the page. May again be a logic checking happening somewhere? ("Don't graph if do_not_display rather than looking at graphing?)

From digging a bit, I'm afraid this one may be a little sticky, as it looks like perhaps it's tracing back to web/src/io/getClusters.ts - which excludes do_not_display (probably a good idea a lot of the time). But getClusterNames() also uses this (link), and that's called by sortClusters() in the same file, which is called by web/src/io/getPerCountryCasesData.ts.

Interestingly, in web/src/io/getPerCountryData.ts the logic is very similar but doesn't use sortClusters() which I presume is why this is working for PerCountry plots but not for Cases plots. Would aligning Cases to work the same work - or will that start breaking things?