use strict; use warnings; #### use strict; use warnings; use Bio::SeqIO; my $seq_file = 'D:/Motif Search/sequence.txt'; my $mot_file = 'D:/Motif Search/motif.txt'; my $in = Bio::SeqIO->new( #sequences object -format => 'fasta', -file => $seq_file, ); my $mot = Bio::SeqIO->new( #motifs object -format => 'fasta', -file => $mot_file ); my @motifs; while ( my $motif = $mot->next_seq ) { #read in motifs my $motif_string = $motif->seq; #stringify motifs push @motifs, $motif_string; } while ( my $seq = $in->next_seq ) { my $string = $seq->seq; foreach my $motif (@motifs) { if ( $string =~ /$motif([agct]+)[AGCT]/ ) { print "'$motif' ", length $1, " bases away at ", $seq->id, "\n"; } } } ####