(pfm, n_occur, correction_type='approx')
return relative_info
Calculate relative information matrix
Calculate relative information matrix
Calculate relative information matrix
def calc_relative_information(pfm, n_occur, correction_type='approx'):
    """Calculate relative information matrix"""
    bases = list(pfm.keys())
    if correction_type == 'approx':
        info_matrix = calc_info_matrix(pfm, n_occur)
    else:
        info_matrix = calc_info_matrix(pfm, 'exact')
    relative_info = {
        base: [
            np.nan_to_num(prob * info)
            for prob, info in zip(pfm[base], info_matrix)
        ]
        for base in bases
    }
    return relative_info
def calc_relative_information ( pfm , n_occur , correction_type = 'approx' ) : bases = list ( pfm . keys ( ) ) if correction_type == 'approx' : info_matrix = calc_info_matrix ( pfm , n_occur ) else : info_matrix = calc_info_matrix ( pfm , 'exact' ) relative_info = { base : [ np . nan_to_num ( prob * info ) for prob , info in zip ( pfm [ base ] , info_matrix ) ] for base in bases } return relative_info