Ejemplo n.º 1
0
def fix_carbonyl(residue_id, cg, at, cross_vector):
    chiral = {}
    carbonyl = {}
    for atom in at:
        if at[atom]['atom'] in ['N', 'CA', 'C', 'O']:
            carbonyl[at[atom]['atom']] = atom
        if at[atom]['atom'] in g_var.res_top[at[atom]
                                             ['res_type']]['CHIRAL']['atoms']:
            chiral[at[atom]['atom']] = atom

    if not np.any(cross_vector):
        ca = []
        res_off = 0
        for x in range(2):
            for bead in cg[residue_id + res_off]:
                resname = cg[residue_id + res_off][next(
                    iter(cg[residue_id + res_off]))]['residue_name']
                if bead in g_var.res_top[resname]['CONNECT']:
                    if x == 0:
                        ca.append(cg[residue_id + res_off][bead]['coord'])
                    for con_val, con_dir in enumerate(
                            g_var.res_top[resname]['CONNECT'][bead]['dir']):
                        if con_dir > 0:
                            ca.append(cg[residue_id + con_dir + res_off]
                                      [g_var.res_top[resname]['CONNECT'][bead]
                                       ['Con_Bd'][con_val]]['coord'])
                            res_off = con_dir
        cross_vector = at_mod.find_cross_vector(ca)

    rotation = at_mod.align_to_vector(
        at_mod.noramlised_vector(at[carbonyl['O']]['coord'],
                                 at[carbonyl['C']]['coord']), cross_vector)
    at[carbonyl['O']]['coord'] = (
        at[carbonyl['O']]['coord'] -
        at[carbonyl['C']]['coord']).dot(rotation) + at[carbonyl['C']]['coord']
    at[carbonyl['C']]['coord'] = at[
        carbonyl['C']]['coord'] + cross_vector * 0.2
    at[carbonyl['N']]['coord'] = at[
        carbonyl['N']]['coord'] - cross_vector * 0.5
    if len(g_var.res_top[at[1]['res_type']]['CHIRAL']) >= 2:
        for chiral_group in g_var.res_top[at[1]['res_type']]['CHIRAL']:
            if chiral_group != 'atoms':
                p1 = chiral[chiral_group]
                c1 = chiral[g_var.res_top[at[1]['res_type']]['CHIRAL']
                            [chiral_group]['c1']]
                c2 = chiral[g_var.res_top[at[1]['res_type']]['CHIRAL']
                            [chiral_group]['c2']]
                c3 = chiral[g_var.res_top[at[1]['res_type']]['CHIRAL']
                            [chiral_group]['c3']]
                cross_vector_chiral = at_mod.find_cross_vector(
                    [at[c3]['coord'], at[c2]['coord'], at[c1]['coord']])
                at[p1]['coord'] = at[p1]['coord'] + cross_vector_chiral * 0.5
                if g_var.res_top[at[1]['res_type']]['CHIRAL'][chiral_group][
                        'm'] in chiral:
                    m = chiral[g_var.res_top[at[1]['res_type']]['CHIRAL']
                               [chiral_group]['m']]
                    at[m]['coord'] = at[m]['coord'] + cross_vector_chiral * 1
    return at, cross_vector
Ejemplo n.º 2
0
def fix_carbonyl_chiral(residue_id, cg, at, cross_vector):
    chiral, carbonyl = get_chiral_carbonyl(at)
    if not np.any(cross_vector):
        ca = get_crossvector(cg, residue_id)
        cross_vector = at_mod.find_cross_vector(ca)
    at = correct_carbonyl_alignment(at, cross_vector, carbonyl)
    if len(g_var.res_top[at[1]['res_type']]['CHIRAL']) >= 2:
        at = correct_protein_chiral(at, chiral)
    return at, cross_vector
Ejemplo n.º 3
0
def correct_protein_chiral(at, chiral):
    for chiral_group in g_var.res_top[at[1]['res_type']]['CHIRAL']:
        if chiral_group != 'atoms':            
            atom_list = [chiral[chiral_group]]
            for chiral_atoms in ['c1','c2','c3']:
                atom_list.append(chiral[g_var.res_top[at[1]['res_type']]['CHIRAL'][chiral_group][chiral_atoms]])
            cross_vector_chiral = at_mod.find_cross_vector( [at[atom_list[3]]['coord'], at[atom_list[2]]['coord'], at[atom_list[1]]['coord']])
            at[atom_list[0]]['coord'] = at[atom_list[0]]['coord'] + cross_vector_chiral*0.5
            if g_var.res_top[at[1]['res_type']]['CHIRAL'][chiral_group]['m'] in chiral:
                m = chiral[g_var.res_top[at[1]['res_type']]['CHIRAL'][chiral_group]['m']]
                at[m]['coord'] = at[m]['coord'] + cross_vector_chiral*1
    return at
Ejemplo n.º 4
0
def fix_carbonyl(residue_id, cg, at):
    ca=[]
    for index in range(3):
        ca.append(cg[residue_id+index]['BB']['coord'])

    for atom in at:
        if at[atom]['atom'] == 'C': 
            C = atom
        if at[atom]['atom'] in 'O':   
            O = atom                 

    initial_vector, cross_vector = at_mod.find_cross_vector( ca, at[C]['coord'], at[O]['coord'])
    rotation = at_mod.align_to_vector(initial_vector, cross_vector)
    center = ca[0]+(ca[1]-ca[0])/3
    at[C]['coord'] = (at[C]['coord']-center).dot(rotation)+center
    at[O]['coord'] = (at[O]['coord']-center).dot(rotation)+center
    return at