Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overinflated stepwise copy number values from multiple annotations on same gene #2176

Merged
merged 5 commits into from
Nov 16, 2023

Conversation

ivagljiva
Copy link
Contributor

This very simple PR fixes issue #2173 and another bug that I found along the way. The fix and its caveats are detailed in #2173, but to summarize:

  • in most cases, multiple annotations to the same gene are direct alternatives in a given pathway, which means that we can arbitrarily keep one annotation and ignore the rest of them. This is what the new function get_dereplicated_enzyme_hits_for_step_in_module() does before each step's copy number is calculated from the annotation data.
  • an edge case occurs when the multiple enzyme annotations to that one gene are in a more complex relationship with each other. The simplistic fix might undercount the step copy number in this case, depending on which enzyme annotation was arbitrarily kept for the dereplicated annotation set
  • I couldn't figure out a better algorithm that handles the edge case properly, so I settled for warning the user about it instead
  • the other new function are_enzymes_indirect_alternatives_within_step is used to detect the edge cases. It does NOT perfectly detect all indirect relationships between all enzymes in a step and should not be used generally for that purpose, but it works okay for the limited use-case of warning the user about specific overlapping annotations. See [BUG] Genes with multiple annotations overinflate stepwise pathway copy number values #2173 for an example warning.

In short, stepwise copy numbers will no longer be inflated when one gene has multiple annotations. In the worst case, they may be too low rather than too high.

Finally, there was another bug that was also contributing to the inflation of step copy numbers in some cases -- missing annotations for direct alternatives were not counted as 0s if they were the first out of all the alternatives to be considered. This and its fix are also described in #2173, and I will note that it is perhaps the more important of the two fixes because it was not obvious and it affected more modules (15, in my test data, compared to 8 for the multiple annotations bug).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Genes with multiple annotations overinflate stepwise pathway copy number values
1 participant