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

Extend lists for simulation in genome mode to avoid IndexError #233

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

lcoombe
Copy link
Member

@lcoombe lcoombe commented Oct 8, 2024

  • In genome mode, it was possible to get IndexErrors like those reported in head_vs_ht_ratio = head_vs_ht_ratio_list[each_read] IndexError: list index out of range #228 if the lengths of two accessory lists happened to be shorter than the number of remaining reads to simulate
    • In the previous version of the code, multipliers were used to sample more data points from the distributions
    • In many cases, these were sufficient, but not in all cases, particularly when the number of remaining reads was smaller
  • Refactored that logic into a separate method, and added a loop to increase the multipliers until both lists are longer than the number of remaining reads to avoid getting that error
  • Added an iteration limit to avoid an edge case that lead to an infinite loop - I can't see how in practice this would happen, though

Copy link
Member

@parham-k parham-k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me.

@lcoombe lcoombe merged commit 19002e1 into master Oct 9, 2024
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.

2 participants