title: Getting "NoneType object is not subscriptable" when creating fasta file
body: <p>I am trying to create a multiple alignment fasta file from an user search of a gen and a sequence. To create this fasta file I am using the following:</p>
  <pre><code>for seq in fasta_result:
          ofile.write(&quot;&gt;&quot; + names[x] + &quot;\n&quot; + fasta_result[y] + &quot;\n&quot;)
          x +=1
          y +=1
  </code></pre>
  <p>This is working fine as long as the name list is a simple list:</p>
  <pre><code>names = ['name_1','name_2','name_3','name_4'] 
  </code></pre>
  <p>It gives me a fasta file with the intended result. However, my intention is that instead of generic names like 'name_1', 'name_2', etc... I want to get the names of the genomes.</p>
  <p>I have a function that does the job:</p>
  <pre><code>example = 'Rv0001'
  genome = 'tuberculosis'
  print(alignment_search(example, genome)
  </code></pre>
  <p>The result is a list:</p>
  <pre><code>['Rv0001', 'MSMEG_RS33460', 'MRA_RS00005', 'BQ2027_RS00005']
  </code></pre>
  <p>However, when I modify the first part of the code to have:</p>
  <pre><code>names = alignment_search(example, genome)
  </code></pre>
  <p>I get the following error:</p>
  <pre><code>---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  /var/folders/pq/ghtv3wj159j681vy0ny3tz9w0000gp/T/ipykernel_34390/940860269.py in &lt;module&gt;
       18 genome = genome_location(before, after, alignment)
       19 
  ---&gt; 20 filename = custom_fasta(genome, example, genome)
       21 
       22 aln = AlignIO.read('/Users/dissertation/Documents/Dissertation-real/cgi-mycoapollo/db/genomes/' + filename + '_out.fasta','fasta')
  
  /var/folders/pq/ghtv3wj159j681vy0ny3tz9w0000gp/T/ipykernel_34390/573793128.py in custom_fasta(locations_dict, example, genome)
       55 
       56     for seq in fasta_result:
  ---&gt; 57         for value in names:
       58             ofile.write(&quot;&gt;&quot; + names[x] + &quot;\n&quot; + fasta_result[y] + &quot;\n&quot;)
       59 
  
  TypeError: 'NoneType' object is not iterable
  </code></pre>
  <p>I am not sure why it gives me this error, I have checked that the result of the function alignment_search(example, genome) is indeed a list type:</p>
  <pre><code>print(type(alignment_search(example, genome)))
  &lt;class 'list'&gt;
  </code></pre>
  <p>So why is it working with a simple list but when it depends on the result of a function it gives the NoneType error?</p>
  <p>Thanks!</p>