getting the count of 16384 patterns in a large string(sequence)
You say "16384 patterns", but you do not show us what those patterns look like?
You say "in a large sequence", but you are processing a hash of sequences. How many sequences are in the hash? How long are they?
You say "the code is very slow", without saying how slow, or what order of improvement you are seeking.
You are slowing your code down by chomping inside the inner loop, which will be redundant after the first time.
You are also studying the sequences -- a slow process, that may or may not be benefitting you -- inside the inner loop; which means that you will study each sequence once for each pattern. There is no benefit to studying a string more than once.
If you are serious about improving the performance of this code, you will need to supply considerably more information. A few sample patterns and a sample sequence -- are they just ACGT; or do they contains the full range of nucleic acid codes ACGTURYKMSWBDHVNX-; or the full range of amino acid codes: ABCDEFGHIJKLMNOPQRSTUVWYZX*-; ?
The better teh info you supply, the more likely that you will get an effective solution.
In reply to Re: counting the number of 16384 pattern matches in a large DNA sequence
by BrowserUk
in thread counting the number of 16384 pattern matches in a large DNA sequence
by anonym
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |