def label_both(self):

        if self.evaluate_workspace():

            maestro.command("labelclear all")

            st = maestro.workspace_get()
            gpcrdb_list = analyze.get_atoms_from_asl(
                st, "a. CA and a.pdbbfactor > -8.1 and a.pdbbfactor < 8.1")
            bw_list = analyze.get_atoms_from_asl(
                st, "a.pt N AND a.pdbbfactor > 0 AND a.pdbbfactor < 8.1")
            pairs = zip([x for x in gpcrdb_list], [y for y in bw_list])

            normal = []
            for gpcrdb, bw in pairs:
                if gpcrdb.resnum == bw.resnum and gpcrdb.temperature_factor == bw.temperature_factor:
                    normal.append(str(gpcrdb.index))
                if gpcrdb.resnum == bw.resnum and gpcrdb.temperature_factor != bw.temperature_factor:
                    if gpcrdb.temperature_factor < 0:
                        maestro.command(
                            'labelusertextatomupdate utext=%.2fx%s a. %i' %
                            (bw.temperature_factor,
                             ((-float(gpcrdb.temperature_factor)) + 0.001),
                             gpcrdb.index))
                    else:
                        maestro.command(
                            'labelusertextatomupdate utext=%.2fx%.2f a. %i' %
                            (bw.temperature_factor, gpcrdb.temperature_factor,
                             gpcrdb.index))

            maestro.command(
                "labelatom anum=false element=false pdbbfactor=true a. %s" %
                ','.join(normal))
 def evaluate_workspace(self):
     st = maestro.workspace_get()
     if st.atom_total == 0:
         msg = QtGui.QMessageBox.warning(
             self, "Empty workspace",
             "Please place some structure in the workspace!",
             QtGui.QMessageBox.Ok)
         return 0
     return 1
    def label_gpcrdb(self):
        
        if self.evaluate_workspace():

            maestro.command("labelatom anum=false element=false pdbbfactor=true a. CA and a.pdbbfactor > 0 and a.pdbbfactor < 8.1")

            st = maestro.workspace_get()
            maestro.workspace_set(st, regenerate_markers = True)
            atom_list = analyze.get_atoms_from_asl(st, "a. CA and a.pdbbfactor < 0 and a.pdbbfactor > -8.1")
            for atom in atom_list:
                maestro.command('labelusertextatomupdate utext=%s a. %i' %(((-float(atom.temperature_factor))+0.001), atom.index))
    def label_gpcrdb(self):

        if self.evaluate_workspace():

            maestro.command(
                "labelatom anum=false element=false pdbbfactor=true a. CA and a.pdbbfactor > 0 and a.pdbbfactor < 8.1"
            )

            st = maestro.workspace_get()
            maestro.workspace_set(st, regenerate_markers=True)
            atom_list = analyze.get_atoms_from_asl(
                st, "a. CA and a.pdbbfactor < 0 and a.pdbbfactor > -8.1")
            for atom in atom_list:
                maestro.command(
                    'labelusertextatomupdate utext=%s a. %i' %
                    (((-float(atom.temperature_factor)) + 0.001), atom.index))
    def label_both(self):

        if self.evaluate_workspace():
            
            maestro.command( "labelclear all" ) 

            st = maestro.workspace_get()
            gpcrdb_list = analyze.get_atoms_from_asl(st, "a. CA and a.pdbbfactor > -8.1 and a.pdbbfactor < 8.1")
            bw_list = analyze.get_atoms_from_asl(st, "a.pt N AND a.pdbbfactor > 0 AND a.pdbbfactor < 8.1")
            pairs = zip([x for x in gpcrdb_list], [y for y in bw_list])

            normal = []
            for gpcrdb, bw in pairs:
                if gpcrdb.resnum == bw.resnum and gpcrdb.temperature_factor == bw.temperature_factor:
                    normal.append(str(gpcrdb.index))
                if gpcrdb.resnum == bw.resnum and gpcrdb.temperature_factor != bw.temperature_factor:
                    if gpcrdb.temperature_factor < 0:
                        maestro.command('labelusertextatomupdate utext=%.2fx%s a. %i' %(bw.temperature_factor, ((-float(gpcrdb.temperature_factor))+0.001), gpcrdb.index))
                    else:
                        maestro.command('labelusertextatomupdate utext=%.2fx%.2f a. %i' %(bw.temperature_factor, gpcrdb.temperature_factor, gpcrdb.index))

            maestro.command("labelatom anum=false element=false pdbbfactor=true a. %s" % ','.join(normal) )
 def evaluate_workspace(self):
     st = maestro.workspace_get()
     if st.atom_total == 0:
         msg = QtGui.QMessageBox.warning(self, "Empty workspace", "Please place some structure in the workspace!", QtGui.QMessageBox.Ok)
         return 0
     return 1