title: Python: losing nucleotides from fasta file to dictionary
body: <p>I am trying to write a code to extract longest ORF in a fasta file. It is from Coursera Genomics data science course.</p>
  
  <p>the file is a practice file: "dna.example.fasta"</p>
  
  <p>Data is here:<a href="https://d396qusza40orc.cloudfront.net/genpython/data_sets/dna.example.fasta" rel="nofollow noreferrer">https://d396qusza40orc.cloudfront.net/genpython/data_sets/dna.example.fasta</a></p>
  
  <p>Part of my code is below to extract <strong>reading frame 2</strong> (start from the second position of a sequence. eg: seq: ATTGGG, to get reading frame 2: TTGGG):</p>
  
  <pre><code>#!/usr/bin/python
  
  
  import sys
  import getopt
  
  o, a = getopt.getopt(sys.argv[1:], 'h')
  
  opts = dict()
  for k,v in o:
          opts[k] = v
          if '-h' in k:
                  print "--help\n"
  
  if len(a) &lt; 0:
          print "missing fasta file\n"
  
  
  
  f = open(a[0], "r")
  
  
  seq = dict()
  for line in f:
  
          line = line.strip()
  
          if line.startswith("&gt;"):
                  name = line.split()[0]
  
                  seq[name] = ''
  
          else:
                  seq[name] = seq[name] + line[1:]
  
  
  k = seq["&gt;gi|142022655|gb|EQ086233.1|323"]
  print len(k)
  </code></pre>
  
  <p>The length of this particular sequence should be 4804 bp. Therefore by using this sequence alone I could get the correct answer.
  However, with the code, here in the dictionary, this particular sequence becomes only 4736 bp.</p>
  
  <p>I am new to python, so I can not wrap my head around as to where did those 100 bp go?</p>
  
  <p>Thank you,</p>
  
  <p>Xio</p>