Changeset 3247 for trunk/GSASIIplot.py


Ignore:
Timestamp:
Jan 29, 2018 9:34:15 AM (4 years ago)
Author:
vondreele
Message:

implement pick of protein validation bar - new view point on structure plot an N atom for selected residue
fix of non-gray modulated magnetic structures

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIplot.py

    r3245 r3247  
    32323232##### PlotHist
    32333233################################################################################
    3234 def PlotAAProb(G2frame,resNames,Probs1,Probs2,Title='',thresh=None):
     3234def PlotAAProb(G2frame,resNames,Probs1,Probs2,Title='',thresh=None,pickHandler=None):
    32353235
    32363236    def OnMotion(event):
     
    32563256            except TypeError:
    32573257                G2frame.G2plotNB.status.SetStatusText('Select AA error plot first',1)
     3258               
     3259    def OnPick(event):
     3260        xpos = event.mouseevent.xdata
     3261        if xpos and pickHandler:
     3262            xpos = int(xpos+.5)
     3263            if 0 <= xpos < len(resNames):
     3264                resName = resNames[xpos]
     3265            else:
     3266                resName = ''
     3267            pickHandler(resName)
    32583268   
    32593269    def Draw():
     
    32673277        colors = list(np.where(np.array(Probs1)>thresh[0][1],'r','b'))
    32683278        resNums = np.arange(len(resNames))
    3269         Plot1.bar(resNums,Probs1,color=colors,linewidth=0)
     3279        Plot1.bar(resNums,Probs1,color=colors,linewidth=0,picker=1)
    32703280        if thresh is not None:
    32713281            for item in thresh[0]:
     
    32753285        Plot2.set_xlabel(r'Residue',fontsize=14)       
    32763286        colors = list(np.where(np.array(Probs2)>thresh[1][1],'r','b'))
    3277         Plot2.bar(resNums,Probs2,color=colors,linewidth=0)
     3287        Plot2.bar(resNums,Probs2,color=colors,linewidth=0,picker=1)
    32783288        if thresh is not None:
    32793289            for item in thresh[1]:
     
    32833293   
    32843294    new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab(Title,'mpl')
    3285 #        Page.canvas.mpl_connect('key_press_event', OnKeyPress)
     3295    Page.canvas.mpl_connect('pick_event', OnPick)
    32863296    Page.canvas.mpl_connect('motion_notify_event', OnMotion)
    32873297    Draw()
     
    68126822            elif atom[cs+1] == 'number':
    68136823                RenderLabel(x,y,z,'  '+str(iat),radius,wxGreen,matRot)
    6814             elif atom[cs+1] == 'residue' and atom[ct-1] == 'CA':
     6824            elif atom[cs+1] == 'residue' and atom[ct-1] in ['CA','CA  A']:
    68156825                RenderLabel(x,y,z,'  '+atom[ct-4],radius,wxGreen,matRot)
    6816             elif atom[cs+1] == '1-letter' and atom[ct-1] == 'CA':
     6826            elif atom[cs+1] == '1-letter' and atom[ct-1] in ['CA','CA  A']:
    68176827                RenderLabel(x,y,z,'  '+atom[ct-3],radius,wxGreen,matRot)
    6818             elif atom[cs+1] == 'chain' and atom[ct-1] == 'CA':
     6828            elif atom[cs+1] == 'chain' and atom[ct-1] in ['CA','CA  A']:
    68196829                RenderLabel(x,y,z,'  '+atom[ct-2],radius,wxGreen,matRot)
    68206830#        glDisable(GL_BLEND)
Note: See TracChangeset for help on using the changeset viewer.