parameters: (fasta_filename)
return_statement: return fasta_seqs
docstring: Returns a list of tuples (header, seq) for each record in the fasta file.
docstring_summary: Returns a list of tuples (header, seq) for each record in the fasta file.
docstring_tokens: Returns a list of tuples ( header seq ) for each record in the fasta file .
function: def load_fasta(fasta_filename):
      """
      Returns a list of tuples (header, seq) for each record in the fasta file.
      """
      if get_compression_type(fasta_filename) == 'gz':
          open_func = gzip.open
      else:  # plain text
          open_func = open
      fasta_seqs = []
      with open_func(fasta_filename, 'rt') as fasta_file:
          name = ''
          sequence = ''
          for line in fasta_file:
              line = line.strip()
              if not line:
                  continue
              if line[0] == '>':  # Header line = start of new contig
                  if name:
                      fasta_seqs.append((name.split()[0], sequence, name))
                      sequence = ''
                  name = line[1:]
              else:
                  sequence += line
          if name:
              fasta_seqs.append((name.split()[0], sequence, name))
      return fasta_seqs
function_tokens: def load_fasta ( fasta_filename ) : if get_compression_type ( fasta_filename ) == 'gz' : open_func = gzip . open else : # plain text open_func = open fasta_seqs = [ ] with open_func ( fasta_filename , 'rt' ) as fasta_file : name = '' sequence = '' for line in fasta_file : line = line . strip ( ) if not line : continue if line [ 0 ] == '>' : # Header line = start of new contig if name : fasta_seqs . append ( ( name . split ( ) [ 0 ] , sequence , name ) ) sequence = '' name = line [ 1 : ] else : sequence += line if name : fasta_seqs . append ( ( name . split ( ) [ 0 ] , sequence , name ) ) return fasta_seqs