def setTag(self, tag): if(tag.isspace()==False and tag !=""): newItem = QTableWidgetItem(tag) newItem.setTextAlignment(QtCore.Qt.AlignCenter) self.tableWidget.setItem(self.row, self.column, newItem) if (self.column == 9 and self.row == 5): return elif (self.column == 9): self.row += 1 self.column = 0 else: self.column += 1
def addTag(self, tag): tags = [] for row in range(0, 4): for column in range(0, 9): try: tags.append(self.tableWidget.item(row, column).text()) except: continue if(tag.isspace()==False and tag not in tags and tag !=""): newItem = QTableWidgetItem(tag) newItem.setTextAlignment(QtCore.Qt.AlignCenter) self.tableWidget.setItem(self.row, self.column, newItem) if (self.column == 9 and self.row == 5): return elif (self.column == 9): self.row += 1 self.column = 0 else: self.column += 1
def calc_vbur(self): args = dict() cur_sel = selected_atoms(self.session) if len(cur_sel) == 0: return models = [] for atom in cur_sel: if atom.structure not in models: models.append(atom.structure) center = [] for atom in cur_sel: center.append(atom) args["center"] = center radii = self.radii_option.currentText() self.settings.radii = radii args["radii"] = radii scale = self.scale.value() self.settings.vdw_scale = scale args["scale"] = scale radius = self.radius.value() self.settings.center_radius = radius args["radius"] = radius steric_map = self.steric_map.checkState() == Qt.Checked self.settings.steric_map = steric_map args["steric_map"] = steric_map use_scene = self.use_scene.checkState() == Qt.Checked self.settings.use_scene = use_scene args["useScene"] = use_scene num_pts = self.num_pts.value() self.settings.num_pts = num_pts args["num_pts"] = num_pts include_vbur = self.include_vbur.checkState() == Qt.Checked self.settings.include_vbur = include_vbur use_centroid = self.use_centroid.checkState() == Qt.Checked self.settings.use_centroid = use_centroid args["useCentroid"] = use_centroid shape = self.map_shape.currentText() self.settings.map_shape = shape args["shape"] = shape report_component = self.report_component.currentText() self.settings.report_component = report_component args["reportComponent"] = report_component method = self.method.currentText() self.settings.method = method if method == "Lebedev": args["method"] = "lebedev" rad_pts = self.radial_points.currentText() self.settings.radial_points = rad_pts args["radialPoints"] = rad_pts ang_pts = self.angular_points.currentText() self.settings.angular_points = ang_pts args["angularPoints"] = ang_pts elif method == "Monte-Carlo": args["method"] = "mc" min_iter = self.min_iter.value() self.settings.minimum_iterations = min_iter args["minimumIterations"] = min_iter display_cutout = self.display_cutout.currentText() self.settings.display_cutout = display_cutout if display_cutout != "no": args["displaySphere"] = display_cutout if display_cutout != "no": point_spacing = self.point_spacing.value() self.settings.point_spacing = point_spacing args["pointSpacing"] = point_spacing intersection_scale = self.intersection_scale.value() self.settings.intersection_scale = intersection_scale args["intersectionScale"] = intersection_scale cutout_labels = self.cutout_labels.currentText() self.settings.cutout_labels = cutout_labels args["labels"] = cutout_labels if len(self.ligand_atoms) > 0: args["onlyAtoms"] = [a for a in self.ligand_atoms if not a.deleted] if len(args["onlyAtoms"]) == 0: args["onlyAtoms"] = None auto_minmax = self.auto_minmax.checkState() == Qt.Checked self.settings.auto_minmax = auto_minmax if not auto_minmax: map_max = self.map_max.value() self.settings.map_max = map_max map_min = self.settings.map_min self.settings.map_min = map_min info = percent_vbur_cmd(self.session, models, return_values=True, **args) # self.table.setRowCount(0) if steric_map: for mdl, cent, vbur, map_info in info: row = self.table.rowCount() self.table.insertRow(row) m = QTableWidgetItem() m.setData(Qt.DisplayRole, mdl.name) self.table.setItem(row, 0, m) c = QTableWidgetItem() c.setData(Qt.DisplayRole, cent) self.table.setItem(row, 1, c) v = QTableWidgetItem() if report_component == "octants": v.setData(Qt.DisplayRole, ",".join(["%.1f" % x for x in vbur])) elif report_component == "quadrants": v.setData( Qt.DisplayRole, ",".join("%.1f" % x for x in [ vbur[0] + vbur[7], vbur[1] + vbur[6], vbur[2] + vbur[5], vbur[3] + vbur[4], ])) else: if hasattr(vbur, "__iter__"): v.setData(Qt.DisplayRole, "%.1f" % sum(vbur)) else: v.setData(Qt.DisplayRole, "%.1f" % vbur) v.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) self.table.setItem(row, 2, v) x, y, z, min_alt, max_alt = map_info plot = self.tool_window.create_child_window( "steric map of %s" % mdl.name, window_class=StericMap) if auto_minmax: plot.set_data(x, y, z, min_alt, max_alt, vbur, radius, include_vbur) else: plot.set_data(x, y, z, map_min, map_max, vbur, radius, include_vbur) else: for mdl, cent, vbur in info: row = self.table.rowCount() self.table.insertRow(row) m = QTableWidgetItem() m.setData(Qt.DisplayRole, mdl.name) self.table.setItem(row, 0, m) c = QTableWidgetItem() c.setData(Qt.DisplayRole, cent) self.table.setItem(row, 1, c) v = QTableWidgetItem() if report_component == "octants": v.setData(Qt.DisplayRole, ",".join(["%.1f" % x for x in vbur])) elif report_component == "quadrants": v.setData( Qt.DisplayRole, ",".join("%.1f" % x for x in [ vbur[0] + vbur[7], vbur[1] + vbur[6], vbur[2] + vbur[5], vbur[3] + vbur[4], ])) else: if hasattr(vbur, "__iter__"): v.setData(Qt.DisplayRole, "%.1f" % sum(vbur)) else: v.setData(Qt.DisplayRole, "%.1f" % vbur) v.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter) self.table.setItem(row, 2, v) self.table.resizeColumnToContents(1) self.table.resizeColumnToContents(2)