Ghost/make_figs_helper.py
def score_ghosts(self,calc_ghosts):
        """Score all the calculated ghosts given"""
        big_satisfied={}
        atom=options.atom
        big_satisfied[atom]={}
        xs=[]
        ys=[]
        experrors=[]
        #
        for tg in sorted(self.exp_ghosts.keys()):
            big_satisfied[atom][tg]={}
            for residue in sorted(self.exp_ghosts[tg].keys()):
                #
                # Exclude this residue for this tg?
                #
                if self.excludes.has_key(tg):
                    if residue in self.excludes[tg]:
                        continue
                #
                # Get the experimental values and its error
                #
                if self.exp_ghosts[tg][residue].has_key(atom):
                    exp_value=self.exp_ghosts[tg][residue][atom]
                    exp_error=errors[atom]
                    if self.exp_ghosts[tg][residue].has_key(atom+'_error'):
                        exp_error=self.exp_ghosts[tg][residue][atom+'_error']
                    #
                    # Get calculated value and score it
                    #
                    calc_value=calc_ghosts[tg][residue][atom]
                    error,satisfied,abs_sat,tot_restraints,tot_abs,real_error=self.S.get_error_sub(exp_value,calc_value,exp_error,atom)
                    #
                    if exp_value!='absent':
                        exp_error=0.05
                        if exp_value[0]=='q':
                            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)
                    else:
                        if self.options.useabsent:
                            exp_value=0.0
                            exp_error=errors[options.atom]
                        else:
                            continue
                    #
                    xs.append(float(exp_value))
                    ys.append(calc_value)
                    experrors.append(exp_error)
                    big_satisfied[atom][tg][residue]={'error':error,'real_error':real_error,'calc_value':calc_value,'exp_value':exp_value,'exp_error':exp_error}
        return xs,ys,experrors,big_satisfied
Score all the calculated ghosts given
Score all the calculated ghosts given
Score all the calculated ghosts given
def score_ghosts(self,calc_ghosts):
        big_satisfied={}
        atom=options.atom
        big_satisfied[atom]={}
        xs=[]
        ys=[]
        experrors=[]
        for tg in sorted(self.exp_ghosts.keys()):
            big_satisfied[atom][tg]={}
            for residue in sorted(self.exp_ghosts[tg].keys()):
                 Exclude this residue for this tg?
                if self.excludes.has_key(tg):
                    if residue in self.excludes[tg]:
                        continue
                 Get the experimental values and its error
                if self.exp_ghosts[tg][residue].has_key(atom):
                    exp_value=self.exp_ghosts[tg][residue][atom]
                    exp_error=errors[atom]
                    if self.exp_ghosts[tg][residue].has_key(atom+'_error'):
                        exp_error=self.exp_ghosts[tg][residue][atom+'_error']
                     Get calculated value and score it
                    calc_value=calc_ghosts[tg][residue][atom]
                    error,satisfied,abs_sat,tot_restraints,tot_abs,real_error=self.S.get_error_sub(exp_value,calc_value,exp_error,atom)
                    if exp_value!='absent':
                        exp_error=0.05
                        if exp_value[0]=='q':
                            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)
                    else:
                        if self.options.useabsent:
                            exp_value=0.0
                            exp_error=errors[options.atom]
                        else:
                            continue
                    xs.append(float(exp_value))
                    ys.append(calc_value)
                    experrors.append(exp_error)
                    big_satisfied[atom][tg][residue]={'error':error,'real_error':real_error,'calc_value':calc_value,'exp_value':exp_value,'exp_error':exp_error}
        return xs,ys,experrors,big_satisfied
def score_ghosts ( self , calc_ghosts ) : big_satisfied = { } atom = options . atom big_satisfied [ atom ] = { } xs = [ ] ys = [ ] experrors = [ ] for tg in sorted ( self . exp_ghosts . keys ( ) ) : big_satisfied [ atom ] [ tg ] = { } for residue in sorted ( self . exp_ghosts [ tg ] . keys ( ) ) : if self . excludes . has_key ( tg ) : if residue in self . excludes [ tg ] : continue if self . exp_ghosts [ tg ] [ residue ] . has_key ( atom ) : exp_value = self . exp_ghosts [ tg ] [ residue ] [ atom ] exp_error = errors [ atom ] if self . exp_ghosts [ tg ] [ residue ] . has_key ( atom + '_error' ) : exp_error = self . exp_ghosts [ tg ] [ residue ] [ atom + '_error' ] calc_value = calc_ghosts [ tg ] [ residue ] [ atom ] error , satisfied , abs_sat , tot_restraints , tot_abs , real_error = self . S . get_error_sub ( exp_value , calc_value , exp_error , atom ) if exp_value != 'absent' : exp_error = 0.05 if exp_value [ 0 ] == 'q' : 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 ) else : if self . options . useabsent : exp_value = 0.0 exp_error = errors [ options . atom ] else : continue xs . append ( float ( exp_value ) ) ys . append ( calc_value ) experrors . append ( exp_error ) big_satisfied [ atom ] [ tg ] [ residue ] = { 'error' : error , 'real_error' : real_error , 'calc_value' : calc_value , 'exp_value' : exp_value , 'exp_error' : exp_error } return xs , ys , experrors , big_satisfied
Score all the calculated ghosts given
Score all the calculated ghosts given
"""Score all the calculated ghosts given""" # # # Exclude this residue for this tg? # # # Get the experimental values and its error # # # Get calculated value and score it # # #
self
calc_ghosts