docs: def old_parse_uniprot_txt_file(infile):
      """From: boscoh/uniprot github
      Parses the text of metadata retrieved from uniprot.org.
  
      Only a few fields have been parsed, but this provides a
      template for the other fields.
  
      A single description is generated from joining alternative
      descriptions.
  
      Returns a dictionary with the main UNIPROT ACC as keys.
      """
      with open(infile, 'r') as txt:
          cache_txt = txt.read()
          tag = None
          uniprot_id = None
          metadata_by_seqid = {}
          for l in cache_txt.splitlines():
              test_tag = l[:5].strip()
              if test_tag and test_tag != tag:
                  tag = test_tag
              line = l[5:].strip()
              words = line.split()
              if tag == "ID":
                  uniprot_id = words[0]
                  is_reviewed = words[1].startswith('Reviewed')
                  length = int(words[2])
                  metadata_by_seqid[uniprot_id] = {
                      'id': uniprot_id,
                      'is_reviewed': is_reviewed,
                      'length': length,
                      'sequence': '',
                      'accs': [],
                  }
                  entry = metadata_by_seqid[uniprot_id]
              if tag == "DT":
                  # DT   01-OCT-1996, integrated into UniProtKB/Swiss-Prot.
                  # DT   17-OCT-2006, sequence version 3.
                  # DT   22-JUL-2015, entry version 166.
                  comma_split = line.split(',')
                  if 'sequence version' in comma_split[1]:
                      # print 'sequence_version', comma_split[0],
                      # dateparse(comma_split[0]).date()
                      entry['sequence_version'] = str(
                          dateparse(comma_split[0]).date())
                  elif 'entry version' in comma_split[1]:
                      # print 'entry_version', comma_split[0],
                      # dateparse(comma_split[0]).date()
                      entry['entry_version'] = str(
                          dateparse(comma_split[0]).date())
              if tag == "SQ":
                  if words[0] != "SEQUENCE":
                      entry['sequence'] += ''.join(words)
              if tag == "AC":
                  accs = [w.replace(";", "") for w in words]
                  entry['accs'].extend(accs)
              if tag == "DR":
                  if len(words) > 0:
                      if 'PDB' in words[0]:
                          if 'pdb' not in entry:
                              entry['pdb'] = words[1][:-1]
                          if 'pdbs' not in entry:
                              entry['pdbs'] = []
                          entry['pdbs'].append(words[1][:-1])
                      if 'RefSeq' in words[0]:
                          if 'refseq' not in entry:
                              entry['refseq'] = []
                          ids = [w[:-1] for w in words[1:]]
                          entry['refseq'].extend(ids)
                      if 'KEGG' in words[0]:
                          if 'kegg' not in entry:
                              entry['kegg'] = []
                          ids = [w[:-1] for w in words[1:]]
                          ids = filter(lambda w: len(w) > 1, ids)
                          entry['kegg'].extend(ids)
                      if 'GO' in words[0]:
                          if 'go' not in entry:
                              entry['go'] = []
                          entry['go'].append(' '.join(words[1:]))
                      if 'Pfam' in words[0]:
                          if 'pfam' not in entry:
                              entry['pfam'] = []
                          entry['pfam'].append(words[1][:-1])
              if tag == "GN":
                  if 'gene' not in entry and len(words) > 0:
                      pieces = words[0].split("=")
                      if len(pieces) > 1 and 'name' in pieces[0].lower():
                          entry['gene'] = pieces[1].replace(
                              ';', '').replace(',', '')
              if tag == "OS":
                  # OS   Homo sapiens (Human).
                  if 'organism' not in entry:
                      entry['organism'] = ""
                  entry['organism'] += line
              if tag == "DE":
                  if 'descriptions' not in entry:
                      entry['descriptions'] = []
                  entry['descriptions'].append(line)
              if tag == "CC":
                  if 'comment' not in entry:
                      entry['comment'] = ''
                  entry['comment'] += line + '\n'
  
          for entry in metadata_by_seqid.values():
              descriptions = entry['descriptions']
              for i in reversed(range(len(descriptions))):
                  description = descriptions[i]
                  if 'Short' in description or 'Full' in description or 'EC=' in description:
                      if 'Short' in description or 'Full' in description:
                          j = description.find('=')
                          descriptions[i] = description[j + 1:].replace(';', '')
                          if 'description' not in entry:
                              entry['description'] = []
                          entry['description'].append(descriptions[i])
                      if 'EC=' in description:
                          j = description.find('=')
                          descriptions[i] = description[j + 1:].replace(';', '')
                          if '{' in descriptions[i]:
                              descriptions[i] = descriptions[i].split(' {')[0]
                          if 'ec' not in entry:
                              entry['ec'] = []
                          entry['ec'].append(descriptions[i])
                  else:
                      del descriptions[i]
  
      return metadata_by_seqid