import sqlite3


def get_pdb_chain_subset(db, gene, use_cutoffs = False, res_cutoff = 2.8, rfac_cutoff = .3):
    """
    Return a list of tuples of [pdb, chain] of the particular gene
    """
    #print db_fname

    db.row_factory = sqlite3.Row
    c = db.cursor()
    if not use_cutoffs:
        c.execute("SELECT DISTINCT PDB, original_chain FROM cdr_data WHERE gene =?", (gene,))
    else:
        c.execute("SELECT DISTINCT PDB, original_chain FROM cdr_data WHERE gene = ? and resolution <= ? and rfactor <= ?", [gene, res_cutoff, rfac_cutoff])
    rows = c.fetchall()
    entries = []
    for row in rows:

        list(row.keys())
        entries.append([row['PDB'],row['original_chain']])
    return entries