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

Re: nested foreach loop, match DNA sequences and calculate score

by Cristoforo (Curate)
on Dec 18, 2012 at 19:34 UTC ( #1009448=note: print w/replies, xml ) Need Help??


in reply to nested foreach loop, match DNA sequences and calculate score

To show another way to calculate the matches.
#!/usr/bin/perl use strict; use warnings; my $fasta1 = 'GGGTATTCCTTCTCCACCTTGCAGCTAACATCAGTGTTTCGTCTACTCAAGCACGC +CAAC'; my $fasta2 = 'ACGCCCTAGAGCGCCCTGTCCAGGGGATGGCAACCAACTCTGACCCTGCAAGTGCA +GCAG'; my $matched = ($fasta1 ^ $fasta2) =~ tr/\0//; my $non_match = length($fasta1) - $matched; print "matched: $matched\n"; print "non_matched: $non_match\n";
This prints:
matched: 15 non_matched: 45

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1009448]
help
Chatterbox?
[Corion]: Veltro: This is due to the fact that one of our webservers doesn't have "our" https certificate but another https certificate. Work is underway (well, on my long, long to-do list) to switch even that server over to "our" certificate
[Veltro]: Corion OK, thanks. At least I understand it now.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (9)
As of 2018-05-23 11:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?