Ghost/make_figs.py
def stats_forpaper(self,exp_ghosts):
        """Get the stats for the paper"""
        # Get the excludes
        excludes=self.find_excludes(options,exp_ghosts)
        # Loop over all ghosts
        for atom in ['N','H','HA']:
            values=[]
            absent=[]
            for tg in sorted(exp_ghosts.keys()):
                for residue in sorted(exp_ghosts[tg].keys()):
                    if excludes.has_key(tg):
                        if residue in excludes[tg]:
                            continue
                    #
                    # Get the value
                    #
                    if exp_ghosts[tg][residue].has_key(atom):
                        exp_value=exp_ghosts[tg][residue][atom]
                        exp_error=errors[atom]
                        if exp_ghosts[tg][residue].has_key(atom+'_error'):
                            exp_error=exp_ghosts[tg][residue][atom+'_error']
                        # 
                        # Deal with ranges
                        #
                        if exp_value[0]=='q' and options.use_questionable:
                            exp_value=exp_value[1:]
                        # 
                        # Deal with ranges  - we need to do this better
                        #
                        if len(exp_value.split(';'))==2:
                            s=[]
                            for val in exp_value.split(';'):
                                if val[0] in ['<','>']:
                                    val=val[1:]
                                s.append(float(val))
                            exp_error=abs(s[0]-s[1])
                            exp_value=float(sum(s))/len(s)
                        if exp_value=='absent':
                            absent.append(residue)
                        else:
                            values.append(abs(float(exp_value)))
            #
            # Calculate average
            #
            import stats
            avg=0.0
            SD=0.0
            if len(values)>0:
                avg=stats.average(values)
                SD=stats.stddev(values)
            print '%2s ghost titrations: %3d, avg: %5.2f (%5.2f), %3d absent ghost titrations' %(atom,len(values),avg,SD,len(absent))
        return
Get the stats for the paper
Get the stats for the paper
Get the stats for the paper
def stats_forpaper(self,exp_ghosts):
        excludes=self.find_excludes(options,exp_ghosts)
        for atom in ['N','H','HA']:
            values=[]
            absent=[]
            for tg in sorted(exp_ghosts.keys()):
                for residue in sorted(exp_ghosts[tg].keys()):
                    if excludes.has_key(tg):
                        if residue in excludes[tg]:
                            continue
                     Get the value
                    if exp_ghosts[tg][residue].has_key(atom):
                        exp_value=exp_ghosts[tg][residue][atom]
                        exp_error=errors[atom]
                        if exp_ghosts[tg][residue].has_key(atom+'_error'):
                            exp_error=exp_ghosts[tg][residue][atom+'_error']
                         Deal with ranges
                        if exp_value[0]=='q' and options.use_questionable:
                            exp_value=exp_value[1:]
                         Deal with ranges  - we need to do this better
                        if len(exp_value.split(';'))==2:
                            s=[]
                            for val in exp_value.split(';'):
                                if val[0] in ['<','>']:
                                    val=val[1:]
                                s.append(float(val))
                            exp_error=abs(s[0]-s[1])
                            exp_value=float(sum(s))/len(s)
                        if exp_value=='absent':
                            absent.append(residue)
                        else:
                            values.append(abs(float(exp_value)))
             Calculate average
            import stats
            avg=0.0
            SD=0.0
            if len(values)>0:
                avg=stats.average(values)
                SD=stats.stddev(values)
            print '%2s ghost titrations: %3d, avg: %5.2f (%5.2f), %3d absent ghost titrations' %(atom,len(values),avg,SD,len(absent))
        return
def stats_forpaper ( self , exp_ghosts ) : excludes = self . find_excludes ( options , exp_ghosts ) for atom in [ 'N' , 'H' , 'HA' ] : values = [ ] absent = [ ] for tg in sorted ( exp_ghosts . keys ( ) ) : for residue in sorted ( exp_ghosts [ tg ] . keys ( ) ) : if excludes . has_key ( tg ) : if residue in excludes [ tg ] : continue if exp_ghosts [ tg ] [ residue ] . has_key ( atom ) : exp_value = exp_ghosts [ tg ] [ residue ] [ atom ] exp_error = errors [ atom ] if exp_ghosts [ tg ] [ residue ] . has_key ( atom + '_error' ) : exp_error = exp_ghosts [ tg ] [ residue ] [ atom + '_error' ] if exp_value [ 0 ] == 'q' and options . use_questionable : exp_value = exp_value [ 1 : ] if len ( exp_value . split ( ';' ) ) == 2 : s = [ ] for val in exp_value . split ( ';' ) : if val [ 0 ] in [ '<' , '>' ] : val = val [ 1 : ] s . append ( float ( val ) ) exp_error = abs ( s [ 0 ] - s [ 1 ] ) exp_value = float ( sum ( s ) ) / len ( s ) if exp_value == 'absent' : absent . append ( residue ) else : values . append ( abs ( float ( exp_value ) ) ) import stats avg = 0.0 SD = 0.0 if len ( values ) > 0 : avg = stats . average ( values ) SD = stats . stddev ( values ) print '%2s ghost titrations: %3d, avg: %5.2f (%5.2f), %3d absent ghost titrations' % ( atom , len ( values ) , avg , SD , len ( absent ) ) return
Get the stats for the paper
Get the stats for the paper
"""Get the stats for the paper""" # Get the excludes # Loop over all ghosts # # Get the value # #  # Deal with ranges # #  # Deal with ranges  - we need to do this better # # # Calculate average #
self
exp_ghosts