Exemplo n.º 1
0
def distanceTable(frq,method,outfile,met):
	keyDict = sorted(np.unique(("/".join(frq.keys())).split("/")));
	mapDict = dict()       	
	if method == 'min':
		mapDict =minDistance(frq)
	elif method == 'prod':
		mapDict =prodDistance(frq,met)
	pr.printDistanceTableToFile(mapDict,keyDict,outfile)
Exemplo n.º 2
0
 def addGene(self, name: str, seq: str):
     cache = np.zeros(len(self.matrix) + 1)
     cur_index = 0
     for gene in self.geneList:
         dis = minDistance.minDistance(gene[1], seq)[-1][-1]
         if dis == 0:
             gene[2] += 1
             return
         cache[cur_index] = dis
         cur_index += 1
     self.geneList.append([name, seq, 1])
     self.matrix = np.insert(self.matrix, len(self.matrix), values=cache[:-1], axis=1)
     self.matrix = np.insert(self.matrix, len(self.matrix), values=cache, axis=0)
Exemplo n.º 3
0
def computeDistance(frq, method, percentile):
    if method == 'min':
		return minDistance(frq)
    else:
		return prodDistance(frq)