Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Calculating the number of possible matches with N mismatches for DNA? [Solved!]

by hdb (Monsignor)
on May 27, 2015 at 07:22 UTC ( [id://1127939]=note: print w/replies, xml ) Need Help??


in reply to Calculating the number of possible matches with N mismatches for DNA? [Solved!]

You can simplify the calculation to

sub NwithM { my $f = 4-1; my( $L, $M ) = @_; my $T=1; my $tmp = 1; for my $m ( 1 .. $M ) { $tmp *= ($L-$m+1)/$m*$f; $T += $tmp; } return $T; }
  • Comment on Re: Calculating the number of possible matches with N mismatches for DNA? [Solved!]
  • Download Code

Replies are listed 'Best First'.
Re^2: Calculating the number of possible matches with N mismatches for DNA? [Solved!]
by BrowserUk (Patriarch) on May 27, 2015 at 07:35 UTC

    Accumulating partial solutions for input to later iterations. I doubt I would ever have seen that. Very nice. Thank you.


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
    In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1127939]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2024-04-24 05:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found