docs: def build_proteintable(pqdb, headerfields, mergecutoff, isobaric=False,
                         precursor=False, probability=False, fdr=False,
                         pep=False, genecentric=False):
      """Fetches proteins and quants from joined lookup table, loops through
      them and when all of a protein's quants have been collected, yields the
      protein quant information."""
      pdmap = create_featuredata_map(pqdb, genecentric=genecentric,
                                     psm_fill_fun=pinfo.add_psms_to_proteindata,
                                     pgene_fill_fun=pinfo.add_protgene_to_protdata,
                                     count_fun=pinfo.count_peps_psms,
                                     get_uniques=True)
      empty_return = lambda x, y, z: {}
      iso_fun = {True: get_isobaric_quant, False: empty_return}[isobaric]
      ms1_fun = {True: get_precursor_quant, False: empty_return}[precursor]
      prob_fun = {True: get_prot_probability,
                  False: empty_return}[probability]
      fdr_fun = {True: get_prot_fdr,
                 False: empty_return}[fdr]
      pep_fun = {True: get_prot_pep,
                 False: empty_return}[pep]
      pdata_fun = {True: get_protein_data_genecentric,
                   False: get_protein_data}[genecentric is not False]
      protein_sql, sqlfieldmap = pqdb.prepare_mergetable_sql(precursor, isobaric,
                                                             probability, fdr,
                                                             pep)
      accession_field = prottabledata.ACCESSIONS[genecentric]
      proteins = pqdb.get_merged_features(protein_sql)
      protein = next(proteins)
      outprotein = {accession_field: protein[sqlfieldmap['p_acc']]}
      check_prot = {k: v for k, v in outprotein.items()}
      if not mergecutoff or protein_pool_fdr_cutoff(protein, sqlfieldmap,
                                                    mergecutoff):
          fill_mergefeature(outprotein, iso_fun, ms1_fun, prob_fun, fdr_fun,
                            pep_fun, pdata_fun, protein, sqlfieldmap,
                            headerfields, pdmap, accession_field)
      for protein in proteins:
          if mergecutoff and not protein_pool_fdr_cutoff(protein, sqlfieldmap,
                                                         mergecutoff):
              continue
          p_acc = protein[sqlfieldmap['p_acc']]
          if p_acc != outprotein[accession_field]:
              # check if protein has been filled, otherwise do not output
              # sometimes proteins have NA in all fields
              if outprotein != check_prot:
                  yield outprotein
              outprotein = {accession_field: p_acc}
              check_prot = {k: v for k, v in outprotein.items()}
          fill_mergefeature(outprotein, iso_fun, ms1_fun, prob_fun, fdr_fun,
                            pep_fun, pdata_fun, protein, sqlfieldmap,
                            headerfields, pdmap, accession_field)
      if outprotein != check_prot:
          yield outprotein