def from_dade_matrix(filename, header=False):
A = np.genfromtxt(filename, delimiter="<STR_LIT:\t>", dtype=None, filling_values=<NUM_LIT:0>)<EOL>M, headers = np.array(A[<NUM_LIT:1>:, <NUM_LIT:1>:], dtype=np.float64), A[<NUM_LIT:0>]<EOL>matrix = M + M.T - np.diag(np.diag(M))<EOL>parsed_header = list(<EOL>zip(*[str(h)[:-<NUM_LIT:1>].strip('<STR_LIT:">').strip("<STR_LIT:'>").split("<STR_LIT>")<EOL>for h in headers[<NUM_LIT:1>:]]))<EOL>if header:<EOL><INDENT>return matrix, parsed_header<EOL><DEDENT>else:<EOL><INDENT>return matrix<EOL><DEDENT>
Loads a numpy array from a Dade matrix instance,
    e.g.: A matrix containing the following (or equivalent in numpy)

    [['RST','chr1~0','chr1~10','chr2~0','chr2~30'],
    ['chr1~0','5', '10', '11', '2'],
    ['chr1~10',   '8', '3', '5'],
    ['chr2~0',         '3', '5'],
    ['chr2~30',             '5']]

    [['5', '10', '11', '2'],
    ['10', '8', '3', '5'],
    [11', '3', '3', '5'],
    ['2', '5', '5', '5']], [chr1~0','chr1~10','chr2~0','chr2~30']

    Header data processing is delegated downstream.

    See https://github.com/scovit/DADE for more details about Dade.