Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Request to detect the mistake in a perl script for finding inter-substring distance from a large text file

by johngg (Abbot)
on Jan 24, 2012 at 10:25 UTC ( #949639=note: print w/ replies, xml ) Need Help??


in reply to Request to detect the mistake in a perl script for finding inter-substring distance from a large text file

A better way to count your bases would be to use tr.

knoppix@Microknoppix:~$ perl -Mstrict -wE ' > my $dna = q{CCATGNGTTATGNGTTACACGTNGTNTACG}; > my $b = length $dna; > my $A = $dna =~ tr{A}{}; > my $C = $dna =~ tr{C}{}; > my $G = $dna =~ tr{G}{}; > my $T = $dna =~ tr{T}{}; > my $e = $b - ( $A + $C + $G + $T ); > say qq{Number of bases - $b}; > say qq{A = $A; C = $C; G = $G; T = $T; err = $e};' Number of bases - 30 A = 5; C = 5; G = 7; T = 9; err = 4 knoppix@Microknoppix:~$

I hope this is helpful.

Cheers,

JohnGG


Comment on Re: Request to detect the mistake in a perl script for finding inter-substring distance from a large text file
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (18)
As of 2015-07-01 17:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (15 votes), past polls