def chargeandprop(AAseq):
    """ Returns the net charge of a protein sequence
    and proportion of charged amino acids 
    protseq = AAseq.upper()
    charge = -0.002
    cp = 0
    for aa in protseq:
        charge += AACharge.get(aa,0)
        if aa in AACharge:
            cp += 1
    prop = 100.*cp/len(AAseq)
    return (charge,prop)

This code is part of the book "Python for Bioinformatics", by Sebastian Bassi ( Return to home page.