Ejemplo n.º 1
0
def trans_topface():
    topface = lt.pickle_load(t_f)
    basic = ['K', 'R', 'H']
    acid = ['D', 'E']
    aromatic = ['F', 'W', 'Y']
    polar = ['S', 'T', 'C', 'P', 'N', 'Q']
    nonpolar = ['G', 'V', 'L', 'I', 'M', 'A']
    res_hash = {'K':'b','R':'b','H':'b','D':'a','E':'a','S':'p','T':'p','C':'p','P':'p',\
            'N':'p','Q':'p','G':'n','V':'n','L':'n','I':'n','M':'n','A':'n','*':'*'}
    transed_topface = {}
    for p, h in topface:
        h_new = [res_hash[i] for bla in h for i in bla]
        h_new = [''.join(h_new[i:i + 3]) for i in range(0, len(h_new), 3)]
        transed_topface[p] = h_new
Ejemplo n.º 2
0
def read_pickle():
    for f in lt.files_in_dir(sys.argv[-1]):
        if 'hbplus' in f:
            hbplus_neighbors = lt.pickle_load(f)
        if 'salt' in f:
            salt_neighbors = lt.pickle_load(f)

    hbplus_neighbors_dic = OrderedDict()
    for pdb_id, res, neighbors in hbplus_neighbors:
        hbplus_neighbors_dic[(pdb_id, res)] = neighbors
    salt_neighbors_dic = {}
    for pdb_id, res, neighbors in salt_neighbors:
        salt_neighbors_dic[(pdb_id, res)] = neighbors

    combine_neighbors = []
    for k, v in hbplus_neighbors_dic.iteritems():
        if k in salt_neighbors_dic.keys():
            v.extend(salt_neighbors_dic[k])
            v = set(v)
            combine_neighbors.append((k[0], k[1], v))
        else:
            combine_neighbors.append((k[0], k[1], v))

    return combine_neighbors
Ejemplo n.º 3
0
def hotsta_classify():
    seq = {
        'A': 0,
        'R': 0,
        'N': 0,
        'D': 0,
        'C': 0,
        'Q': 0,
        'E': 0,
        'G': 0,
        'H': 0,
        'I': 0,
        'L': 0,
        'K': 0,
        'M': 0,
        'F': 0,
        'P': 0,
        'S': 0,
        'T': 0,
        'W': 0,
        'Y': 0,
        'V': 0
    }
    hot = lt.pickle_load(sys.argv[-1])
    basic = ['K', 'R', 'H']
    acid = ['D', 'E']
    aromatic = ['F', 'W', 'Y']
    polar = ['S', 'T', 'C', 'P', 'N', 'Q']
    nonpolar = ['G', 'V', 'L', 'I', 'M', 'A']
    r1 = {'basic': 0, 'acid': 0, 'aromatic': 0, 'polar': 0, 'nonpolar': 0}
    r2 = {'basic': 0, 'acid': 0, 'aromatic': 0, 'polar': 0, 'nonpolar': 0}
    d1 = {'basic': 0, 'acid': 0, 'aromatic': 0, 'polar': 0, 'nonpolar': 0}
    sta = {'basic': 0, 'acid': 0, 'aromatic': 0, 'polar': 0, 'nonpolar': 0}
    for pro_name, pro_hot in hot.iteritems():
        for h in pro_hot:
            if h[0] in basic:
                r1['basic'] += 1
                sta['basic'] += 1
            elif h[0] in acid:
                r1['acid'] += 1
                sta['acid'] += 1
            elif h[0] in aromatic:
                r1['aromatic'] += 1
                sta['aromatic'] += 1
            elif h[0] in polar:
                r1['polar'] += 1
                sta['polar'] += 1
            elif h[0] in nonpolar:
                r1['nonpolar'] += 1
                sta['nonpolar'] += 1
            if h[1] in basic:
                r2['basic'] += 1
                sta['basic'] += 1
            elif h[1] in acid:
                r2['acid'] += 1
                sta['acid'] += 1
            elif h[1] in aromatic:
                r2['aromatic'] += 1
                sta['aromatic'] += 1
            elif h[1] in polar:
                r2['polar'] += 1
                sta['polar'] += 1
            elif h[1] in nonpolar:
                r2['nonpolar'] += 1
                sta['nonpolar'] += 1
            if h[2] in basic:
                d1['basic'] += 1
                sta['basic'] += 1
            elif h[2] in acid:
                d1['acid'] += 1
                sta['acid'] += 1
            elif h[2] in aromatic:
                d1['aromatic'] += 1
                sta['aromatic'] += 1
            elif h[2] in polar:
                d1['polar'] += 1
                sta['polar'] += 1
            elif h[2] in nonpolar:
                d1['nonpolar'] += 1
                sta['nonpolar'] += 1
    fname = lt.fname(sys.argv[-1])
    lt.write_sta_dict(r1, fname + 'R1_hot_rc_sta')
    lt.write_sta_dict(r2, fname + 'R1_2_hot_rc_sta')
    lt.write_sta_dict(d1, fname + 'D_1_hot_rc_sta')
    lt.write_sta_dict(sta, fname + 'R1_R1_2_D_1_hot_rc_sta')
