User:James Estevez/Notebook/Spring 2011: Bdellovibrio Independent Study/2011/02/13
From OpenWetWare
Jump to navigationJump to search
Bdellovibrio Independent Study | Main project page Previous entry Next entry |
pSORTb PredictionsAverage Synthesis Cost (ASC) calculationAverage synthesis cost formula: [math]\displaystyle{ asc=\frac{\sum \mathrm{ATP}_{aa}}{n_{aa}} }[/math] I calculated this using a small Python script: <source lang="python">
import sys from optparse import OptionParser from Bio import SeqIO usage = "usage: %prog fasta_file_in" parser = OptionParser(usage) parser.add_option("-i", "--input", dest="file_in", default=None, help="Name of the input file") (opts, args) = parser.parse_args() if opts.file_in: fh = open(opts.file_in) elif args: fh = open(args[0]) elif sys.stdin: fh = sys.stdin def seqcost(seq): cost = 0
AAcost = {"A":11.7,"C":24.7,"D":12.7,"E":15.3,"F":52,"G":11.7,"H":38.3, "I":32.3,"K":30.3,"L":27.3,"M":34.3,"N":14.7,"P":20.3,"Q":16.3, "R":27.3,"S":11.7,"T":18.7,"V":23.3,"W":74.3,"Y":50} for aa in seq: cost += AAcost.get(aa,0) return cost def avgcost(seq): for aa in seq: ASC = seqcost(seq)/len(record.seq) return ASC for record in SeqIO.parse(fh, "fasta"): print record.id,seqcost(record.seq),avgcost(record.seq) </source>
|