Skip to content

Conversation

@htalibart
Copy link

Dear all,

I noticed that the "matrianglify" function did not yield the correct output for the BLOSUM62 matrix given in the same file. It was a problem of indexes, so I rewrote the function. (I am not aware of a numpy function to do this so I used "for" loops, maybe there is a more optimal way to do it ?)

Hope this will be useful.

@croth1
Copy link

croth1 commented Jul 27, 2020

Dear @htalibart,

sorry for the very late reply, I somehow completely missed the notification. Thanks for reporting the issue! You are right, the matrianglify does not return a symmetric matrix - a vectorized version of your bug fix would be:

def matrianglify_t(data, size=20):
    """ Make a symmetric size * size matrix out of an array of triangle array data"""
    mat = np.zeros((size, size))
    mat[np.tril_indices(size)] = data
    sym_mat = np.maximum(mat, mat.T)
    return sym_mat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants