Changeset 3247


Ignore:
Timestamp:
Jan 29, 2018 9:34:15 AM (5 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

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIImath.py

    r3243 r3247  
    26892689                cartAtoms[-1][4] = 'O'
    26902690            cartAtoms[-1][cx:cx+3] = np.inner(Amat,cartAtoms[-1][cx:cx+3])
     2691            cartAtoms[-1].append(atom[cia+8])
    26912692    XYZ = np.array([atom[cx:cx+3] for atom in cartAtoms])
    26922693    xyzmin = np.array([np.min(XYZ.T[i]) for i in [0,1,2]])
     
    27132714    res = []
    27142715    resNames = []
     2716    resIDs = {}
    27152717    resname = []
     2718    resID = {}
    27162719    newChain = True
    27172720    intact = {'CC':0,'CN':0,'CO':0,'NN':0,'NO':0,'OO':0,'NC':0,'OC':0,'ON':0}
     
    27242727                chainIntAct.append(resIntAct)
    27252728                resNames += resname
     2729                resIDs.update(resID)
    27262730                res = []
    27272731                resname = []
     2732                resID = {}
    27282733                resIntAct = []
    27292734                intact = {'CC':0,'CN':0,'CO':0,'NN':0,'NO':0,'OO':0,'NC':0,'OC':0,'ON':0}
     
    27382743                    resIntAct.append(sumintact(intact))
    27392744            res.append(atom[0])
    2740             resname.append('%s-%s%s'%(atom[2],atom[0],atom[1]))
     2745            name = '%s-%s%s'%(atom[2],atom[0],atom[1])
     2746            resname.append(name)
     2747            resID[name] = atom[-1]
    27412748            if not newChain:
    27422749                resIntAct.append(sumintact(intact))
     
    27772784#        print ia,atom[0]+atom[1]+atom[3],tgts,jntact['CC'],jntact['CN']+jntact['NC'],jntact['CO']+jntact['OC'],jntact['NN'],jntact['NO']+jntact['ON']
    27782785    resNames += resname
     2786    resIDs.update(resID)
    27792787    resIntAct.append(sumintact(intact))
    27802788    chainIntAct.append(resIntAct)
     
    27892797                summ = 0.
    27902798                for j in range(i-4,i+5):
    2791                     summ += np.sum(np.array(IntAct[j].values()))
     2799                    summ += np.sum(np.array(list(IntAct[j].values())))
    27922800                    if old:
    27932801                        mtrx[0] += IntAct[j]['CC']
     
    28152823        Probs += 4*[0.,]        #skip last 4 residues in chain
    28162824        chainProb += Probs
    2817     return resNames,chainProb
     2825    return resNames,chainProb,resIDs
    28182826   
    28192827################################################################################
  • trunk/GSASIIphsGUI.py

    r3245 r3247  
    34573457                       
    34583458    def OnValidProtein(event):
    3459         resNames,Probs1 = G2mth.validProtein(data,True)         #old version
    3460         resNames,Probs2 = G2mth.validProtein(data,False)        #new version
     3459       
     3460        def pickHandler(resName):
     3461            drawData = data['Drawing']
     3462            resid = resIDs[resName]
     3463            drawData['viewPoint'][0] = atomData[AtLookUp[resid]][cx:cx+3]
     3464            UpdateDrawAtoms()
     3465            G2plt.PlotStructure(G2frame,data)
     3466       
     3467        atomData = data['Atoms']
     3468        cx,ct,cs,cia = data['General']['AtomPtrs']
     3469        AtLookUp = G2mth.FillAtomLookUp(atomData,cia+8)
     3470        resNames,Probs1,resIDs = G2mth.validProtein(data,True)         #old version
     3471        resNames,Probs2,resIDs = G2mth.validProtein(data,False)        #new version
    34613472        print ('Plot 1 is Protein validation based on errat.f')
    34623473        print ('Ref: Colovos, C. & Yeates, T.O. Protein Science 2, 1511-1519 (1991).')
     
    34683479        print ('NB: this calc. gives a close approximate to original erratv2 result')
    34693480        G2plt.PlotAAProb(G2frame,resNames,Probs1,Probs2,Title='Error score for %s'%(data['General']['Name']),
    3470             thresh=[[8.0,6.0],[17.191,11.527]])
     3481            thresh=[[8.0,6.0],[17.191,11.527]],pickHandler=pickHandler)
    34713482
    34723483    def OnIsoDistortCalc(event):
  • 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)
  • trunk/GSASIIspc.py

    r3245 r3247  
    14501450    SSGData = {'SSpGrp':SGData['SpGrp']+SSymbol,'modQ':modQ,'modSymb':modsym,'SSGKl':SSGKl}
    14511451    SSCen = np.zeros((len(SGData['SGCen']),4))
    1452 #    if SGData['SGFixed']:
    1453 #        for icen,cen in enumerate(SGData['SGCen']):
    1454 #            SSCen[icen] = cen
    1455 #    else:
    1456     if True:
    1457         for icen,cen in enumerate(SGData['SGCen']):
    1458             SSCen[icen,0:3] = cen
    1459         SSCen[0] = np.zeros(4)
     1452    for icen,cen in enumerate(SGData['SGCen']):
     1453        SSCen[icen,0:3] = cen
     1454    SSCen[0] = np.zeros(4)
    14601455    SSGData['SSGCen'] = SSCen
    14611456    SSGData['SSGOps'] = []
     
    14631458        T = np.zeros(4)
    14641459        ssop = np.zeros((4,4))
    1465 #        if SGData['SGFixed']:
    1466 #            ssop = op[0]
    1467 #            T = op[1]
    1468 #        else:
    1469         if True:
    1470             ssop[:3,:3] = op[0]
    1471             T[:3] = op[1]
     1460        ssop[:3,:3] = op[0]
     1461        T[:3] = op[1]
    14721462        SSGData['SSGOps'].append([ssop,T])
    14731463    E,Result = genSSGOps()
Note: See TracChangeset for help on using the changeset viewer.