I have one fasta file which has 30 sequences and pattern file which contain different motifs.
I need to match my motifs with fasta sequences and location in which it is authenticated should be highlight like this :
The script which I have developed until now :
# biopython
from Bio import SeqIO
# regex library
import re
# file with FASTA sequence
infile = r"C:UsersLenovoDesktopfnlpythPromoter Sequence.fasta"
# pattern to search for
iupac = 'GGCA'
# look through each FASTA sequence in the file
for seq_record in SeqIO.parse(infile, "fasta"):
print ("Sequence ID: ", seq_record.id, "; ", len(seq_record), "bp")
print (seq_record.seq)
print(iupac)
# scan for IUPAC; re.I makes search case-insensitive
matches = re.findall( iupac, str(seq_record.seq), re.I)
if matches:
print ("Matches = ", len(matches))
I need help to complete this script?