Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

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";

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2018-06-25 05:11 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.