Changeset 2964


Ignore:
Timestamp:
Aug 7, 2017 8:18:52 AM (6 years ago)
Author:
vondreele
Message:

work on protein validation - not correct yet; gives plot tho.
fix refinement of Dij values in a LeBail? refinement (esp. sequential LeBail?).

Location:
branch/2frame
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branch/2frame/GSASIImath.py

    r2957 r2964  
    25842584        'LEU','LYS','MET','PHE','PRO','SER','THR','TRP','TYR','VAL','MSE']
    25852585# data taken from erratv2.ccp
    2586     lmt = np.array([17.190823041860433,11.526684477428809])
    25872586    b1 = np.array([     [0,0,0,0,0,0],
    25882587          [0,   5040.279078850848200,   3408.805141583649400,   4152.904423767300600,   4236.200004171890200,   5054.781210204625500], 
     
    26242623    chainIntAct = []
    26252624    res = []
     2625    resNames = []
     2626    resname = []
    26262627    newChain = True
    26272628    intact = {'CC':0,'CN':0,'CO':0,'NN':0,'NO':0,'OO':0,'NC':0,'OC':0,'ON':0}
     
    26322633                resIntAct.append(sumintact(intact))
    26332634                chainIntAct.append(resIntAct)
     2635                resNames += resname
    26342636                res = []
     2637                resname = []
    26352638                resIntAct = []
    26362639                intact = {'CC':0,'CN':0,'CO':0,'NN':0,'NO':0,'OO':0,'NC':0,'OC':0,'ON':0}
     
    26382641        if atom[0] not in res:  #new residue, get residue no.
    26392642            res.append(atom[0])
     2643            resname.append('%s-%s%s'%(atom[2],atom[0],atom[1]))
    26402644            if not newChain:
    26412645                resIntAct.append(sumintact(intact))
     
    26582662                mult = 2.*(3.75-dsqt)
    26592663            intype = atom[4].strip()+cartAtoms[tgt][4].strip()
    2660             intact[intype] += mult           
     2664            intact[intype] += mult
     2665    resNames += resname
    26612666    resIntAct.append(sumintact(intact))
    26622667    chainIntAct.append(resIntAct)
     
    26652670        IntAct = chainIntAct[ich]
    26662671        nRes = len(IntAct)
    2667         Probs = []
     2672        Probs = [0.,0.,0.,0.]
    26682673        for i in range(4,nRes-4):
    26692674            mtrx = np.zeros(6)
     
    26712676            for j in range(i-4,i+4):
    26722677                summ += np.sum(np.array(IntAct[j].values()))
     2678                print 'CC',IntAct[j]['CC'],'CN',IntAct[j]['CN'],'CO',IntAct[j]['CO']
     2679                print 'NN',IntAct[j]['NN'],'NO',IntAct[j]['NO'],'OO',IntAct[j]['OO']
    26732680                mtrx[1] += IntAct[j]['CC']
    26742681                mtrx[2] += IntAct[j]['CN']
     
    26782685            mtrx /= summ
    26792686            mtrx -= avg
    2680             prob = np.inner(np.inner(mtrx,b1),mtrx)
     2687            prob = np.inner(np.inner(mtrx,b1),mtrx)/36.
     2688            print i, mtrx
    26812689            Probs.append(prob)
    2682         chainProb.append(Probs)
    2683            
    2684        
    2685     print 'Do VALIDPROTEIN analysis - TBD'
    2686            
     2690        Probs += 4*[0.,]
     2691        chainProb += Probs
     2692    return resNames,chainProb
    26872693   
    26882694################################################################################
  • branch/2frame/GSASIIphsGUI.py

    r2956 r2964  
    21032103                line3Sizer.Add(slope,0,WACV)
    21042104            elif 'Basin Hopping' in MCSAdata['Algorithm']:
    2105                 pass        #TODO basinhopping controls here
     2105                pass        #TODO basinhopping controls here?
    21062106            mcsaSizer.Add(line3Sizer)
    21072107            mcsaSizer.Add((5,5),)
     
    32913291       
    32923292    def OnValidProtein(event):
    3293         G2mth.validProtein(data)
     3293        resNames,Probs = G2mth.validProtein(data)
     3294        G2plt.PlotAAProb(G2frame,resNames,Probs,Title='Error score for %s'%(data['General']['Name']),
     3295            thresh=[17.190823041860433,11.526684477428809])
    32943296
    32953297    def OnSetAll(event):
  • branch/2frame/GSASIIplot.py

    r2945 r2964  
    30853085    else:
    30863086        Page.canvas.draw()
     3087       
     3088################################################################################
     3089##### PlotHist
     3090################################################################################
     3091def PlotAAProb(G2frame,resNames,Probs,Title='',thresh=None,newPlot=True):
     3092
     3093
     3094    global xylim
     3095    def OnMotion(event):
     3096        xpos = event.xdata
     3097        if xpos:                                        #avoid out of frame mouse position
     3098            ypos = int(event.ydata)
     3099            Page.canvas.SetCursor(wx.CROSS_CURSOR)
     3100            try:
     3101                if 0 <= ypos < len(resNames):
     3102                    G2frame.G2plotNB.status.SetStatusText('Residue: %s score: %.2f'%(resNames[ypos],xpos),1)
     3103            except TypeError:
     3104                G2frame.G2plotNB.status.SetStatusText('Select AA error plot first',1)
     3105   
     3106    def Draw():
     3107        global xylim
     3108        Plot.clear()
     3109        Plot.set_title(Title)
     3110        Plot.set_xlabel(r'Error score',fontsize=14)
     3111        Plot.set_ylabel(r'Residue',fontsize=14)
     3112        colors=['b','r','g','c','m','k']
     3113        Plot.barh(np.arange(len(resNames)),Probs,tick_label=resNames,)
     3114        if thresh is not None:
     3115            for item in thresh:
     3116                Plot.axvline(item,dashes=(5,5),picker=False)
     3117        if not newPlot:
     3118            Page.toolbar.push_current()
     3119            Plot.set_xlim(xylim[0])
     3120            Plot.set_ylim(xylim[1])
     3121            xylim = []
     3122            Page.toolbar.push_current()
     3123            Page.toolbar.draw()
     3124            Page.canvas.draw()
     3125        else:
     3126            Page.canvas.draw()
     3127           
     3128   
     3129    new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab(Title,'mpl')
     3130    Page.Offset = [0,0]
     3131    if not new:
     3132        if not newPlot:
     3133            xylim = lim
     3134    else:
     3135        newPlot = True
     3136#        Page.canvas.mpl_connect('key_press_event', OnKeyPress)
     3137        Page.canvas.mpl_connect('motion_notify_event', OnMotion)
     3138        Page.Offset = [0,0]
     3139        Page.Choice = None
     3140   
     3141    Draw()
    30873142
    30883143################################################################################
  • branch/2frame/GSASIIstrIO.py

    r2935 r2964  
    22262226                    hapDict[pfx+name] = hapData['HStrain'][0][i]
    22272227                    HSvals.append(hapDict[pfx+name])
    2228                     if hapData['HStrain'][1][i] and not hapDict[pfx+'LeBail']:
     2228                    if hapData['HStrain'][1][i]:
     2229#                    if hapData['HStrain'][1][i] and not hapDict[pfx+'LeBail']:
    22292230                        hapVary.append(pfx+name)
    22302231                controlDict[pfx+'poType'] = hapData['Pref.Ori.'][0]
Note: See TracChangeset for help on using the changeset viewer.