Skip to content

Unexpected behavior for binned continuous metadata #2014

Description

@kimandrews

Two issues related to binned continuous metadata:

1. Frequencies panel shows bins based on "bounds" rather than"display"

Here is an example tb dataset generated using bins defined for the Number of drug resistant variants in the auspice-config.json like this:

   {
    "key": "num_dr_variants",
    "title": "Number of drug resistance variants",
    "type": "continuous",
    "legend": [
      { "value": 0,    "display": "0",     "bounds": [0, 0] },
      { "value": 1.5,  "display": "1-2",   "bounds": [0.5, 2.5] },
      { "value": 3.5,  "display": "3-4",   "bounds": [2.5, 4.5] },
      { "value": 5.5,  "display": "5-6",   "bounds": [4.5, 6.5] },
      { "value": 7.5,  "display": "7-8",   "bounds": [6.5, 8.5] },
      { "value": 9.5,  "display": "9-10",  "bounds": [8.5, 10.5] },
      { "value": 11.5, "display": "11+",   "bounds": [10.5, 100] }
    ]
  },

In the example dataset, the auspice frequencies panel shows the upper and lower values of "bounds" for each bin, which means that samples with 1-2 mutations are shown as 0.50-2.50, whereas it would be preferable to show the "display" value of 1-2. Changing the "bounds" to [1, 2] does not solve the problem because samples with 1 mutation do not fit into those bounds.

Image

2. Coloring behavior seems to vary depending on whether samples are present within each bin

Here are 3 example datasets that differ in the number of samples, and whether the auspice_config.json has a "scale" section for the Percent reads mapped (note that all datasets have Number of drug resistant variants bins as described above, with no "scale" section):

Here is the 'Percent reads mapped' block WITH the "scale" section in the auspice_config.json:

{
    "key": "pct_reads_mapped",
    "title": "Percent reads mapped",
    "type": "continuous",
    "scale": [
      [80, "#DB2823"],
      [85, "#E1A13A"],
      [90, "#89BB6B"],
      [95, "#447DCC"],
      [100, "#5E1D9D"]
    ],
    "legend": [
      {"value": 82.5, "display": "80-85%",  "bounds": [80, 85]},
      {"value": 87.5, "display": "85-90%", "bounds": [85, 90]},
      {"value": 92.5, "display": "90-95%", "bounds": [90, 95]},
      {"value": 97.5, "display": "95-100%","bounds": [95, 100]}
    ]
  },

Comparing 8-sample datasets with and without "scale" coloring for Percent reads mapped:

Including "scale" results in expected coloring for the 4 bins. When excluding "scale", all 4 bins in the tree legend are the same color, but the tree nodes vary in color. I wonder if this is related to the fact that all 8 samples fall within one bin (95%-100%).

Image

Comparing 8-samples versus ~1000-samples datasets for Number of drug resistance variants:

The colors of the bins for Number of drug resistance variants on the phylogenies differs for these two datasets (note that no "scale" was used for this parameter). I wonder if this is related to the fact that the 8-sample tree only has samples with up to 5 drug resistance variants (whereas the bins go up to 11+ variants), whereas the ~1000 sample tree has samples with all the different drug resistance variants categories represented.

Image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions