#calc ratio ratio = float(xval)/float(yval) if ratio < float(1): ratio = float(1)/ratio #height of biggest peakFiles in pair if xval > yval: max = xval else: max = yval #get hairpin ratio (point in between two peaks) #might want to only do this if distance is within zone... hPoint = x + dist/2 hVal = wigValue.getWigValue(chrom, strand, hPoint) if hVal == 0: hRatio = max else: hRatio = float(max)/(hVal) peakCombos.append([tcc,x,y,dist,ratio,max,hRatio]) #print ' ', peakCombos[-1] #find best combo... topCombo = None for i, combo in enumerate(peakCombos): dist = int(combo[3]) hRatio = int(combo[6]) if (22 < dist < 68) and (hRatio > 2): #distance (22,57) and hRatio(5) are 2 sds! if not topCombo:
#calc ratio ratio = float(xval)/float(yval) if ratio < float(1): ratio = float(1)/ratio #height of biggest peakFiles in pair if xval > yval: max = xval highestValueCoord = x else: max = yval highestValueCoord = y #get 7 points samplePoints = [] samplePoints.append(wigValue.getWigValue(chrom, strand, highestValueCoord + 7)) samplePoints.append(wigValue.getWigValue(chrom, strand, highestValueCoord - 7)) samplePoints.append(wigValue.getWigValue(chrom, strand, highestValueCoord + 15)) samplePoints.append(wigValue.getWigValue(chrom, strand, highestValueCoord - 15)) samplePoints.append(wigValue.getWigValue(chrom, strand, highestValueCoord + 20)) samplePoints.append(wigValue.getWigValue(chrom, strand, highestValueCoord - 20)) ''' #get hairpin ratio (point in between two peaks) #might want to only do this if distance is within zone... hPoint = x + dist/2 hVal = wigValue.getWigValue(chrom, strand, hPoint) if hVal == 0: hRatio = max else: hRatio = float(max)/(hVal) '''
hPeak = i if not hVal > 30: print ' expression not high enough' continue #Now profile it +/- X bp left and right... cProfile = {} zeroPoint = hPeak zeroVal = peaks[chrom][strand][zeroPoint] errors = False for i in range(0, pRange): #get values, ratio for points --> update profile hCoord = zeroPoint + i try: hVal = wigValue.getWigValue(chrom, strand, hCoord) except: print 'Index Messed up', chrom, strand, hCoord errors = True break hRatio = float(hVal) / float(zeroVal) lCoord = zeroPoint - i try: lVal = wigValue.getWigValue(chrom, strand, lCoord) except: print 'Index Messed up', chrom, strand, lCoord errors = True break lRatio = float(lVal) / float(zeroVal)
import getAllWigValues as g import wigValue as w import bioLibCG as cg #g.getAll('chrX', '-1', '100665050') timer = cg.cgTimer() timer.start() print w.getWigValue('chr2', '1', '10438730')
hVal = thisVal hPeak = i if not hVal > 30: print ' expression not high enough' continue #Now profile it +/- X bp left and right... zeroPoint = hPeak zeroVal = peaks[chrom][strand][zeroPoint] errors = False for i in range(1,pRange): #get values, ratio for points --> update profile hCoord = zeroPoint + i try: hVal = wigValue.getWigValue(chrom, strand, hCoord) except: print 'Index Messed up', chrom, strand, hCoord errors = True break hRatio = float(hVal)/float(zeroVal) lCoord = zeroPoint - i try: lVal = wigValue.getWigValue(chrom, strand, lCoord) except: print 'Index Messed up', chrom, strand, lCoord errors = True break lRatio = float(lVal)/float(zeroVal)