in reply to grep the whole element in an array
However, on another note, its probably better to post Bioperl questions on the bioperl mailing list. Google for it.use strict; # you do use strict don't you? use Bio::SeqIO; # your file containing the patterns open (INP,"data.txt") || die "cant find it!"; while (my $line = <INP>) { chomp $line; # separate pattern from filename my ($filename,$pattern) = split (/\s+/,$line); #open the file that should be searched my $seqio_object = Bio::SeqIO->new(-file => $filename, -format=>"fas +ta"); #loop through all the fasta sequences while ($seq_object = $seqio_object->next_seq){ my $sequence = $seq_object->seq; my $id = $seq_object->display_id; #check if pattern exists if ($sequence =~ /$pattern/g) { print "$pattern found in $id in file $filename\n"; } } }
----------------------
"with perl on my side"
|
|---|