Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^2: motif finding

by educated_foo (Vicar)
on Jan 31, 2012 at 13:55 UTC ( #950975=note: print w/ replies, xml ) Need Help??

in reply to Re: motif finding
in thread motif finding

Or, even more Perl-ish, with a bit less extra work (e.g. only one //g loop):

use Term::ANSIColor; open(READ,"<dna.txt"); $m = 'AGGGGG'; $_ = do { local $/; <READ> }; # read whole file s/\s+//g; # remove blanks s{$m}{ # search the string push @c, 1 - length($m) + pos; # remember position color('bold green').$m.color('reset'); # remember to reset! }eg; print "$_\n"; # print transformed string print "NUMBER OF SITES THE MOTIF ($m) IS PRESENT: ".@c."\n"; print "AND THE POSITION IN THE STRING IS:", join(',', @c), "\n\n";

Comment on Re^2: motif finding
Download Code
Replies are listed 'Best First'.
Re^3: motif finding
by Anonymous Monk on Oct 05, 2013 at 21:07 UTC
    my motif input is a file, how i can modified the program to make it work?

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2015-11-27 11:56 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (727 votes), past polls