Commit 852e50e1 authored by ADRIAN  AYUSO MUNOZ's avatar ADRIAN AYUSO MUNOZ

Add comments and fix clarity.

parent 31568329
......@@ -213,9 +213,9 @@ class DISNETConstructor:
# Delete from the graph the edges of repo_db
dis_dru_the = pd.concat([dis_dru_the, dis_dru_the_repoDBAll])
dis_dru_the.drop_duplicates(keep=False, inplace=True)
dis_dru_the.drop_duplicates(keep=False, inplace=True, ignore_index=True)
dis_dru_the = dis_dru_the[:50355]
dis_dru_the = dis_dru_the[:50355] # Those of RepoDB added for the concatenation are deleted.
dis_dru_the_repoDBAll = (
torch.tensor(dis_dru_the_repoDBAll['disNID'].astype(np.int32).to_numpy(), dtype=torch.int32,
......@@ -321,7 +321,7 @@ class DISNETConstructor:
# Add the edges to the graph.
for edge_t in edges_dict.keys():
for edge in edges[edge_t]:
for edge in edges[edge_t]: # If a relation between a phenotype and a drug is in more than one type. The final type will be the last one.
try:
G.add_edge(int(edge[0]), int(edge[1]), edge_feature=edge[2], edge_type=edge_t)
except IndexError:
......
......@@ -26,7 +26,7 @@ def filterPreds(original, pred):
new = []
for i, elem in enumerate(pred):
pred_labels = pred[edge, i]
pred_labels = pred[elem]
head = i
tail = torch.arange(0, len(pred_labels)) # All tails.
indexH = ((headsO == head).nonzero(as_tuple=True)[0]) # Index of those heads originally present in the graph.
......
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