Repository navigation
Fix distance with multiple samples and ambigous bases - #98
Conversation
Move to the distance function itself Fixes ambiguous bases still being included in multi-sample comparisons
|
@rderelle Could you try this code on your test case? |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #98 +/- ##
==========================================
+ Coverage 94.41% 94.90% +0.49%
==========================================
Files 25 25
Lines 4098 3630 -468
==========================================
- Hits 3869 3445 -424
+ Misses 229 185 -44 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@johnlees Distances working well: I'm getting stable distances between A and B in all conditions (2 isolates and m=0; 2 isolates and m=0.9; 56 isolates and m=0; 56 isolates and m=0.9). -> no need to change min-freq threshold value (only the doc '0.9' -> '0') |
|
There might be an issue with Mismatches though: the values I get do not make sense to me. If the number of SNP is constant, we should get higher proportion of mismatches at m=0.9 compared to m=0. However, I'm observing the opposite: with m=0: |
|
Mismatches I interpret as an estimate of the proportion of the genome that's alignable/been aligned. This could include the k-mers filtered out by min-freq if you interpret these all as unalignable; or you could exclude them (the current behaviour) if you interpret them as low quality data that shouldn't contribute to this estimate. I was actually unsure whether to keep min-freq when changing this as it is based on the whole population, when it's probably more intuitive to work just on the pairwise comparisons. I preferred the default of zero because I thought that including distances from a highly variable region between a pair of samples makes the most sense – it's really more in the whole population alignment that min-freq is useful for removing columns that only a few samples have. So I'm not really sure what's right or expected here. I can see in your example that feels a bit unintuitive, but if you consider the min-freq filter as only considering the high quality/constant areas of the genome then in those areas there are no mismatches. It almost feels like separating out these two terms might be best, and indeed if you run with But I could also easily change this so the min-freq filtered k-mers contribute to mismatches. What do you think? |
|
@johnlees I thought Mismatches corresponded to the ratio of SNPs divided by shared kmers but, looking closely at the code, your definition is the correct one (proportion of non-aligned genome). Then the values observed at m=0 and m=0.9 are the expected ones (most non-aligned split-kmers are discarded at m=0.9 leading to Mismatches = 0). No bug, my mistake. That said, the metric makes a little less sense when filtering is applied because the set of considered split k-mers does not represent the whole genome anymore, so good news we are keeping m=0. :) Up to you, but I would keep Mismatches as it is as I do not have any strong alternative preference. |
|
Thanks for your input! I might make a little addition to the docs about the interpretation of mismatches and otherwise leave as-is |
Fixes an issue where distances can be reported differently with >2 samples
Also:
Closes #97