affinity_search/evaluate_cross.py
def reduce_results(results, index, which):
    '''Return results with only one tuple for every pocket-ligand value,
    taking the one with the max value at index in the tuple (predicted affinity or pose score)
    '''
    res = dict() #indexed by pocketligand
    for r in results:
        lname = r[3]
        m = re.search(r'(\S+)/...._._rec_...._(\S+)_(lig|uff_min)',lname)
        pocket = m.group(1)
        lig = m.group(2)
        key = pocket+':'+lig
        if key not in res:
            res[key] = r
        else:
            if which == 'small': #select smallest by index
                if res[key][index] > r[index]:
                    res[key] = r
            elif res[key][index] < r[index]:
                res[key] = r
                    
    return list(res.values())
Return results with only one tuple for every pocket-ligand value,
    taking the one with the max value at index in the tuple (predicted affinity or pose score)
    
Return results with only one tuple for every pocket-ligand value,
taking the one with the max value at index in the tuple (predicted affinity or pose score)
Return results with only one tuple for every pocket - ligand value taking the one with the max value at index in the tuple ( predicted affinity or pose score )
def reduce_results(results, index, which):
    res = dict() 
    for r in results:
        lname = r[3]
        m = re.search(r'(\S+)/...._._rec_...._(\S+)_(lig|uff_min)',lname)
        pocket = m.group(1)
        lig = m.group(2)
        key = pocket+':'+lig
        if key not in res:
            res[key] = r
        else:
            if which == 'small': 
                if res[key][index] > r[index]:
                    res[key] = r
            elif res[key][index] < r[index]:
                res[key] = r
    return list(res.values())
def reduce_results ( results , index , which ) : res = dict ( ) for r in results : lname = r [ 3 ] m = re . search ( r'(\S+)/...._._rec_...._(\S+)_(lig|uff_min)' , lname ) pocket = m . group ( 1 ) lig = m . group ( 2 ) key = pocket + ':' + lig if key not in res : res [ key ] = r else : if which == 'small' : if res [ key ] [ index ] > r [ index ] : res [ key ] = r elif res [ key ] [ index ] < r [ index ] : res [ key ] = r return list ( res . values ( ) )
Return results with only one tuple for every pocket-ligand value,
taking the one with the max value at index in the tuple (predicted affinity or pose score)
Return results with only one tuple for every pocket - ligand value taking the one with the max value at index in the tuple ( predicted affinity or pose score )
'''Return results with only one tuple for every pocket-ligand value,
    taking the one with the max value at index in the tuple (predicted affinity or pose score)
    ''' #indexed by pocketligand #select smallest by index
results
index
which