Skip to content

Commit dfb65bf

Browse files
authored
Merge pull request #75 from GuignardLab/loader_pos_bug
Solve naming issue in loader functions
2 parents d40e313 + 1ef7cad commit dfb65bf

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/LineageTree/loaders.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -146,14 +146,14 @@ def read_from_csv(
146146
id_, t, z, y, x, *_ = line
147147
pred = None
148148
t = int(t)
149-
pos = np.array([x, y, z])
149+
positions = np.array([x, y, z])
150150
C = unique_id
151151
corres[id_] = C
152-
pos[-1] = pos[-1] * z_mult
152+
positions[-1] = positions[-1] * z_mult
153153
if pred in corres:
154154
M = corres[pred]
155155
successor.setdefault(M, []).append(C)
156-
pos[C] = pos
156+
pos[C] = positions
157157
time[C] = t
158158
if not name:
159159
tmp_name = Path(file_path).stem
@@ -706,7 +706,7 @@ def read_from_tgmm_xml(
706706
root = tree.getroot()
707707
for unique_id, it in enumerate(root):
708708
if "-1.#IND" not in it.attrib["m"] and "nan" not in it.attrib["m"]:
709-
M_id, pos, cell_id, svIdx, lin_id = (
709+
M_id, positions, cell_id, svIdx, lin_id = (
710710
int(it.attrib["parent"]),
711711
[float(v) for v in it.attrib["m"].split(" ") if v != ""],
712712
int(it.attrib["id"]),
@@ -729,13 +729,13 @@ def read_from_tgmm_xml(
729729
float(it.attrib["nu"]),
730730
float(it.attrib["alphaPrior"]),
731731
)
732-
pos = np.array(pos)
732+
positions = np.array(positions)
733733
C = unique_id
734-
pos[-1] = pos[-1] * z_mult
734+
positions[-1] = positions[-1] * z_mult
735735
if (t - 1, M_id) in time_id:
736736
M = time_id[(t - 1, M_id)]
737737
successor.setdefault(M, []).append(C)
738-
pos[C] = pos
738+
pos[C] = positions
739739
time_id[(t, cell_id)] = C
740740
time[C] = t
741741
properties["svIdx"][C] = svIdx
@@ -745,7 +745,7 @@ def read_from_tgmm_xml(
745745
tmp = list(np.array(W) * nu)
746746
W[C] = np.array(W).reshape(3, 3)
747747
properties["coeffs"][C] = (
748-
tmp[:3] + tmp[4:6] + tmp[8:9] + list(pos)
748+
tmp[:3] + tmp[4:6] + tmp[8:9] + list(positions)
749749
)
750750
if not name:
751751
tmp_name = Path(file_format).stem

0 commit comments

Comments
 (0)