def Thread_Rank(k): """ Method to be done by a thread from the pool""" pack = _args[0] item = Pack() item.name = k item.ratio = ratio(pack, k) return item
def Thread_Align(k): """ Method to be done by a thread from the pool""" pack = _args[0] item = Pack() item.name = k alinhamento = sw.align(pack, k) item.ratio = (alinhamento.mismatches + fabs(len(pack) - len(k)) - alinhamento.matches) + len(pack) return item
def Rankilist(pack): cache = Cache() if _options.single: list_app = [] for k in cache: item = Pack() item.name = k.name item.ratio = ratio(pack, k.name) list_app.append(item) return list_app else: _pool = Pool(processes=_MAX_PEERS) result = _pool.map(Thread_Rank, cache._set) return result
def SmithWaterman(pack): """ Method to execute the algorithm """ cache = Cache() if _options.single: list_app = [] for k in cache: item = Pack() item.name = k.name alinhamento = sw.align(pack, k.name) item.ratio = [alinhamento.matches, fabs(len(pack) - len(k.name)), alinhamento.score, alinhamento.mismatches] list_app.append(item) return list_app else: _pool = Pool(processes=_MAX_PEERS) result = _pool.map(Thread_Align, cache._set) return result
def Thread_Rank(k): pack = _args[0] item = Pack() item.name = k item.ratio = ratio(pack, k) return item