def run_methods(bins, count, cscore): count[cscore] += 1 ## Single Read Methods fchunk, fcall = Methods.first_chunk( contexts, labels, cscore ) lchunk, lcall = Methods.last_chunk( contexts, labels, cscore ) rchunk, rcall = Methods.random_chunk( contexts, labels, cscore ) ## Multi-Read Methods bchunk, bcall = Methods.best_chunk( contexts, labels ) ichunk, icall = Methods.ind_consensus( contexts, labels, cscore ) hchunk, hcall = Methods.hmm_consensus( indices, ems, len(means), chunk_vector ) # First Chunk if barcode == fcall: bins['f'].append( 1 ) else: bins['f'].append( 0 ) # Last Chunk if barcode == lcall: bins['l'].append( 1 ) else: bins['l'].append( 0 ) # Random Chunk if barcode == rcall: bins['r'].append( 1 ) else: bins['r'].append( 0 ) # Best Chunk if barcode == bcall: bins['b'].append( 1 ) else: bins['b'].append( 0 ) #HMM Consensus if barcode == hcall: bins['h'].append( 1 ) else: bins['h'].append( 0 ) # Ind Consensus if barcode == icall: bins['i'].append( 1 ) else: bins['i'].append( 0 )
def run_methods(bins, cm, cm_counter ): ## Single Read Methods fchunk, fcall = Methods.first_chunk( contexts, labels, cscore ) lchunk, lcall = Methods.last_chunk( contexts, labels, cscore ) rchunk, rcall = Methods.random_chunk( contexts, labels, cscore ) ## Multi-Read Methods bchunk, bcall = Methods.best_chunk( contexts, labels ) ichunk, icall = Methods.ind_consensus( contexts, labels, cscore ) hchunk, hcall = Methods.hmm_consensus( indices, ems, len(means), chunk_vector ) # First Chunk #soft_calls['f'].append( fchunk ) if barcode == fcall: bins['f'] += 1 # Last Chunk #soft_calls['l'].append( lchunk ) if barcode == lcall: bins['l'] += 1 # Random Chunk #soft_calls['r'].append( rchunk ) if barcode == rcall: bins['r'] += 1 # Best Chunk #soft_calls['b'].append( bchunk ) if barcode == bcall: bins['b'] += 1 #HMM Consensus #soft_calls['h'].append( hchunk ) if barcode == hcall: bins['h'] += 1 # Ind Consensus #soft_calls['i'].append( ichunk ) if barcode == icall: bins['i'] += 1 ## Confusion Matrix cm_counter[ cm_choice.index( barcode) ] += 1 # Update appropriate counter cm[ cm_choice.index( barcode ), cm_choice.index( icall ) ] += 1 # Updates correct row given bar code
## For a given cscore, group and iterate through. event_sum = 0 for i in xrange(9, int(cscore*10-1), -1): event_sum += len(ranked_events[i]) for event in ranked_events[i]: # Unpack Variables event_name = event[0] contexts = event[1] labels = event[2] ems = event[3] means = event[4] barcode = event_name.split('-')[0] # Counter for keeping track of number of events counter += 1 ## Single Read Methods fchunk, fcall = Methods.first_chunk( contexts, labels, cscore ) lchunk, lcall = Methods.last_chunk( contexts, labels, cscore ) rchunk, rcall = Methods.random_chunk( contexts, labels, cscore ) ## Multi-Read Methods bchunk, bcall = Methods.best_chunk( contexts, labels ) ichunk, icall = Methods.ind_consensus( contexts, labels, cscore ) hchunk, hcall = Methods.hmm_consensus( indices, ems, len(means), chunk_vector ) #-=Single Read Methods=- # First Chunk soft_calls['f'].append( fchunk ) if fcall[0] == barcode: bins['f'] += 1 # Last Chunk