title: Searching multiple lines as a single sequence
body: <p>I have some DNA sequencing data, that is in a Fasta format:</p>
  <p>Example</p>
  <p>Seq1</p>
  <p>CTTGGCAAGCAACACTTCAGGAACCGATTACCAGTGTACCTTCGTCGATGTAGAGTCCTA
  TATCTCCTCTTAGAGTTAGACAGGCGATTACCAGTCAGATCTCCAGTCAGGACTCCAGTC
  AGTAGCTATCAACGATACTGACTCTAGATG</p>
  <p>I am trying to find a specific sequence and then write out the next 7 letters. I have a code that worked when my Fasta was in a single line format:</p>
  <p>Example:</p>
  <p>Seq1
  CTTGGCAAGCAACACTTCAGGAACCGATTACCAGTGTACCTTCGTCGATGTAGAGTCCTATATCTCCTCTTAGAGTTAGACAGGCGATTACCAGTCAGATCTCCAGTCAGGACTCCAGTCAGTAGCTATCAACGATACTGACTCTAGATG</p>
  <p>The code I was using is below:</p>
  <pre><code>import re    
  
  infile = &quot;/home/Desktop/FASTA Test.fasta&quot;
      with open(infile, &quot;r&quot;) as seq, open(&quot;Fasta_Test.fa&quot;, &quot;w&quot;) as w:
          for i, line in enumerate(seq):
              if not &quot;&gt;&quot; in line:
                  m = re.search(&quot;(?&lt;=AGTCAGTAGC)...C...&quot;, line)
                  if not m == None:
                      w.write(&quot;%s \n %s \n&quot;% (&quot;&gt;seq&quot;+str(int((i+1)/2)), m.group(0)))
  </code></pre>
  <p>This code would just spit out a list in the format</p>
  <p>Seq 1
  TATCAAC</p>
  <p>The issue I am having with the multiline format is searching the fasta as a continuous sequence string. I am fairly new to python, so there is probably an easy solution, but I can not find it (or the right words to search to find it).</p>