Skip to content

Commit ee48c65

Browse files
committed
fix: return all matching donors instead of excluding one, and report the actual mismatch number
1 parent d38ee5b commit ee48c65

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

grma/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
from grma.donorsgraph.build_donors_graph import BuildMatchingGraph
2-
from grma.match import matching, find_matches
2+
from grma.match.match import matching, find_matches

grma/match/donors_matching.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,13 @@ def __append_matching_donor(
627627
add_donors["Match_Between_Most_Commons_DRB"].append(compare_commons[4])
628628

629629
add_donors["Matching_Probability"].append(match_prob)
630-
add_donors["Number_Of_Mismatches"].append(mm_number)
630+
631+
actual_mismatches = 0
632+
for match_score in compare_commons:
633+
if match_score != 2:
634+
actual_mismatches += (2 - match_score)
635+
636+
add_donors["Number_Of_Mismatches"].append(actual_mismatches)
631637

632638
# compute GvH / HvG counts
633639
pat = self.patients[patient]

grma/match/graph_wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def neighbors(
112112
def neighbors_2nd(self, node):
113113
node_num = self._map_node_to_number[node]
114114
r0, r1 = self._graph.neighbors_2nd(node_num)
115-
return r0[:-1], r1
115+
return r0, r1
116116

117117
def node_value_from_id(self, node_id: int) -> NODES_TYPES:
118118
"""convert lol ID to node value"""

grma/match/lol_graph.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,8 @@ cdef class LolGraph:
177177
neighbors_id[pointer] = self._neighbors_list[j]
178178
pointer += 1
179179

180-
neighbors_value = np.zeros((num_of_neighbors_2nd - 1, 10), dtype=np.uint16)
181-
for i in range(len(neighbors_id) - 1):
180+
neighbors_value = np.zeros((num_of_neighbors_2nd, 10), dtype=np.uint16)
181+
for i in range(len(neighbors_id)):
182182
neighbor_id = neighbors_id[i]
183183
arr = self.arr_node_value_from_id(neighbor_id)
184184
for j in range(10):

0 commit comments

Comments
 (0)