def get_T_yX(fname, y, y_in_Y, x_in_X, F_y):
def _get_k_yX_mul_F_y(y, y_index, X_index):<EOL><INDENT>f = open(fname, '<STR_LIT:r>')<EOL>data = json.load(f)<EOL>f.close()<EOL>k_yX = <NUM_LIT:0.><EOL>for l in [str(key) for key in list(data['<STR_LIT:data>'][y]['<STR_LIT>'].keys())]:<EOL><INDENT>for x in x_in_X[X_index]:<EOL><INDENT>p_yxL = data['<STR_LIT:data>'][y]['<STR_LIT>'][l][x] / <NUM_LIT><EOL>k_yL = data['<STR_LIT:data>'][y]['<STR_LIT>'][l]['<STR_LIT>']<EOL>k_yX +=  p_yxL * k_yL<EOL><DEDENT><DEDENT>return k_yX * F_y[y_index]<EOL><DEDENT>T_yX = np.zeros((len(y), len(x_in_X)))<EOL>for i, y_value in enumerate(y):<EOL><INDENT>for j in range(len(x_in_X)):<EOL><INDENT>k_yX_mul_F_y = <NUM_LIT:0><EOL>for k, yy in enumerate(sum(y_in_Y, [])):                <EOL><INDENT>if y_value in yy:<EOL><INDENT>for yy_value in yy:<EOL><INDENT>ii = np.where(np.array(y) == yy_value)[<NUM_LIT:0>][<NUM_LIT:0>]<EOL>k_yX_mul_F_y += _get_k_yX_mul_F_y(yy_value, ii, j)<EOL><DEDENT><DEDENT><DEDENT>if k_yX_mul_F_y != <NUM_LIT:0>:<EOL><INDENT>T_yX[i, j] = _get_k_yX_mul_F_y(y_value, i, j) / k_yX_mul_F_y<EOL><DEDENT><DEDENT><DEDENT>return T_yX<EOL>
compute the cell type specificity, defined as:
::

    T_yX = K_yX / K_YX
        = F_y * k_yX / sum_y(F_y*k_yX)