[BioPython] Index Error: List index out of range

Jeffrey Chang jchang@SMI.Stanford.EDU
Fri, 20 Jul 2001 02:48:18 -0700 (PDT)


> def get_accession_num(fasta_record):
>     title_atoms = string.split(fasta_record.title)

Add some lines:
      assert title_atoms, "no title, %s" % fasta_record

>
>     accession_atoms = string.split(title_atoms[0], '|')

      assert len(accession_atoms) >= 2, "bad accession, %s" %
fasta_record.title


>
>     gb_name = accession_atoms[1]
>
>     return gb_name


Rerun your script (don't used -O), and see if it complains.

Jeff