def get_sort_order(molecules):
    """
	Count up the total number of scores whose values are positve and negative.
	If a greater number are negative, then sort in ascending order (e.g. for binding energy estimates)
	Otherwise, sort in descending order (e.g. for similarity values)
	"""

    neg_count = 0
    pos_count = 0

    for index in range(len(molecules)):

        scoreList = molecules[index].GetProp('scores')
        for element in scoreList:
            if float(element) > 0:
                pos_count += 1
            elif float(element) < 0:
                neg_count += 1

    if pos_count > neg_count:
        sort_order = 'dsc'
    else:
        sort_order = 'asc'

    return sort_order
def get_sort_order ( molecules ) : neg_count = 0 pos_count = 0 for index in range ( len ( molecules ) ) : scoreList = molecules [ index ] . GetProp ( 'scores' ) for element in scoreList : if float ( element ) > 0 : pos_count += 1 elif float ( element ) < 0 : neg_count += 1 if pos_count > neg_count : sort_order = 'dsc' else : sort_order = 'asc' return sort_order
Count up the total number of scores whose values are positve and negative.
	If a greater number are negative, then sort in ascending order (e.g. for binding energy estimates)
	Otherwise, sort in descending order (e.g. for similarity values)