Commit 5fba93df authored by Ngan Thi Dong's avatar Ngan Thi Dong

update miRNA sim

parent 72832865
......@@ -35,7 +35,7 @@ def get_dgroup_dist(disease_sim, group1, group2):
# The adj matrix is in the form of disease x miRNA
def cal_miRNA_func_sim(adj_matrix, disease_semantic_sim_path, disease_semantic_missing_list, ori_disease_sim_path):
GD, GM = calculate_gip(adj_matrix)
GM, GD = calculate_gip(adj_matrix)
disease_sim = pd.read_csv(disease_semantic_sim_path, header=None).values
ori_disease_sim = pd.read_csv(ori_disease_sim_path, header=None).values
# replace missing disease info with GIP sim
......@@ -52,16 +52,16 @@ def cal_miRNA_func_sim(adj_matrix, disease_semantic_sim_path, disease_semantic_m
ori_disease_sim[idx, :] = GD[idx, :]
# calculate miRNA similarity
n_miRNA = adj_matrix.shape[1]
n_miRNA = adj_matrix.shape[0]
miRNA_sim = np.zeros((n_miRNA, n_miRNA))
for i in range(n_miRNA):
dgroup1 = get_non_zero_item(adj_matrix[:, i])
dgroup1 = get_non_zero_item(adj_matrix[i,:])
m = len(dgroup1)
for j in range(n_miRNA):
if i == j:
miRNA_sim[i, j] = 1.0
continue
dgroup2 = get_non_zero_item(adj_matrix[:, j])
dgroup2 = get_non_zero_item(adj_matrix[j, :])
n = len(dgroup2)
if m + n == 0:
miRNA_sim[i, j] = 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment