def calculate_fg(row, fgsum, fgsub):
    """This function calculates a new functional group to be added to the
    dataframe
    fgsum : list of str (functional groups to add)
    fgsub : list of str (functional groups to substract)
    returns : count (int)"""
    count = 0
    for fg in fgsum:
        count += row[fg]
    for fg in fgsub:
        count -= row[fg]
    return count