Ejemplo n.º 4
0
def hotsta():
    hot = lt.pickle_load(sys.argv[-1])
    r1 = {
        'A': 0,
        'R': 0,
        'N': 0,
        'D': 0,
        'C': 0,
        'Q': 0,
        'E': 0,
        'G': 0,
        'H': 0,
        'I': 0,
        'L': 0,
        'K': 0,
        'M': 0,
        'F': 0,
        'P': 0,
        'S': 0,
        'T': 0,
        'W': 0,
        'Y': 0,
        'V': 0
    }
    r2 = {
        'A': 0,
        'R': 0,
        'N': 0,
        'D': 0,
        'C': 0,
        'Q': 0,
        'E': 0,
        'G': 0,
        'H': 0,
        'I': 0,
        'L': 0,
        'K': 0,
        'M': 0,
        'F': 0,
        'P': 0,
        'S': 0,
        'T': 0,
        'W': 0,
        'Y': 0,
        'V': 0
    }
    d1 = {
        'A': 0,
        'R': 0,
        'N': 0,
        'D': 0,
        'C': 0,
        'Q': 0,
        'E': 0,
        'G': 0,
        'H': 0,
        'I': 0,
        'L': 0,
        'K': 0,
        'M': 0,
        'F': 0,
        'P': 0,
        'S': 0,
        'T': 0,
        'W': 0,
        'Y': 0,
        'V': 0
    }
    r1_r2 = {
        'A': 0,
        'R': 0,
        'N': 0,
        'D': 0,
        'C': 0,
        'Q': 0,
        'E': 0,
        'G': 0,
        'H': 0,
        'I': 0,
        'L': 0,
        'K': 0,
        'M': 0,
        'F': 0,
        'P': 0,
        'S': 0,
        'T': 0,
        'W': 0,
        'Y': 0,
        'V': 0
    }
    r1_d1 = {
        'A': 0,
        'R': 0,
        'N': 0,
        'D': 0,
        'C': 0,
        'Q': 0,
        'E': 0,
        'G': 0,
        'H': 0,
        'I': 0,
        'L': 0,
        'K': 0,
        'M': 0,
        'F': 0,
        'P': 0,
        'S': 0,
        'T': 0,
        'W': 0,
        'Y': 0,
        'V': 0
    }
    r2_d1 = {
        'A': 0,
        'R': 0,
        'N': 0,
        'D': 0,
        'C': 0,
        'Q': 0,
        'E': 0,
        'G': 0,
        'H': 0,
        'I': 0,
        'L': 0,
        'K': 0,
        'M': 0,
        'F': 0,
        'P': 0,
        'S': 0,
        'T': 0,
        'W': 0,
        'Y': 0,
        'V': 0
    }
    r1_r2_d1 = {
        'A': 0,
        'R': 0,
        'N': 0,
        'D': 0,
        'C': 0,
        'Q': 0,
        'E': 0,
        'G': 0,
        'H': 0,
        'I': 0,
        'L': 0,
        'K': 0,
        'M': 0,
        'F': 0,
        'P': 0,
        'S': 0,
        'T': 0,
        'W': 0,
        'Y': 0,
        'V': 0
    }
    for pro_name, pro_hot in hot.iteritems():
        for h in pro_hot:
            if h[0] in r1.keys():
                r1[h[0]] += 1
            if h[1] in r2.keys():
                r2[h[1]] += 1
            if h[2] in d1.keys():
                d1[h[2]] += 1
    for k, v in r1.items():
        r1_r2[k] = r1[k] + r2[k]
        r2_d1[k] = r2[k] + d1[k]
        r1_d1[k] = r1[k] + d1[k]
        r1_r2_d1[k] = r1[k] + r2[k] + d1[k]
    fname = lt.fname(sys.argv[-1])
    lt.write_sta_dict(r1, fname + 'R1_hotsta')
    lt.write_sta_dict(r2, fname + 'R1_2_hotsta')
    lt.write_sta_dict(d1, fname + 'D_1_hotsta')
    lt.write_sta_dict(r1_d1, fname + 'R1_D_1_hotsta')
    lt.write_sta_dict(r2_d1, fname + 'R1_2_D_1_hotsta')
    lt.write_sta_dict(r1_r2, fname + 'R1_R1_2_hotsta')
    lt.write_sta_dict(r1_r2_d1, fname + 'R1_R1_2_D_1_hotsta')
