Ejemplo n.º 1
0
def calcDistanceMatrix(seqs1,
                       seqs2):  #calculate distance matrix from the 1-step list
    arr = []
    hdist = hamming(seqs1, seqs2, ignore_gaps=False)
    for i in hdist:
        for j in i:
            arr.append(j[0])
    return arr
def calcDistanceMatrix_fast(finalSeqs): #BROKEN
    l=len(finalSeqs)
    arr=np.zeros([l,l])
    hdist=hamming(finalSeqs,finalSeqs,ignore_gaps=False)
    for id in range(len(hdist)):
        item=hdist[id]
        arr[:,id]=item[:,0]
    return arr
Ejemplo n.º 3
0
def calcDistanceMatrix(seqs1, seqs2):
    l1 = len(seqs1)
    l2 = len(seqs2)
    arr = np.zeros([l1, l2])
    hdist = hamming(seqs1, seqs2, ignore_gaps=False)
    for id in range(len(hdist)):
        item = hdist[id]
        arr[:, id] = item[:, 0]
    return arr
Ejemplo n.º 4
0
def calcDistanceMatrix(finalSeqs):  #calculate  distance  matrix  from  list  of  sequences
    l=len(finalSeqs)
    arr=np.zeros([l,l])
    hdist=hamming(finalSeqs,finalSeqs,ignore_gaps=False)
    
    for id in range(len(hdist)):
        item=hdist[id]
        arr[:,id]=item[:,0]
    return arr
Ejemplo n.º 5
0
def calcDistanceMatrix(seqs1,
                       seqs2):  #calculate distance matrix from the 1-step list
    hdist = hamming(seqs1, seqs2, ignore_gaps=False)
    l = len(seqs1)
    w = len(seqs2)
    arr = np.zeros([l, w])
    for id in range(len(hdist)):
        item = hdist[id]
        arr[:, id] = item[:, 0]
    return arr
def calc_distance_matrix(
        finalSeqs):  #calculate distance matrix from the 1-step list
    from ghost.util.distance import hamming
    l = len(finalSeqs)
    arr = np.zeros([l, l])
    hdist = hamming(finalSeqs, finalSeqs, ignore_gaps=False)
    for id in range(len(hdist)):
        item = hdist[id]
        arr[:, id] = item[:, 0]
    return arr
Ejemplo n.º 7
0
def doHdistReturnProp(
    seqs1, seqs2
):  #calculate hamming proportions between two sets of sequences, return matrix
    keylen = len(seqs1[0])
    l1 = len(seqs1)
    l2 = len(seqs2)
    hdist = hamming(seqs1, seqs2, ignore_gaps=False)
    arr = np.zeros([l1, l2])
    for id in range(len(hdist)):
        item = hdist[id]
        arr[:, id] = item[:, 0]
    return np.divide(arr, keylen, dtype=float)