import math


def calculate_information(nucleotides, base=2.0):
    """Calculate information entropy using Shannon's method """
    nucleotides = filter(lambda x: x >= 0, nucleotides)
    num = sum(nucleotides)
    probs = [float(n_) / num for n_ in nucleotides]
    p = 0
    for pr in probs:
        if pr == 0.0: continue
        p -= math.log( pr ) * pr
        pass
    return p / math.log(base)