cfe-lab / cfe-lab/MiCall

unpack_mixtures_and_reverse becomes computationally intractable when sequence has many ambiguous characters

Open
#637 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
21
Forks
11
Avg merge
12h 5m
Merged PRs (30d)
24

Description

https://github.com/cfe-lab/MiCall/blob/f79fca0d135dd08d22c4324f9e81bc819db813ce/micall/utils/probe_finder.py#L127

I traced a bug to this function where if the input argument seq contains too many ambiguous characters (ones that are resolved to many, i.e. '-' -> 'ACTG') then the function will hang because it attempts to resolve every possible sequence (which can be a very large number).

To correct this I count all mixture characters first and instantiate a count=1. For each mixture I multiply the count by the number of potential resolution characters. I.e. "A-A-" has 2 mixture characters, '-' resolves to A,C,T, or G so it can resolve to 4 potential sequences. Since I see two '-' characters I multiply the count by 4 twice. I then create a threshold (i.e. 1000) such that if the count (which equals the number of potential sequences) is greater than that number, this function returns with nothing.

Let me know if this is a viable solution or if you have a different or better proposal.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in micall/utils/probe_finder.py at unpack_mixtures_and_reverse, especially around line 127, and reproduce the hang with a sequence containing many ambiguous characters. Compare the behavior for ordinary inputs and highly ambiguous inputs; done means avoiding exhaustive expansion beyond a defined limit while preserving expected results for manageable sequences.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
bioinformatics
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.