Ejemplo n.º 5
0
def main():

    res_neighbors = lt.pickle_load(sys.argv[-1])

    #delete water
    res_neighbors_dw = [(pdb,res,[n for n in neighbors if not 'HOH' in n]) for pdb,res,neighbors in res_neighbors]
    res_neighbors_dw = [(pdb,res,neighbors) for pdb,res,neighbors in res_neighbors_dw if len(neighbors) > 0]
    write_result(res_neighbors_dw,'1_delete_water')

    #filter entry containing hetero residues
    res_neighbors_fh = [(pdb,res,[n for n in neighbors if n.split('_')[-1] != 'H']) for pdb,res,neighbors in res_neighbors_dw]
    res_neighbors_fh = [(pdb,res,neighbors) for pdb,res,neighbors in res_neighbors_fh if len(neighbors) > 0]
    write_result(res_neighbors_fh,'2_dw_filter_hetero')

    #special case: phos_res neighboring residues involving main-chain interaction is not considered
    res_neighbors_pm = []
    for pdb,res,neighbors in res_neighbors_fh:
        res_id,res_chain = res.split('_')[1:3]
        new_neighbors = []
        for n in neighbors:
            words=n.split('_')
            if words[3] == 'M' and words[2] == res_chain and words[1] == res_id:
                pass
            else:
                new_neighbors.append(n)
        res_neighbors_pm.append((pdb,res,new_neighbors))
    write_result(res_neighbors_pm,'3_dw_fh_pm')

    #filter_entry containing only same-chain neighbors
    res_neighbors_fs = []
    for pdb,res,neighbors in res_neighbors_pm:
        res_chain = [res.split("_")[2]]
        neighbors_chain = [n.split("_")[2] for n in neighbors]
        if set(res_chain)== set(neighbors_chain):
            pass
        else:
            res_neighbors_fs.append((pdb,res,neighbors))
    write_result(res_neighbors_fs,'4_dw_fh_pm_fs')

    #change main-chain interaction residue as 'GLY'
    res_neighbors_cm = []
    for pdb,res,neighbors in res_neighbors_fs:
        new_neighbors = []
        for n in neighbors:
            words = n.split('_')
            if words[3] == 'M':
                words = ['GLY'] + words[1:3]
            else:
                words = words[0:3]
            new_neighbors.append('_'.join(words))
        res_neighbors_cm.append((pdb,res,new_neighbors))
    write_result(res_neighbors_cm,'4.0_dw_fh_fs_cm')
    write_sta_result(res_neighbors_cm,'4.0_dw_fh_pm_cm')


    #filter entry involves main-chain interaction
    res_neighbors_fm = []
    for pdb,res,neighbors in res_neighbors_fs:
        interaction_type = [n.split('_')[3] for n in neighbors]
        if 'M' in interaction_type:
            pass
        else:
            res_neighbors_fm.append((pdb,res,neighbors))
    write_result(res_neighbors_fm,'5_dw_fh_pm_fs_fm')
    write_sta_result(res_neighbors_fm,'5_dw_fh_pm_fs_fm')


    lt.pickle_dump(res_neighbors_dw,'hbplus_salt_combine_1_dw')
    lt.pickle_dump(res_neighbors_fh,'hbplus_salt_combine_2_dw_fh')
    lt.pickle_dump(res_neighbors_pm,'hbplus_salt_combine_3_dw_fh_pm')
    lt.pickle_dump(res_neighbors_fs,'hbplus_salt_combine_4_dw_fh_pm_fs')
    lt.pickle_dump(res_neighbors_cm,'hbplus_salt_combine_4.0_dw_fh_fs_cm')
    lt.pickle_dump(res_neighbors_fm,'hbplus_salt_combine_5_dw_fh_pm_fs_fm')