def main(): print >>sys.stderr, "Using the average shannonIndex value \ of a group sequences to represent the last entropy." print >>sys.stderr, "Print the result to screen" if len(sys.argv) != 3: print >>sys.stderr, 'Using python %s filename\ threshold(2)[threethe more the high complexity]' % sys.argv[0] sys.exit(0) #----------------------------------- #this three dict have the same structure repDict = {} lcsDict = {} #save low complexity sequences regularDict = {} #save regular sequences readRep(sys.argv[1], repDict) lcs = int(sys.argv[2]) for locus, valueL in repDict.items(): for itemD in valueL: entropy = 0 i_valueS = set(itemD.values()) #i_keys = itemD.keys() for item in i_valueS: entropy += si(item) entropy = entropy / len(i_valueS) if entropy <= lcs: saveDict(lcsDict, locus, itemD) else: saveDict(regularDict, locus, itemD) #--------End one dict--------------- #-------------end all----------------- prefile = sys.argv[1].split('/')[-1] outputRep(lcsDict, prefile+'.LCSs') outputRep(regularDict, prefile+'.HCSs')
def main(): print >>sys.stderr, "Using the average shannonIndex value \ of a group sequences to represent the last entropy." print >>sys.stderr, "Print the result to screen" if len(sys.argv) != 2: print >>sys.stderr, 'Using python %s filename' % sys.argv[0] sys.exit(0) #----------------------------------- repDict = {} readRep(sys.argv[1], repDict) for valueL in repDict.values(): for itemD in valueL: entropy = 0 i_valueS = set(itemD.values()) for item in i_valueS: entropy += si(item) entropy = entropy / len(i_valueS) print "%.2f" % entropy
def main(): print >> sys.stderr, "Using the average shannonIndex value \ of a group sequences to represent the last entropy." print >> sys.stderr, "Print the result to screen" if len(sys.argv) != 2: print >> sys.stderr, 'Using python %s filename' % sys.argv[0] sys.exit(0) #----------------------------------- repDict = {} readRep(sys.argv[1], repDict) for valueL in repDict.values(): for itemD in valueL: entropy = 0 i_valueS = set(itemD.values()) for item in i_valueS: entropy += si(item) entropy = entropy / len(i_valueS) print "%.2f" % entropy