Finding motifs: fasta file with 10,000 sequences I am new to Python. I am trying to parse a fasta file containing 10,000 sequences to look for motifs (microsatellites in particular). I tried using Seq Utils to parse my sequences for a particular motif, that is, (TG)20. I suspect because I used the string function (str), it treated the entire fasta file as a one single fasta sequence. I then tried using BruteForce on the motif (TG)17 and found that an error appeared which said that &quot;...the object of type 'FastaIterator' has no len()...&quot;. The script however worked when only a single sequence was in the fasta file.
In essence, I need some help figuring out how to:

Prepare an instances object(is this correct?) with microsatellite
motifs (for starters, I intend to parse the sequences for dinucleotide repeats (TG)10,(AC)10,(AT)10
and (AG)10;
Parse my 10,000 long sequence file using this object(?); and
Print an output specifying which of my sequences contain microsatellite motifs.

Appreciate any help I can get on this.
#Seq Utils to find Motifs
&gt;&gt;&gt; pattern = Seq(&quot;TGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTG&quot;) 
&gt;&gt;&gt; sequence = Seq(a)
&gt;&gt;&gt; results = SeqUtils.nt_search(str(a),pattern)
&gt;&gt;&gt; print(results)
['TGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTG', 38, 40, 42, 44, 46, 48, 50, 52, 54,
 56, 58, 68682, 68684, 68686, 370986, 370988, 370990, 370992, 370994, 370996, 43
8620, 438622, 438624, 438626, 438628, 438630, 438632, 438634, 438636, 438638, 43
8640, 556703, 556705, 556707, 784973, 784.... # it's too long so I am just pasting the first few lines

#BrutForce to find Motifs in a fasta file containing 10,000 sequences
&gt;&gt;&gt; def BruteForce(s, t):
...     occurrences = []
...     for i in range(len(s)-len(t)+1):
...         match = True
...         for j in range(len(t)):
...             if s[i+j] != t[j]:
...                 match = False
...                 break
...         if match:
...             occurrences.append(i)
...             
...     print(occurrences)
...     
... 

&gt;&gt;&gt; t = &quot;TGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTGTG&quot;
&gt;&gt;&gt; len(t)
34
&gt;&gt;&gt; s = SeqIO.parse(&quot;group23.fas&quot;, &quot;fasta&quot;)

&gt;&gt;&gt; BruteForce(s,t)
Traceback (most recent call last):
  File &quot;&lt;console&gt;&quot;, line 1, in &lt;module&gt;
  File &quot;&lt;console&gt;&quot;, line 3, in BruteForce
TypeError: object of type 'FastaIterator' has no len()

#BrutForce to find Motifs in a fasta file containing a single sequence
&gt;&gt;&gt; s = SeqIO.read(&quot;group23v.fas&quot;, &quot;fasta&quot;)
&gt;&gt;&gt; BruteForce(s,t)
[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 79, 98, 117, 175, 193, 198, 217, 221, 277, 279, 282, 289, 294, 304, 311, 335, 381, 437, 464, 468, 510, 514, 522, 593, 602, 622, 634, 647, 658, 678, 704, 727, 750, 773, 804, 889, 895, 908, 911, 922, 937, 969, 975, 978, 1002]
Bio.SeqIO.parse() returns a SeqRecord iterator. To access the sequence of this sequence record, you need to use the .seq attribute so you should update your s with s.seq.