andersen-lab / Freyja

Depth-weighted De-Mixing
BSD 2-Clause "Simplified" License
102 stars 29 forks source link

Low-frequency lineage dropout in plot and dashboard #152

Closed ktmeaton closed 1 year ago

ktmeaton commented 1 year ago

Hi Freyja team!

When plotting historical data (ex. a year in retrospect), I noticed that lineages would unexpectedly drop out of the plot and dashboard. These seemed to be very recent lineages (ex. XBB.2.3*) that have high prevalence only in the last couple weeks. I don't fully understand this, but when I changed the thresh default value in prepLineageDict from 0.001 to 0.0, these new lineages reappeared!

Relevant line: https://github.com/andersen-lab/Freyja/blob/e5995bad0b0fdfcd1ee742a94713e9d7836cb3fd/freyja/utils.py#L186

Would it be possible to set the default to thresh=0.0 or alternatively, give freyja plot a --thresh param to control this?

Thanks!

ktmeaton commented 1 year ago

Or maybe get_abundance can pass its thresh parameter to prepLineageDict? I think that would at least solve it when creating a dashboard.

https://github.com/andersen-lab/Freyja/blob/e5995bad0b0fdfcd1ee742a94713e9d7836cb3fd/freyja/utils.py#L485-L488

joshuailevy commented 1 year ago

Hi @ktmeaton!

Good point, both plot and dash function should probably be modified such that thresholding is taken care of via the prepLineageDict function.

I'm in favor of a --thresh option to control this behavior for plot. We'll adjust the implementation of get_abundance so that thresholding is done much the same way with prepLineageDict. Should be a quick fix, we'll include this in the next release.

Thanks! Josh

joshuailevy commented 1 year ago

Solved in #156. thanks @ktmeaton for bringing this up!