Calculating G/C ratio in a sequence with Sho

Dec 13, 2011 at 6:03 PM

For those of you who attended our last training course you saw this first hand. Our trainer developed a new introductory course on Sho. One of the sample problems that he solved was calculating the G/C ratio in a sequence. If you want to check out the new Sho module you can download the latest version of our training materials from this site just look under the "self guided" paragraph. Here was the definition of the function he used as the main part of the Sho script.

def calcGCratio(seq) :

table = Counter([chr(c) for c in seq])

G = table['g'] + table['G']

C = table['c'] + table['C']

A = table['a'] + table['A']

T = table['t'] + table['T']

total = G + C + A + T

if total > 0 : GC = (float(G) + float(C)) / total

else : GC = float(0)

return GC

And as Mark noted in class even though Sho is an interactive environment you can store Sho scripts that can be reused. If you plan to do the labs that's great the module is easy to go through yourself. You should also be aware that the book of Sho comes with your Sho install for handy reference. If you have any questions or have trouble finding the materials or Sho let me know and I can help you find things.