Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by johngg (Canon)
on Jan 24, 2012 at 10:25 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://949639]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2024-04-18 06:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found