[Bioperl-l] While running without stop
debutant.bioperl
joyeux2000 at hotmail.fr
Thu May 19 18:00:27 UTC 2011
Hello all,
The following perl script looks for the pattern in each line (line of the
fasta format that begins with">" : sequence).
............................................................................................................................................
#!/usr/bin/perl
use strict;
use warnings;
use Bio::SeqIO;
my $file = 'eee.txt';
my $in = Bio::SeqIO->new(-file => $file , '-format' => 'fasta');
while ( my $seq = $in->next_seq() )
{
while ($seq->seq =~ m/(ATCGA)/){
print "ATCGA commence à la position $-[1]\nse termine juste avant la
position $+[1]\n";
}
}
............................................................................................................................................
the problem that the while of:
..................................................................................................
while ($seq->seq =~ m/(ATCGA)/){
print "ATCGA commence à la position $-[1]\nse termine juste avant la
position $+[1]\n";
}
..................................................................................................
Runs continuously and always gives the same result.
... ATCG commence Ó la position 172
se termine juste avant la position 176
ATCG commence Ó la position 172
se termine juste avant la position 176
ATCG commence Ó la position 172
se termine juste avant la position 176 ...
And if we use "if" instead of While he finds only the first pattern (case),
otherwise, if more than one pattern in the same sequence, he finds only the
first.
Please, have you any idea to fix this code so that:
While research patterns and ends.
Or
For If, when he finds a pattern he went to the next letter and not the next
sequence and found many motifs per sequence.
Cordially
--
View this message in context: http://old.nabble.com/While-running-without-stop-tp31658279p31658279.html
Sent from the Perl - Bioperl-L mailing list archive at Nabble.com.
More information about the Bioperl-l
mailing list