[Bioperl-l] While running without stop

Kevin Brown Kevin.M.Brown at asu.edu
Thu May 19 18:48:28 UTC 2011


This is a problem with accessing objects, IIRC.

Try doing something like:

my $in  = Bio::SeqIO->new(-file => $file , '-format' => 'fasta');
while ( my $seq = $in->next_seq() )
{
    my $sequence = $seq->seq;
    while ($sequence =~ m/(ATCGA)/){
	print "ATCGA commence à la position $-[1]\nse termine juste avant la
position $+[1]\n";
	}
}

Kevin Brown
Center for Innovations in Medicine
Biodesign Institute
Arizona State University 

> -----Original Message-----
> From: bioperl-l-bounces at lists.open-bio.org [mailto:bioperl-l-
> bounces at lists.open-bio.org] On Behalf Of debutant.bioperl
> Sent: Thursday, May 19, 2011 11:00 AM
> To: Bioperl-l at lists.open-bio.org
> Subject: [Bioperl-l] While running without stop
> 
> 
> 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.
> 
> 
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l




More information about the Bioperl-l mailing list