def pperp_outliers(hierarchy, chain): kin_out = "@vectorlist {ext} color= magenta master= {base-P perp}\n" rv = rna_validate.rna_puckers(pdb_hierarchy=hierarchy) outliers = rv.results params = rna_sugar_pucker_analysis.master_phil.extract() outlier_key_list = [] for outlier in outliers: outlier_key_list.append(outlier.id_str()) for conformer in chain.conformers(): for residue in conformer.residues(): if common_residue_names_get_class( residue.resname) != "common_rna_dna": continue ra1 = residue_analysis( residue_atoms=residue.atoms(), distance_tolerance=params.bond_detection_distance_tolerance) if (ra1.problems is not None): continue if (not ra1.is_rna): continue try: key = residue.find_atom_by(name=" C1'").pdb_label_columns()[4:] except Exception: continue if key in outlier_key_list: if rv.pucker_perp_xyz[key][0] is not None: perp_xyz = rv.pucker_perp_xyz[key][0] #p_perp_xyz else: perp_xyz = rv.pucker_perp_xyz[key][1] #o3p_perp_xyz if rv.pucker_dist[key][0] is not None: perp_dist = rv.pucker_dist[key][0] if perp_dist < 2.9: pucker_text = " 2'?" else: pucker_text = " 3'?" else: perp_dist = rv.pucker_dist[key][1] if perp_dist < 2.4: pucker_text = " 2'?" else: pucker_text = " 3'?" key = key[0:4].lower() + key[4:] key += pucker_text kin_out += kin_vec(key, perp_xyz[0], key, perp_xyz[1]) a = matrix.col(perp_xyz[1]) b = matrix.col(residue.find_atom_by(name=" C1'").xyz) c = (a - b).normalize() new = a - (c * .8) kin_out += kin_vec(key, perp_xyz[1], key, tuple(new), 4) new = a + (c * .4) kin_out += kin_vec(key, perp_xyz[1], key, tuple(new), 4) r_vec = matrix.col(perp_xyz[1]) - matrix.col(perp_xyz[0]) r = r_vec.axis_and_angle_as_r3_rotation_matrix(angle=90, deg=True) new = r * (new - a) + a kin_out += kin_vec(key, perp_xyz[1], key, tuple(new), 4) r = r_vec.axis_and_angle_as_r3_rotation_matrix(angle=180, deg=True) new = r * (new - a) + a kin_out += kin_vec(key, perp_xyz[1], key, tuple(new), 4) return kin_out
def __init__ (self, pdb_hierarchy, params=None, outliers_only=True) : if (params is None) : params = rna_sugar_pucker_analysis.master_phil.extract() self.pucker_states = [] self.pucker_perp_xyz = {} self.pucker_dist = {} rna_geometry.__init__(self) from iotbx.pdb.rna_dna_detection import residue_analysis for model in pdb_hierarchy.models(): for chain in model.chains(): for conformer in chain.conformers(): altloc = conformer.altloc if altloc == "": altloc = " " residues = conformer.residues() for i_residue,residue in enumerate(residues): def _get_next_residue(): j = i_residue + 1 if (j == len(residues)): return None return residues[j] ra1 = residue_analysis( residue_atoms=residue.atoms(), distance_tolerance=params.bond_detection_distance_tolerance) if (ra1.problems is not None): continue if (not ra1.is_rna): continue residue_2_p_atom = None next_pdb_residue = _get_next_residue() if (next_pdb_residue is not None): residue_2_p_atom = next_pdb_residue.find_atom_by(name=" P ") if (get_res_class(residue.resname) != "common_rna_dna") : continue ana = rna_sugar_pucker_analysis.evaluate( params=params, residue_1_deoxy_ribo_atom_dict=ra1.deoxy_ribo_atom_dict, residue_1_c1p_outbound_atom=ra1.c1p_outbound_atom, residue_2_p_atom=residue_2_p_atom) self.pucker_states.append(ana) self.n_total += 1 is_outlier = ana.is_delta_outlier or ana.is_epsilon_outlier if (is_outlier) : self.n_outliers += 1 if (is_outlier or not outliers_only) : pucker = rna_pucker( chain_id=chain.id, resseq=residue.resseq, icode=residue.icode, altloc=conformer.altloc, resname=residue.resname, delta_angle=ana.delta, is_delta_outlier=ana.is_delta_outlier, epsilon_angle=ana.epsilon, is_epsilon_outlier=ana.is_epsilon_outlier, outlier=is_outlier) self.results.append(pucker) key = pucker.id_str() #[8:-1] self.pucker_perp_xyz[key] = [ana.p_perp_xyz, ana.o3p_perp_xyz] self.pucker_dist[key] = [ana.p_distance_c1p_outbound_line, ana.o3p_distance_c1p_outbound_line]
def pperp_outliers(hierarchy, chain): kin_out = "@vectorlist {ext} color= magenta master= {base-P perp}\n" rv = rna_validate.rna_puckers(pdb_hierarchy=hierarchy) outliers = rv.results params = rna_sugar_pucker_analysis.master_phil.extract() outlier_key_list = [] for outlier in outliers: outlier_key_list.append(outlier.id_str()) for conformer in chain.conformers(): for residue in conformer.residues(): if common_residue_names_get_class(residue.resname) != "common_rna_dna": continue ra1 = residue_analysis( residue_atoms=residue.atoms(), distance_tolerance=params.bond_detection_distance_tolerance) if (ra1.problems is not None): continue if (not ra1.is_rna): continue try: key = residue.find_atom_by(name=" C1'").pdb_label_columns()[4:] except Exception: continue if key in outlier_key_list: if rv.pucker_perp_xyz[key][0] is not None: perp_xyz = rv.pucker_perp_xyz[key][0] #p_perp_xyz else: perp_xyz = rv.pucker_perp_xyz[key][1] #o3p_perp_xyz if rv.pucker_dist[key][0] is not None: perp_dist = rv.pucker_dist[key][0] if perp_dist < 2.9: pucker_text = " 2'?" else: pucker_text = " 3'?" else: perp_dist = rv.pucker_dist[key][1] if perp_dist < 2.4: pucker_text = " 2'?" else: pucker_text = " 3'?" key = key[0:4].lower()+key[4:] key += pucker_text kin_out += kin_vec(key, perp_xyz[0], key, perp_xyz[1]) a = matrix.col(perp_xyz[1]) b = matrix.col(residue.find_atom_by(name=" C1'").xyz) c = (a-b).normalize() new = a-(c*.8) kin_out += kin_vec(key, perp_xyz[1], key, tuple(new), 4) new = a+(c*.4) kin_out += kin_vec(key, perp_xyz[1], key, tuple(new), 4) r_vec = matrix.col(perp_xyz[1]) - matrix.col(perp_xyz[0]) r = r_vec.axis_and_angle_as_r3_rotation_matrix(angle=90, deg=True) new = r*(new-a)+a kin_out += kin_vec(key, perp_xyz[1], key, tuple(new), 4) r = r_vec.axis_and_angle_as_r3_rotation_matrix(angle=180, deg=True) new = r*(new-a)+a kin_out += kin_vec(key, perp_xyz[1], key, tuple(new), 4) return kin_out