comparison calctfreq.py @ 21:d6b961721037

Miller Lab Devshed version 4c04e35b18f6
author Richard Burhans <burhans@bx.psu.edu>
date Mon, 05 Nov 2012 12:44:17 -0500
parents 2c498d40ecde
children
comparison
equal deleted inserted replaced
20:8a4b8efbc82c 21:d6b961721037
97 while cntGens<ltGens: 97 while cntGens<ltGens:
98 cGen=sdGenes.pop() 98 cGen=sdGenes.pop()
99 sKEGGcPthws=dKEGGcPthws.pop(cGen) 99 sKEGGcPthws=dKEGGcPthws.pop(cGen)
100 for eachP in sKEGGcPthws: 100 for eachP in sKEGGcPthws:
101 if eachP!='N': 101 if eachP!='N':
102 dPthContsTmp[eachP]+=1 102 if eachP in dPthContsTmp:
103 dPthContsTmp[eachP]+=1
104 else:
105 print >> sys.stderr, "Error: pathway not found in database: '{0}'".format(eachP)
106 sys.exit(1)
103 cntGens+=1 107 cntGens+=1
104 #~ Calculate Freqs. 108 #~ Calculate Freqs.
105 ltfreqs=[((Decimal(dPthContsTmp[x])/Decimal(dPthContsTotls[x])),Decimal(dPthContsTmp[x]),x) for x in dPthContsTotls] 109 ltfreqs=[((Decimal(dPthContsTmp[x])/Decimal(dPthContsTotls[x])),Decimal(dPthContsTmp[x]),x) for x in dPthContsTotls]
106 tabllfreqs='\n'.join(rankd(ltfreqs)) 110 tabllfreqs='\n'.join(rankd(ltfreqs))
107 salef=open(outputf,'w') 111 salef=open(outputf,'w')