def objListUtility_addBlockEdges(data, mb, featLen, numBins): """ Utility function for the MafBlock instance version of libMafGffPlot.objListToBinnedWiggle() """ from libMafGffPlot import objListUtility_indexToPos import math import sys for r in [mb.refStart, mb.refEnd]: if r > featLen: sys.stderr.write( 'libMafGffPlot.py: Error in block edge step, a position is ' 'greater than the feature length, %d > %d.\n' % (r, featLen)) sys.exit(1) p = objListUtility_indexToPos(r, featLen, numBins) if p < 0: sys.stderr.write( 'libMafGffPlot.py: Error in block edge step, a position, %d, is less than 0\n' % p) elif p >= len(data['blockEdgeCount']): sys.stderr.write( 'a position, %d, is greater than or ' 'equal to len(data[\'blockEdgeCount\']) %d [%d-%d]\n' % (p, len(data['blockEdgeCount']), mb.refStart, mb.refEnd)) data['blockEdgeCount'][p] += 1.0 if data['blockEdgeCount'][p] > data['blockEdgeMax']: data['blockEdgeMax'] = data['blockEdgeCount'][p]
def objListUtility_addBlockEdges(data, mb, featLen, numBins): """ Utility function for the MafBlock instance version of libMafGffPlot.objListToBinnedWiggle() """ from libMafGffPlot import objListUtility_indexToPos import math import sys for r in [mb.refStart, mb.refEnd]: if r > featLen: sys.stderr.write( "libMafGffPlot.py: Error in block edge step, a position is " "greater than the feature length, %d > %d.\n" % (r, featLen) ) sys.exit(1) p = objListUtility_indexToPos(r, featLen, numBins) if p < 0: sys.stderr.write("libMafGffPlot.py: Error in block edge step, a position, %d, is less than 0\n" % p) elif p >= len(data["blockEdgeCount"]): sys.stderr.write( "a position, %d, is greater than or " "equal to len(data['blockEdgeCount']) %d [%d-%d]\n" % (p, len(data["blockEdgeCount"]), mb.refStart, mb.refEnd) ) data["blockEdgeCount"][p] += 1.0 if data["blockEdgeCount"][p] > data["blockEdgeMax"]: data["blockEdgeMax"] = data["blockEdgeCount"][p]
def objListUtility_addContigPathEdgeErrors(data, mb, featLen, numBins): """ Utility function for the MafBlock instance version of libMafGffPlot.objListToBinnedWiggle() """ from libMafGffPlot import objListUtility_indexToPos import math posSt = objListUtility_indexToPos(mb.refStart, featLen, numBins) posEnd = objListUtility_indexToPos(mb.refEnd, featLen, numBins) # five prime if mb.hplStart == 0: # edge data["mafCpEdgeCount"][posSt] += 1.0 if data["mafCpEdgeCount"][posSt] > data["mafCpEdgeMax"]: data["mafCpEdgeMax"] = data["mafCpEdgeCount"][posSt] elif mb.hplStart == 2: # error data["mafCpErrorCount"][posSt] += 1.0 if data["mafCpErrorCount"][posSt] > data["mafCpErrorMax"]: data["mafCpErrorMax"] = data["mafCpErrorCount"][posSt] elif mb.hplStart == 3: # scaffold gap data["mafCpScafGapCount"][posSt] += 1.0 if data["mafCpScafGapCount"][posSt] > data["mafCpScafGapMax"]: data["mafCpScafGapMax"] = data["mafCpScafGapCount"][posSt] # three prime if mb.hplEnd == 0: # edge data["mafCpEdgeCount"][posEnd] += 1.0 if data["mafCpEdgeCount"][posEnd] > data["mafCpEdgeMax"]: data["mafCpEdgeMax"] = data["mafCpEdgeCount"][posEnd] elif mb.hplEnd == 2: # error data["mafCpErrorCount"][posEnd] += 1.0 if data["mafCpErrorCount"][posEnd] > data["mafCpErrorMax"]: data["mafCpErrorMax"] = data["mafCpErrorCount"][posEnd] elif mb.hplEnd == 3: # scaffold gap data["mafCpScafGapCount"][posEnd] += 1.0 if data["mafCpScafGapCount"][posEnd] > data["mafCpScafGapMax"]: data["mafCpScafGapMax"] = data["mafCpScafGapCount"][posEnd]
def objListUtility_addContigPathEdgeErrors(data, mb, featLen, numBins): """ Utility function for the MafBlock instance version of libMafGffPlot.objListToBinnedWiggle() """ from libMafGffPlot import objListUtility_indexToPos import math posSt = objListUtility_indexToPos(mb.refStart, featLen, numBins) posEnd = objListUtility_indexToPos(mb.refEnd, featLen, numBins) # five prime if mb.hplStart == 0: # edge data['mafCpEdgeCount'][posSt] += 1.0 if data['mafCpEdgeCount'][posSt] > data['mafCpEdgeMax']: data['mafCpEdgeMax'] = data['mafCpEdgeCount'][posSt] elif mb.hplStart == 2: # error data['mafCpErrorCount'][posSt] += 1.0 if data['mafCpErrorCount'][posSt] > data['mafCpErrorMax']: data['mafCpErrorMax'] = data['mafCpErrorCount'][posSt] elif mb.hplStart == 3: # scaffold gap data['mafCpScafGapCount'][posSt] += 1.0 if data['mafCpScafGapCount'][posSt] > data['mafCpScafGapMax']: data['mafCpScafGapMax'] = data['mafCpScafGapCount'][posSt] # three prime if mb.hplEnd == 0: # edge data['mafCpEdgeCount'][posEnd] += 1.0 if data['mafCpEdgeCount'][posEnd] > data['mafCpEdgeMax']: data['mafCpEdgeMax'] = data['mafCpEdgeCount'][posEnd] elif mb.hplEnd == 2: # error data['mafCpErrorCount'][posEnd] += 1.0 if data['mafCpErrorCount'][posEnd] > data['mafCpErrorMax']: data['mafCpErrorMax'] = data['mafCpErrorCount'][posEnd] elif mb.hplEnd == 3: # scaffold gap data['mafCpScafGapCount'][posEnd] += 1.0 if data['mafCpScafGapCount'][posEnd] > data['mafCpScafGapMax']: data['mafCpScafGapMax'] = data['mafCpScafGapCount'][posEnd]